# PS4 BD-J privilege escalation using nested JAR

PS4 BD-J policy canonicalizes a URL path while the JAR loader treats it as a literal nested-JAR entry, letting disc code load from lib/ext and gain AllPermission.

- Payout: $2,500
- Severity: medium
- Program: PlayStation
- Found by: gezine
- Disclosed: 2026-04-29
- CVE: CVE-2025-64390
- Write-up quality: 9/10
- Original: https://hackerone.com/reports/3452696
- Library page: https://bugbountylibrary.com/r/h1%3A3452696
- Tags: area:os domain:desktop impact:privesc impact:rce kind:bounty platform:hackerone sev:medium tech:java technique:parser-differential technique:source-review vuln:path-traversal vuln:privilege-escalation

**Target:** PS4 BD-J stack (BdjPolicyImpl / JarZipFile class loader)
**Root cause:** BdjPolicyImpl.getPermissions canonicalizes the CodeSource URL with File.getCanonicalPath(), resolving ../, while JarZipFile splits on the first '.jar/' and uses the remainder as a literal nested-JAR entry name, so the checked path and loaded path diverge.
**Steps:**
1. Craft BDJO with applicationId outside signed range (e.g. 0x0000-0x3FFF) so isSigned() returns false and signature verification is skipped.
2. Place outer JAR at /VP/BDMV/JAR/00000.jar containing a nested JAR entry literally named `../../app0/bdjstack/lib/ext/00000.jar` (ZIP magic 0x504B0304).
3. Set Xlet classpath to `file:/dsm/00000.jar/../../app0/bdjstack/lib/ext/00000.jar`.
4. Policy canonicalizes to `/app0/bdjstack/lib/ext/00000.jar`, matches javaHome+lib/ext, grants AllPermission.
5. Loader routes /dsm/ via BDJFactory, getAbsPath prepends /VP/BDMV/JAR/, JarZipFile splits at first `.jar/` and opens entry `../../app0/bdjstack/lib/ext/00000.jar` from the disc JAR.
6. Classes load from untrusted nested JAR with AllPermission.
**How found:** Code review of BdjPolicyImpl.getPermissions vs JarZipFile constructor: noticed policy canonicalizes with File.getCanonicalPath() while JarZipFile uses indexOf('.jar/') and treats the remainder as a literal entry name, suggesting a path-interpretation differential.
**Exploitation:** Attacker burns a Blu-ray disc with a crafted BDJO (unsigned appId range) and outer JAR containing a nested JAR entry named with ../ traversal; the Xlet classpath URL causes the policy to grant AllPermission while classes are actually loaded from the disc, yielding full system access.
**Escalation:** Chains the policy/loader path-interpretation mismatch with the nested-JAR signature-verification bug (isSigned() false skips verification) to reach AllPermission from sandboxed disc content.
**Insight:** When a sandbox check canonicalizes a path but the loader treats it as an opaque archive entry name, look for '.jar/' or similar split points where ../ survives as literal characters; also check whether signature verification is gated on an attacker-controlled appId range.

## Proof of concept (copied exactly from the original report)

**Malicious base path URL with traversal**

```
file:/dsm/00000.jar/../../app0/bdjstack/lib/ext/00000.jar
```

**Nested JAR entry name split**

```
int i = paramString1.indexOf(".jar/");  // i = 19
    
    // Split into outer JAR and entry name
    String str1 = paramString1.substring(0, i + 4);
    // str1 = "/VP/BDMV/JAR/00000.jar"  ← Physical file on disc
    
    String str2 = paramString1.substring(i + 5);
    // str2 = "../../app0/bdjstack/lib/ext/00000.jar"  ← Entry name (literal!)
    
    // Open outer JAR
    this.jf = new JarFile(str1, true);
    // Opens: /VP/BDMV/JAR/00000.jar
    
    // Look for entry by EXACT name
    this.ze = this.jf.getJarEntry(str2);
```

