Blu-ray Disc Java Sandbox Escape via two vulnerabilities
Two vulnerabilities in the Blu-ray Disc Java (BD-J) Ixc implementations allow bypassing permission checks and invoking privileged methods, ultimately disabling the Java security manager. An attacker could achieve native code execution on the Blu-ray player.
Originally disclosed on HackerOne
- Triaged in 38 days
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 6 months
Summary by the program
Blu-ray Disc Java Sandbox Escape
There are two implementations for Ixc (Inter-Xlet Communication) in bd-j. One is org.dvb.io.ixc and the other is com.sun.xlet.ixc. By exploiting two vulnerabilities in each of the implementations, it is possible to disable the security manager and escape the Java sandbox.
Vulnerability 1
The org.dvb.io.ixc implementation uses com.sony.gemstack.org.dvb.io.ixc.IxcProxy which, as described in the first bd-j exploit, allows invoking methods in privileged context. The original vulnerability was mitigated by checking that the method is called from a call stack that includes the com.sony.gemstack.org.dvb.io.ixc.IxcProxy class:
try {
var4 = (Class[])AccessController.doPrivileged(new IxcProxy.GetCallStackAction());
} catch (PrivilegedActionException var9) {
}
if (var4 != null && var4.length > 2) {
for(int var5 = 0; var5 < var4.length; ++var5) {
String var6 = var4[var5].getName();
if (var6.equals("com.sony.gemstack.org.dvb.io.ixc.IxcProxy")) {
String var7 = var4[var5 + 1].getName();
if (!var7.startsWith("org.dvb.io.ixc.") && !var7.startsWith("com.sony.gemstack.org.dvb.io.ixc.")) {
throw new SecurityException("illegal call of invokeMethod");
}
break;
}
}
}
However, this mitigation is not sufficient, as methods from a real proxy class (built by com.sony.gemstack.org.dvb.io.ixc.IxcProxyBuilder) are still allowed to be invoked in privileged context.
An instance can be registered for Ixc if its class implements an interface that extends java.rmi.Remote. Furthermore, methods can only be invoked through Ixc if they throw java.rmi.RemoteException.
Any bootstrap class that fulfills these criteria can as such still exploit the privileged method invocation. The class com.sun.xlet.ixc.IxcRegistryImpl is such a case and it is therefore eligible for Ixc registration via org.dvb.io.ixc.IxcRegistry (by subclassing com.sun.xlet.ixc.IxcRegistryImpl and creating a new instance of the subclass).
Methods in com.sun.xlet.ixc.IxcRegistryImpl contain permission checks which are normall not granted in bd-j:
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new IxcPermission(name, "bind"));
However, by calling bind and lookup through org.dvb.io.ixc on the remote object and invoking the remote methods, it is now possible to bypass the permission checks in com.sun.xlet.ixc.IxcRegistryImpl.
Vulnerability 2
The com.sun.xlet.ixc implementation contains a vulnerability that allows privileged method invocation. Namely, the method com_sun_xlet_execute in com.sun.xlet.ixc.WrappedRemote invokes remoteMethod in a AccessController.doPrivileged block:
AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws RemoteException {
Throwable err = null;
try {
result[0] = remoteMethod.invoke(targetNow, args);
} catch (InvocationTargetException ite) {
err = ite.getTargetException();
} catch (Throwable t) {
err = t;
}
// ...
return null;
}
}
, context);
This method is accessible through the stub class that is generated when registering an object via com.sun.xlet.ixc.IxcClassLoader:
public final class StubClass$$42 extends com.sun.xlet.WrappedRemote
implements UserIF {
private static Method com_sun_xlet_method0;
private static Method com_sun_xlet_method1;
public static void com_sun_xlet_init(Method findMethodMethod)
throws Exception {
// findMethodMethod is Utils.findMethod for the ClassLoader
// where thetarget* Remote object lives.
if (com_sun_xlet_method0 != null) {
return;
}
com_sun_xlet_method0 = (Method) findMethodMethod.invoke(null,
new Object[] { "UserIF", "frob", new Object[] { "Something" }});
com_sun_xlet_method1 = (Method) findMethodMethod.invoke(null,
new Object[] { "UserIF", "glorp",
new Object[] { java.lang.Float.TYPE }});
}
public static void com_sun_xlet_destroy() {
com_sun_xlet_method0 = null;
com_sun_xlet_method1 = null;
}
public StubClass$$42(Remote target, ImportRegistryImpl registry,
RegistryKey key) {
super(target, registry, key);
}
public void frob(Something arg1) throws org.dvb.ixc.RemoteException {
com_sun_xlet_execute(com_sun_xlet_method0,
new Object[] { arg1 });
}
public int glorp(float arg1) throws org.dvb.ixc.RemoteException {
Object r = com_sun_xlet_execute(com_sun_xlet_method1,
new Object[] { new Float(arg1) });
return ((Integer) r).intValue();
}
}
To exploit the privileged method invocation, com_sun_xlet_method0 needs to be set to something interesting.
Consider the following fake System class:
public interface SystemInterface extends java.rmi.Remote {
void setSecurityManager(java.rmi.Remote sm) throws java.rmi.RemoteException;
}
public class SystemImpl implements SystemInterface {
public void setSecurityManager(java.rmi.Remote sm) {}
}
Create an instance of this class and register it via com.sun.xlet.ixc.IxcRegistryImpl (that is achieved by exploiting Vulnerability 1).
On the remote object of the stub class, call com_sun_xlet_destroy to set com_sun_xlet_method0 to null and then call com_sun_xlet_init with a custom findMethod method as argument:
public static Object findMethod(String cName, String mName, Object[] types)
throws NoSuchMethodException {
return System.class.getMethod(
"setSecurityManager", new Class[] {SecurityManager.class});
}
This will set com_sun_xlet_method0 to the real System.setSecurityManager. Now, when calling setSecurityManager(null) on the remote SystemImpl object, the invocation System.SecurityManager(null) will be made instead. This effectively disables the Java sandbox.
Impact
Native code execution in bd-j
Context
Blu-ray Disc Java (bd-j) is the Java environment that runs interactive content on Blu-ray players, including the PlayStation 4. It provides two separate implementations of Ixc (Inter-Xlet Communication), the mechanism by which one Xlet (a Java application on the disc) invokes methods on objects living in another Xlet. The two implementations are org.dvb.io.ixc and com.sun.xlet.ixc.
The report describes how two vulnerabilities, one in each implementation, can be chained to disable the security manager and escape the Java sandbox, ending in native code execution in bd-j. The program rated the issue medium severity, weakness "Execution with Unnecessary Privileges", and paid a 5,000 USD bounty.
Setup
The report does not describe any accounts, roles, tooling or specific versions. The preconditions it does state are structural:
- An attacker can supply Java code that runs as an Xlet in bd-j, since the content comes from the disc.
- For Ixc registration, an object's class must implement an interface that extends
java.rmi.Remote. - Methods can only be invoked through Ixc if they throw
java.rmi.RemoteException.
Finding it
The starting point is the earlier bd-j exploit documented in report 1379975. The org.dvb.io.ixc implementation uses com.sony.gemstack.org.dvb.io.ixc.IxcProxy, which allows invoking methods in a privileged context. That original issue was mitigated by inspecting the call stack and requiring that it contains the com.sony.gemstack.org.dvb.io.ixc.IxcProxy class:
try {
var4 = (Class[])AccessController.doPrivileged(new IxcProxy.GetCallStackAction());
} catch (PrivilegedActionException var9) {
}
if (var4 != null && var4.length > 2) {
for(int var5 = 0; var5 < var4.length; ++var5) {
String var6 = var4[var5].getName();
if (var6.equals("com.sony.gemstack.org.dvb.io.ixc.IxcProxy")) {
String var7 = var4[var5 + 1].getName();
if (!var7.startsWith("org.dvb.io.ixc.") && !var7.startsWith("com.sony.gemstack.org.dvb.io.ixc.")) {
throw new SecurityException("illegal call of invokeMethod");
}
break;
}
}
}
The check walks the stack looking for IxcProxy and then validates the next entry in the array. The researcher noticed that this is not sufficient: methods from a real proxy class, built by com.sony.gemstack.org.dvb.io.ixc.IxcProxyBuilder, are still allowed to be invoked in privileged context. The mitigation constrains which classes may sit next to IxcProxy on the stack, but it does not stop a legitimate proxy from being used to reach privileged code.
Exploitation
Step 1: register a bootstrap class through org.dvb.io.ixc
Because any bootstrap class that implements a java.rmi.Remote-extending interface and throws java.rmi.RemoteException from its methods satisfies the Ixc criteria, it can still exploit the privileged method invocation. The class com.sun.xlet.ixc.IxcRegistryImpl is such a case, so it is eligible for Ixc registration via org.dvb.io.ixc.IxcRegistry, by subclassing com.sun.xlet.ixc.IxcRegistryImpl and creating a new instance of the subclass.
This matters because methods in com.sun.xlet.ixc.IxcRegistryImpl contain permission checks that are normally not granted in bd-j:
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new IxcPermission(name, "bind"));
By calling bind and lookup through org.dvb.io.ixc on the remote object and invoking the remote methods, those permission checks in com.sun.xlet.ixc.IxcRegistryImpl are bypassed. This is Vulnerability 1.
Step 2: reach the privileged invocation in com.sun.xlet.ixc
The second implementation has its own flaw. The method com_sun_xlet_execute in com.sun.xlet.ixc.WrappedRemote invokes remoteMethod inside an AccessController.doPrivileged block:
AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws RemoteException {
Throwable err = null;
try {
result[0] = remoteMethod.invoke(targetNow, args);
} catch (InvocationTargetException ite) {
err = ite.getTargetException();
} catch (Throwable t) {
err = t;
}
// ...
return null;
}
}
, context);
This method is reachable through the stub class generated when an object is registered via com.sun.xlet.ixc.IxcClassLoader. The report shows the shape of such a generated stub:
public final class StubClass$$42 extends com.sun.xlet.WrappedRemote
implements UserIF {
private static Method com_sun_xlet_method0;
private static Method com_sun_xlet_method1;
public static void com_sun_xlet_init(Method findMethodMethod)
throws Exception {
// findMethodMethod is Utils.findMethod for the ClassLoader
// where thetarget* Remote object lives.
if (com_sun_xlet_method0 != null) {
return;
}
com_sun_xlet_method0 = (Method) findMethodMethod.invoke(null,
new Object[] { "UserIF", "frob", new Object[] { "Something" }});
com_sun_xlet_method1 = (Method) findMethodMethod.invoke(null,
new Object[] { "UserIF", "glorp",
new Object[] { java.lang.Float.TYPE }});
}
public static void com_sun_xlet_destroy() {
com_sun_xlet_method0 = null;
com_sun_xlet_method1 = null;
}
public StubClass$$42(Remote target, ImportRegistryImpl registry,
RegistryKey key) {
super(target, registry, key);
}
public void frob(Something arg1) throws org.dvb.ixc.RemoteException {
com_sun_xlet_execute(com_sun_xlet_method0,
new Object[] { arg1 });
}
public int glorp(float arg1) throws org.dvb.ixc.RemoteException {
Object r = com_sun_xlet_execute(com_sun_xlet_method1,
new Object[] { new Float(arg1) });
return ((Integer) r).intValue();
}
}
The stub keeps the resolved methods in static fields, com_sun_xlet_method0 and com_sun_xlet_method1, and its remote methods pass those fields straight into com_sun_xlet_execute. To exploit the privileged invocation, com_sun_xlet_method0 needs to be set to something interesting.
Step 3: register a fake System object
The researcher defines a remote interface and an implementation that stand in for System:
public interface SystemInterface extends java.rmi.Remote {
void setSecurityManager(java.rmi.Remote sm) throws java.rmi.RemoteException;
}
public class SystemImpl implements SystemInterface {
public void setSecurityManager(java.rmi.Remote sm) {}
}
An instance of this class is registered via com.sun.xlet.ixc.IxcRegistryImpl, which is achieved by exploiting Vulnerability 1 from Step 1.
Step 4: overwrite the cached method
On the remote object of the stub class, the attacker calls com_sun_xlet_destroy to set com_sun_xlet_method0 to null, then calls com_sun_xlet_init with a custom findMethod method as the argument:
public static Object findMethod(String cName, String mName, Object[] types)
throws NoSuchMethodException {
return System.class.getMethod(
"setSecurityManager", new Class[] {SecurityManager.class});
}
This sets com_sun_xlet_method0 to the real System.setSecurityManager instead of the method belonging to the fake object.
Step 5: disable the security manager
When setSecurityManager(null) is called on the remote SystemImpl object, the invocation System.SecurityManager(null) is made instead. That effectively disables the Java sandbox.
Root cause
Two design mistakes combine.
- The call-stack mitigation in
org.dvb.io.ixconly checks thatIxcProxyappears on the stack and that the class above it is in an allowed package. It does not prevent a genuine proxy, built byIxcProxyBuilder, from being used to invoke privileged methods. Any bootstrap class meeting the Ixc criteria, such ascom.sun.xlet.ixc.IxcRegistryImpl, can therefore be registered and its permission-checked methods reached through the proxy, bypassing theIxcPermissionchecks. com.sun.xlet.ixc.WrappedRemote.com_sun_xlet_executeperformsremoteMethod.invoke(targetNow, args)insideAccessController.doPrivileged. The method to invoke is held in a static field of the generated stub and can be replaced throughcom_sun_xlet_destroyandcom_sun_xlet_init, so attacker-controlled code can redirect the privileged invocation to an arbitrary method, hereSystem.setSecurityManager.
Impact
The stated impact is native code execution in bd-j. The stated impact is native code execution in bd-j, and the chain ends with the security manager disabled.
Fix
The report does not describe any fix or mitigation that was applied.
Variants to test
- Look for other bootstrap classes that implement a
java.rmi.Remote-extending interface and throwjava.rmi.RemoteException, and check whether they can be registered throughorg.dvb.io.ixc.IxcRegistrythe same waycom.sun.xlet.ixc.IxcRegistryImplwas. A positive result is a successfulbindorlookupon such an object without holding the correspondingIxcPermission. - Audit other call-stack checks that look for a trusted class name and then validate only the adjacent frame. A positive result is a path where a legitimate proxy or builder class satisfies the check while the invoked method still runs privileged.
- Search for
AccessController.doPrivilegedblocks that invoke aMethodheld in a mutable static field, and for static initialiser or destroy methods that can reset those fields. A positive result is the ability to point the field at a different method, such as one that changes the security manager.
Hunting notes
The bug lives where two parallel implementations of the same feature exist and only one of them received a security fix. The stack-walking mitigation in org.dvb.io.ixc is the signal: it constrains the caller but not the callee, and the sibling implementation com.sun.xlet.ixc still exposes a privileged invocation path. During review, look for generated stub classes with static Method fields, public static init and destroy helpers, and doPrivileged wrappers around reflective invocation. The researcher completed the chain to System.setSecurityManager(null), which disables the Java sandbox.
What happened, in plain words
A Blu-ray disc can carry small Java programs that run on the player, including the PlayStation 4. The player runs them inside a restricted area called a sandbox, a set of rules that stops a program from doing anything the disc is not supposed to be able to do. The researcher found two separate mistakes in the software that runs these programs, and showed that by using one after the other, a disc could switch off the sandbox entirely and run native code on the console.
The program rated the issue medium severity, filed it under the weakness "Execution with Unnecessary Privileges", and paid a 5,000 USD bounty.
Background: what bd-j and Ixc are
Blu-ray Disc Java, shortened to bd-j, is the Java environment that runs interactive content on Blu-ray players, the PlayStation 4 included. Think of it as a small app platform built into the player: the disc supplies an app, and the player runs it.
An app on a disc is called an Xlet. A disc can hold more than one Xlet, and they sometimes need to talk to each other. The mechanism for that is Ixc, short for Inter-Xlet Communication. In everyday terms, it is like two colleagues in separate offices passing notes: one Xlet asks another Xlet to run one of its functions and hand back the result.
bd-j ships two separate implementations of Ixc, meaning two different pieces of code that do the same job:
org.dvb.io.ixccom.sun.xlet.ixc
Having two implementations of one feature is the setting for this whole story. The earlier issue in one of them was mitigated, and the other still allowed privileged method invocation.
The setup and the rules of the game
The report does not describe any accounts, tools or specific software versions. What it does describe are the ground rules that make the attack possible:
- The attacker can supply Java code that runs as an Xlet, because the content comes from the disc. In other words, the attacker controls the app, not just its input.
- For an object to be registered for Ixc, its class must implement an interface that extends
java.rmi.Remote. - A method can only be called through Ixc if it throws
java.rmi.RemoteException.
A few of those words need unpacking for a newcomer.
An interface, in Java, is a contract: a list of function names with no bodies, saying "anything that claims to implement me promises to provide these functions". java.rmi.Remote is a marker interface from Java's remote method invocation system. It does not add functions; it simply marks a class as something that can be called across a boundary. The two rules above are the entry ticket: meet them and the Ixc machinery will let your object be registered and called.
An exception is Java's way of signalling that something went wrong. java.rmi.RemoteException is the specific error type used when a remote call fails. Requiring methods to declare it is part of the same remote-call contract.
Finding it: the earlier bug and its patch
The starting point is an earlier bd-j exploit, documented in report 1379975. The org.dvb.io.ixc implementation uses a class called com.sony.gemstack.org.dvb.io.ixc.IxcProxy, and that class allows methods to be invoked in a privileged context. Privileged here means running with more rights than the calling code would normally have, similar to a receptionist who is allowed into the back office while visitors are not.
That original issue was mitigated, meaning softened rather than fully fixed, by inspecting the call stack. The call stack is the list of functions currently in progress, from the one that started the chain down to the one running right now. It is like a stack of letters on a desk: you can see who asked whom. The patch requires that the stack contains the IxcProxy class:
try {
var4 = (Class[])AccessController.doPrivileged(new IxcProxy.GetCallStackAction());
} catch (PrivilegedActionException var9) {
}
if (var4 != null && var4.length > 2) {
for(int var5 = 0; var5 < var4.length; ++var5) {
String var6 = var4[var5].getName();
if (var6.equals("com.sony.gemstack.org.dvb.io.ixc.IxcProxy")) {
String var7 = var4[var5 + 1].getName();
if (!var7.startsWith("org.dvb.io.ixc.") && !var7.startsWith("com.sony.gemstack.org.dvb.io.ixc.")) {
throw new SecurityException("illegal call of invokeMethod");
}
break;
}
}
}
Line by line:
AccessController.doPrivileged(new IxcProxy.GetCallStackAction())runs a small action with elevated rights. The action's job is to fetch the current call stack as an array of classes.- The
tryandcatcharound it handle a failure while fetching the stack. if (var4 != null && var4.length > 2)only checks when the stack array has more than two entries.- The
forloop walks the stack from top to bottom, one class at a time. var6.equals("com.sony.gemstack.org.dvb.io.ixc.IxcProxy")asks: is this entry the trusted proxy class?- If yes,
var4[var5 + 1]looks at the next entry in the array. - The two
startsWithchecks allow only callers whose package name begins withorg.dvb.io.ixc.orcom.sony.gemstack.org.dvb.io.ixc.. Anything else triggersthrow new SecurityException("illegal call of invokeMethod"), refusing the call. breakstops the loop once the proxy has been found and checked.
The researcher noticed this is not enough. Methods from a real proxy class, built by com.sony.gemstack.org.dvb.io.ixc.IxcProxyBuilder, are still allowed to be invoked in privileged context. The patch controls which classes may sit next to IxcProxy on the stack, but it does not stop a legitimate proxy from being used to reach privileged code. The guard checks the shape of the queue, not what the person at the front is carrying.
Exploitation
Step 1: register a bootstrap class through org.dvb.io.ixc
Because any bootstrap class that implements a java.rmi.Remote-extending interface and throws java.rmi.RemoteException from its methods satisfies the Ixc criteria, it can still exploit the privileged method invocation. A bootstrap class is a class that ships with the platform itself rather than with the disc, so it is already loaded and trusted by the runtime.
The class com.sun.xlet.ixc.IxcRegistryImpl is such a case, so it is eligible for Ixc registration via org.dvb.io.ixc.IxcRegistry, by subclassing com.sun.xlet.ixc.IxcRegistryImpl and creating a new instance of the subclass. Subclassing means writing your own class that inherits from the platform class, then creating an object of your version. The object is yours, but the behaviour it inherits is the platform's.
This matters because methods in com.sun.xlet.ixc.IxcRegistryImpl contain permission checks that are normally not granted in bd-j:
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new IxcPermission(name, "bind"));
Line by line:
System.getSecurityManager()fetches the security manager, the component that enforces the sandbox rules. Think of it as the building's security guard.if (sm != null)only proceeds when a guard is present. If the sandbox has already been switched off, there is nothing to check.sm.checkPermission(new IxcPermission(name, "bind"))asks the guard whether the caller holds the permission to bind, that is, to register a name in the Ixc registry. If the caller does not hold it, the guard throws an error and the operation stops.
By calling bind and lookup through org.dvb.io.ixc on the remote object and invoking the remote methods, those permission checks in com.sun.xlet.ixc.IxcRegistryImpl are bypassed. bind registers a name, lookup finds an object by name. The call arrives through org.dvb.io.ixc, whose proxy is allowed to invoke privileged methods, so the permission checks are bypassed. This is Vulnerability 1.
Step 2: reach the privileged invocation in com.sun.xlet.ixc
The second implementation has its own flaw. The method com_sun_xlet_execute in com.sun.xlet.ixc.WrappedRemote invokes remoteMethod inside an AccessController.doPrivileged block:
AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws RemoteException {
Throwable err = null;
try {
result[0] = remoteMethod.invoke(targetNow, args);
} catch (InvocationTargetException ite) {
err = ite.getTargetException();
} catch (Throwable t) {
err = t;
}
// ...
return null;
}
}
, context);
Line by line:
AccessController.doPrivileged(...)runs the enclosed action with elevated rights, regardless of what the caller would normally be allowed to do. This is the same idea as the receptionist with back-office access.new PrivilegedExceptionAction()creates the action object, whoserunmethod holds the work.Throwable err = null;prepares a variable to remember any error.remoteMethod.invoke(targetNow, args)is the heart of it: it calls a method chosen at runtime (remoteMethod) on a chosen object (targetNow) with chosen arguments (args). Reflection, as this is called, lets a program pick a function by name while it is running rather than fixing it when the code is written.- The
catchblocks record failures instead of letting them escape immediately. return null;ends the action.
The important part is that the method being called is held in a static field of the stub, and that field can be replaced.
This method is reachable through the stub class generated when an object is registered via com.sun.xlet.ixc.IxcClassLoader. A stub is a small stand-in object: when one Xlet wants to call another, it holds a stub that looks like the real object but forwards each call across the boundary. The report shows the shape of such a generated stub:
public final class StubClass$$42 extends com.sun.xlet.WrappedRemote
implements UserIF {
private static Method com_sun_xlet_method0;
private static Method com_sun_xlet_method1;
public static void com_sun_xlet_init(Method findMethodMethod)
throws Exception {
// findMethodMethod is Utils.findMethod for the ClassLoader
// where thetarget* Remote object lives.
if (com_sun_xlet_method0 != null) {
return;
}
com_sun_xlet_method0 = (Method) findMethodMethod.invoke(null,
new Object[] { "UserIF", "frob", new Object[] { "Something" }});
com_sun_xlet_method1 = (Method) findMethodMethod.invoke(null,
new Object[] { "UserIF", "glorp",
new Object[] { java.lang.Float.TYPE }});
}
public static void com_sun_xlet_destroy() {
com_sun_xlet_method0 = null;
com_sun_xlet_method1 = null;
}
public StubClass$$42(Remote target, ImportRegistryImpl registry,
RegistryKey key) {
super(target, registry, key);
}
public void frob(Something arg1) throws org.dvb.ixc.RemoteException {
com_sun_xlet_execute(com_sun_xlet_method0,
new Object[] { arg1 });
}
public int glorp(float arg1) throws org.dvb.ixc.RemoteException {
Object r = com_sun_xlet_execute(com_sun_xlet_method1,
new Object[] { new Float(arg1) });
return ((Integer) r).intValue();
}
}
Line by line:
public final class StubClass$$42 extends com.sun.xlet.WrappedRemote implements UserIFdeclares the stub. It inherits fromWrappedRemote, which is wherecom_sun_xlet_executelives, and promises to provide the functions listed in theUserIFinterface. The$$42is just a generated name.private static Method com_sun_xlet_method0;andcom_sun_xlet_method1are two storage slots shared by the whole class, each holding a reference to a method. Static means one copy for the class, not one per object.com_sun_xlet_init(Method findMethodMethod)is a setup function. It takes a helper that knows how to find methods.if (com_sun_xlet_method0 != null) { return; }skips setup if the slots are already filled.com_sun_xlet_method0 = (Method) findMethodMethod.invoke(null, new Object[] { "UserIF", "frob", new Object[] { "Something" }});uses the helper to look up the method namedfrobon theUserIFinterface, taking aSomethingargument, and stores it in the first slot.- The next line does the same for
glorp, which takes a float, storing it in the second slot. com_sun_xlet_destroy()empties both slots by setting them to null.- The constructor
StubClass$$42(Remote target, ImportRegistryImpl registry, RegistryKey key)passes the target object, the registry and the key up to the parent class, so the stub knows what it is standing in for. frob(Something arg1)callscom_sun_xlet_executewith whatever is in the first slot and the argument it received.glorp(float arg1)does the same with the second slot, then converts the result to an integer and returns it.
The stub keeps the resolved methods in static fields, com_sun_xlet_method0 and com_sun_xlet_method1, and its remote methods pass those fields straight into com_sun_xlet_execute. To exploit the privileged invocation, com_sun_xlet_method0 needs to be set to something interesting. In other words, the stub is a delivery van that will carry any parcel placed in its loading bay, and the loading bay can be refilled from outside.
Step 3: register a fake System object
The researcher defines a remote interface and an implementation that stand in for System:
public interface SystemInterface extends java.rmi.Remote {
void setSecurityManager(java.rmi.Remote sm) throws java.rmi.RemoteException;
}
public class SystemImpl implements SystemInterface {
public void setSecurityManager(java.rmi.Remote sm) {}
}
Line by line:
public interface SystemInterface extends java.rmi.Remotedeclares a contract that also carries the remote marker, so objects implementing it can be registered for Ixc.void setSecurityManager(java.rmi.Remote sm) throws java.rmi.RemoteException;is the single function in the contract. It takes a remote object and returns nothing. The name is deliberately chosen to look like the real Java call that installs a security manager.public class SystemImpl implements SystemInterfaceis the actual class, promising to honour the contract.public void setSecurityManager(java.rmi.Remote sm) {}is the body, and it does nothing at all. The fake object is a decoy: it exists to be registered and called, not to do any work.
An instance of this class is registered via com.sun.xlet.ixc.IxcRegistryImpl, which is achieved by exploiting Vulnerability 1 from Step 1. The decoy is smuggled into the registry through the permission bypass found earlier.
Step 4: overwrite the cached method
On the remote object of the stub class, the attacker calls com_sun_xlet_destroy to set com_sun_xlet_method0 to null, then calls com_sun_xlet_init with a custom findMethod method as the argument:
public static Object findMethod(String cName, String mName, Object[] types)
throws NoSuchMethodException {
return System.class.getMethod(
"setSecurityManager", new Class[] {SecurityManager.class});
}
Line by line:
findMethod(String cName, String mName, Object[] types)is a replacement for the helper the stub normally uses. It receives a class name, a method name and the argument types, the same information the real helper would receive.throws NoSuchMethodExceptiondeclares that it may fail if the method cannot be found.System.class.getMethod("setSecurityManager", new Class[] {SecurityManager.class})ignores the names it was given and always returns the realSystem.setSecurityManagermethod, the one that installs or removes the security manager.returnhands that method back to the caller.
Because com_sun_xlet_init stores whatever the helper returns into com_sun_xlet_method0, this sets that slot to the real System.setSecurityManager instead of the method belonging to the fake object. The loading bay now holds a different parcel from the one on the label.
Step 5: disable the security manager
When setSecurityManager(null) is called on the remote SystemImpl object, the invocation System.SecurityManager(null) is made instead. That effectively disables the Java sandbox. Passing null means "no security manager", and with no guard in place, the restrictions that kept the disc's code in its box are gone.
Root cause
Two design mistakes combine.
- The call-stack mitigation in
org.dvb.io.ixconly checks thatIxcProxyappears on the stack and that the class above it is in an allowed package. It does not prevent a genuine proxy, built byIxcProxyBuilder, from being used to invoke privileged methods. Any bootstrap class meeting the Ixc criteria, such ascom.sun.xlet.ixc.IxcRegistryImpl, can therefore be registered and its permission-checked methods reached through the proxy, bypassing theIxcPermissionchecks. com.sun.xlet.ixc.WrappedRemote.com_sun_xlet_executeperformsremoteMethod.invoke(targetNow, args)insideAccessController.doPrivileged. The method to invoke is held in a static field of the generated stub and can be replaced throughcom_sun_xlet_destroyandcom_sun_xlet_init, so attacker-controlled code can redirect the privileged invocation to an arbitrary method, hereSystem.setSecurityManager.
Impact
The stated impact is native code execution in bd-j. Native code means instructions the processor runs directly, outside the Java environment's control. The stated impact is native code execution in bd-j, and the chain ends with the security manager disabled.
Fix
The report does not describe any fix or mitigation that was applied.
Variants to test
- Look for other bootstrap classes that implement a
java.rmi.Remote-extending interface and throwjava.rmi.RemoteException, and check whether they can be registered throughorg.dvb.io.ixc.IxcRegistrythe same waycom.sun.xlet.ixc.IxcRegistryImplwas. A positive result is a successfulbindorlookupon such an object without holding the correspondingIxcPermission. - Audit other call-stack checks that look for a trusted class name and then validate only the adjacent frame. A positive result is a path where a legitimate proxy or builder class satisfies the check while the invoked method still runs privileged.
- Search for
AccessController.doPrivilegedblocks that invoke aMethodheld in a mutable static field, and for static initialiser or destroy methods that can reset those fields. A positive result is the ability to point the field at a different method, such as one that changes the security manager.
Hunting notes
The bug lives where two parallel implementations of the same feature exist and only one of them received a security fix. The stack-walking mitigation in org.dvb.io.ixc is the signal: it constrains the caller but not the callee, and the sibling implementation com.sun.xlet.ixc still exposes a privileged invocation path. During review, look for generated stub classes with static Method fields, public static init and destroy helpers, and doPrivileged wrappers around reflective invocation. The researcher completed the chain to System.setSecurityManager(null), which disables the Java sandbox.
Glossary
- bd-j (Blu-ray Disc Java): the Java environment that runs interactive content on Blu-ray players, including the PlayStation 4.
- Xlet: a Java application supplied on a Blu-ray disc and run by the player.
- Ixc (Inter-Xlet Communication): the mechanism by which one Xlet calls functions on objects belonging to another Xlet.
- Sandbox: a restricted area in which a program runs, with rules that limit what it can do.
- Security manager: the component that enforces the sandbox rules and checks permissions before sensitive operations.
- Privileged context: running with more rights than the calling code would normally have.
- Interface: a Java contract listing function names without bodies; a class that implements it promises to provide them.
java.rmi.Remote: a marker interface that flags a class as callable across a boundary.- Exception: Java's way of signalling that something went wrong.
java.rmi.RemoteException: the error type used when a remote call fails.- Call stack: the list of functions currently in progress, from the first caller down to the one running now.
- Bootstrap class: a class that ships with the platform itself rather than with the disc.
- Subclassing: writing a class that inherits from another class and creating objects of the new one.
- Permission check: a test asking the security manager whether the caller is allowed to perform an operation.
bind: registering a name for an object in the Ixc registry.lookup: finding an object in the Ixc registry by name.AccessController.doPrivileged: a Java construct that runs a block of code with elevated rights.- Reflection: the ability of a program to choose and call a function by name while it is running.
- Stub: a small stand-in object that forwards calls to a real object across a boundary.
- Static field: storage shared by a whole class rather than by each individual object.
- Native code execution: running instructions directly on the processor, outside the Java environment's control.
- Bounty: a payment made by a program to a researcher for a valid security report.