Skip to content
Access control Write-up Advanced

Phrack: Twenty Years of Exploits Escaping the Java Sandbox

The paper explains how type confusion and other flaws in the Java runtime let untrusted applet code disable the security manager and escape the sandbox. An attacker could then run arbitrary Java code with all permissions on the host.

exploit-db.com

Published on exploit-db.com

1 - Introduction 2 - Background 2.1 - A Brief History of Java Sandbox Exploits 2.2 - The Java Platform 2.3 - The Security Manager 2.4 - The doPrivileged Method 3 - Memory Corruption Vulnerabilities 3.1 - Type Confusion 3.1.1 - Background 3.1.2 - Example: CVE-2017-3272 3.1.3 - Discussion 3.2 - Integer Overflow 3.2.1 -…

phrack, on exploit-db.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a type confusion in the atomic field updater classes, where a protected field's access check used the wrong class, allowing a protected method to be reached.

Impact

An attacker could bypass the Java sandbox and execute arbitrary Java code with all permissions, though browsers later disabled the plugin by default, reducing the attack surface.

What the attacker needed

Victim runs untrusted Java applet; Java plugin enabled in browser

The fix

The updater constructor was changed so the caller class is only stored when it is assignable from the target class and in a different package.

How it was found

  1. Obtain a reference to an existing class loader without needing a permission.
  2. Use the type confusion to make the runtime treat that class loader as a subclass of the attacker's helper class.
  3. Pass it to the helper's static method so the protected defineClass method can be called.
  4. Load attacker bytecode with all permissions and instantiate it to set the security manager to null.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Java can run code from a website inside a restricted box called the sandbox, so the code cannot touch your files. The paper shows that bugs in Java itself let that code trick the runtime into removing the restrictions. Once the restrictions are gone, the code can do anything the user could do.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.