# Remote vulnerabilities in spp

Malicious PPPoE server exploits unvalidated option lengths in PS4/PS5 kernel sppp IPCP/LCP and PAP handlers to overflow/overread heap, leaking pointers and potentially achieving kernel RCE.

- Payout: $12,500
- Severity: high
- Program: PlayStation
- Found by: theflow0
- Disclosed: 2024-04-25
- CVE: CVE-2006-4304
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/2177925
- Library page: https://bugbountylibrary.com/r/h1%3A2177925
- Tags: area:devices domain:infra domain:network impact:data-leak impact:dos impact:rce kind:bounty platform:hackerone sev:high technique:oob-exfil technique:source-review vuln:dos vuln:info-disclosure vuln:memory-corruption

**Target:** PS4/PS5 kernel PPP/PPPoE sppp (sppp_ipcp_RCR, sppp_lcp_RCR, sppp_pap_input)
**Root cause:** sppp_ipcp_RCR/lcp_RCR iterate options using p[1] as length without checking it against remaining len, so bcopy copies attacker-controlled size into a malloc(len) buffer; sppp_pap_input computes len-6 with len<6 causing integer underflow that bypasses name_len/passwd_len bounds checks.
**Steps:**
1. Act as malicious PPPoE server and send IPCP CONF_REQ with an option whose length byte p[1] exceeds remaining len
2. Observe bcopy(p, r, p[1]) overflows buf and rlen grows, so sppp_cp_send returns overread mbuf data (pointers) to attacker
3. Control malloc size via LCP header h->len so a larger mbuf is copied into a smaller buf, overwriting adjacent heap allocations with controlled data
4. Send PAP_REQ with h->len set to 0-5 so len-6 underflows negative, bypassing name_len/passwd_len checks
5. Set name/secret to compare against OOB mbuf bytes via memcmp, using differing PAP responses as an oracle to leak kernel pointers and defeat KASLR
**How found:** Recognized the PS4/PS5 PPP stack matched a known 2006 FreeBSD advisory (CVE-2006-4304); code review of sppp_ipcp_RCR/lcp_RCR showed p[1] used as copy length without bounds check, and sppp_pap_input showed len-6 underflow when h->len<6.
**Exploitation:** Attacker controls the PPPoE server the console connects to. By crafting IPCP/LCP CONF_REQ options with oversized length bytes, the kernel copies beyond the heap buffer and reflects overread mbuf contents (including pointers) back in the CONF_REJ. Allocation size is influenced via the LCP header length, enabling controlled heap overwrite of adjacent allocations. Separately, PAP_REQ with a short h->len triggers integer underflow, letting memcmp read OOB and using response differences as a leak oracle for KASLR defeat. Combined, DoS via panic and potential kernel RCE.
**Escalation:** Chains heap overwrite with pointer leak via PAP oracle to defeat KASLR, raising DoS to potential remote kernel code execution.
**Insight:** Legacy BSD-derived network stacks embedded in consoles/embedded devices often retain decades-old CVEs; grep for old FreeBSD/NetBSD advisories against the target's kernel source and check length fields used before validation.

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

**Malformed IPCP option length causing heap overflow**

```
for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { // [1]
		if (debug)
			addlog(" %s", sppp_ipcp_opt_name(*p));
		switch (*p) {
        // ...
		default:
			/* Others not supported. */
			if (debug)
				addlog(" [rej]");
			break;
		}
		/* Add the option to rejected list. */
		bcopy (p, r, p[1]); // [2]
		r += p[1];
		rlen += p[1]; // [3]
```

**PAP length underflow bypassing bounds checks**

```
name = 1 + (u_char*)(h+1);
		name_len = name[-1];
		passwd = name + name_len + 1;
		if (name_len > len - 6 || // [2]
		    (passwd_len = passwd[-1]) > len - 6 - name_len) {
```

