Oracle Java SE HotSpot Type Confusion Sandbox Escape (CVE-2012-1723)
Published: 2026-11-27 • Researcher: Ethaniel Cox (EthanNJC / ethaniel.me)
Exploitation signals
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
References
- https://nvd.nist.gov/vuln/detail/CVE-2012-1723
- https://github.com/EthanNJC/CVE-2012-1723
- https://ethaniel.me/2017/02/09/practice-the-past-cve-2012-1723/
- http://www.oracle.com/technetwork/topics/security/javacpujun2012-1515912.html
- http://rhn.redhat.com/errata/RHSA-2012-0734.html
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2012-1723
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2017-02-20 |
| Author / Researcher | Ethaniel Cox (EthanNJC / ethaniel.me) |
| CVE / Advisory | CVE-2012-1723 |
| Category | binary |
| Severity | Critical |
| CVSS Score | 9.8 (CVSSv3.1, NVD); 10.0 (CVSSv2, NVD) |
| Status | PoC (working sandbox escape; requires a manual bytecode patch; demonstration payload only) |
| Tags | Java, JVM, HotSpot, type confusion, sandbox escape, applet, drive-by, CWE-284, CISA KEV |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Oracle Java SE (JRE and JDK), HotSpot |
| Versions Affected | 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) |
| Language / Platform | Java bytecode / JVM; browser applet plugin on Windows, Linux and macOS |
| Authentication Required | No |
| Network Access Required | Yes (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.
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 pluginSetup Steps
| |
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
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.
Build the applet jar — Compile the applet, payload and class loader classes, then package them into exploit.jar.
Host the drive-by page — Publish DriveBy.html with the applet tag and exploit.jar on a web server reachable by the victim.
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.
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) andPayload.java(payload) in this folder.
| |
Expected 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
GET /driveby.html HTTP/1.1
GET /exploit.jar HTTP/1.1
Content-Type: application/java-archiveSIEM / IDS Rule (example):
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
| Action | Detail |
|---|---|
| Patch | Update to Oracle Java SE 7 Update 5, 6 Update 33, 5.0 Update 36 or later (Oracle Critical Patch Update June 2012). |
| Workaround | Disable the Java browser plugin, block applet and jar downloads at the proxy, and prevent browsers from launching the plugin. |
| Config Hardening | Remove 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.
| |