# SOCK_RAW sockets reachable from Webkit process allows triggering double free in IP6_EXTHDR_CHECK

Fragmented IPv6 packets to loopback trigger a double free in IP6_EXTHDR_CHECK because dest6_input/frag6_input don't update the mbuf pointer, yielding kernel memory corruption from the WebKit process.

- Payout: $10,000
- Severity: high
- Program: PlayStation
- Found by: theflow0
- Disclosed: 2021-01-12
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/943231
- Library page: https://bugbountylibrary.com/r/h1%3A943231
- Tags: area:os domain:desktop impact:privesc impact:rce kind:bounty platform:hackerone sev:high tech:linux technique:source-review vuln:dos vuln:memory-corruption

**Target:** FreeBSD 9 / PS4 kernel IPv6 input path (dest6_input, frag6_input) via SOCK_RAW
**Root cause:** IP6_EXTHDR_CHECK can free the mbuf on loopback, but callers like dest6_input() keep a stale local pointer and don't update *mp, so the freed mbuf is freed again during next-header parsing.
**Steps:**
1. Open a SOCK_RAW socket (possible in the PS4 WebKit process despite normally requiring root).
2. Send fragmented IPv6 packets to the loopback interface so IP6_EXTHDR_CHECK frees the mbuf.
3. Trigger dest6_input()/frag6_input() to parse next headers using the stale mbuf pointer.
4. Cause the mbuf to be freed a second time, producing a double free that behaves as use-after-free when mbufs are reallocated.
5. Reallocate mbufs to shape the freed memory and achieve kernel memory corruption / privilege escalation.
**How found:** Noticed IP6_EXTHDR_CHECK can free the mbuf on loopback and that dest6_input()/frag6_input() don't update the double pointer, then observed SOCK_RAW is unexpectedly openable in the PS4 WebKit process, making the normally root-only path reachable.
**Exploitation:** Run poc.c (root on FreeBSD 9) or ps4.c on PS4 to send crafted fragmented IPv6 packets to loopback, triggering the double free; reallocate mbufs to turn it into use-after-free and escalate to kernel privileges. Reliability ~80% on FreeBSD, ~20% on PS4.
**Escalation:** Chain with a WebKit exploit for a fully remote attack; enables stealing/manipulating user data and dumping/running pirated games.
**Insight:** Audit IP6_EXTHDR_CHECK callers for stale mbuf pointers after the macro may free; and check whether privileged socket types (SOCK_RAW) are unexpectedly available in sandboxed processes like the browser renderer.

