Skip to content
Memory corruption Disclosed report Advanced

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

A double-free vulnerability in the FreeBSD kernel's IPv6 fragment handling can be triggered by sending crafted packets to the loopback interface. On the PS4, raw sockets are accessible from the WebKit process, allowing an attacker to escalate privileges to the kernel.

Andy Nguyen Follow

Originally disclosed on HackerOne

Bounty$10,000 High View original
  • Triaged in 9 days
  • Fixed in 3 months
  • Paid in 16 days
  • Disclosed after 6 months

Summary by the program

Summary

Memory corruption can be achieved by sending fragmented IPv6 packets to loopback interface due to poor and inconsistent use of IP6_EXTHDR_CHECK.

The macro IP6_EXTHDR_CHECK can free the mbuf if the packet is sent to loopback interface. This fact is not considered in dest6_input(), frag6_input() and more. For example in dest6_input(), the double pointer is not updated:

int
dest6_input(struct mbuf **mp, int *offp, int proto)
{
	struct mbuf *m = *mp;
	...
	IP6_EXTHDR_CHECK(m, off, sizeof(*dstopts), return IPPROTO_DONE);
	...
	*offp = off;
	return dstopts->ip6d_nxt;
}

Hence, when parsing next headers, the mbuf can be free'd once again, leading to a double free which behaves like a use-after-free when we allocate mbuf's again.

Normally, this path would not be triggerable, because sending to loopback interface requires SOCK_RAW root privileges. However, for some reason on the PS4 SOCK_RAW sockets can be opened in Webkit process!

Attached is poc.c which must run with root privileges on a FreeBSD 9 machine. It demonstrates being able to escalate privileges to kernel. Attached is also ps4.c which is slightly adjusted to work on the PS4 (you'd need to add includes etc to be able to compile it with your official sdk, I compiled it with a custom framework).

The reliability of poc.c is very high, around 80%, whereasps4.c is not very high, I guess around 20%.

Impact

  • In conjunction with a WebKit exploit, a fully chained remote attack can be achieved.
  • It is possible to steal/manipulate user data.
  • Dump and run pirated games.

The original report as published on HackerOne, by theflow0. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The IP6_EXTHDR_CHECK macro may free the mbuf when packets are sent to loopback, but functions like dest6_input() do not update the pointer, leading to a double free.

Impact

In conjunction with a WebKit exploit, a fully chained remote attack can be achieved, allowing theft or manipulation of user data and running pirated games.

What the attacker needed

SOCK_RAW sockets accessible from WebKit process; Ability to send packets to loopback interface

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

This report describes a bug in how the operating system handles certain network packets. When a packet is sent to the computer itself (loopback), a memory cleanup step can happen twice, corrupting memory. On the PlayStation 4, a web browser process can send such packets, letting an attacker take control of the system.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Andy Nguyen

View all

7 more disclosed reports, best first.

More from PlayStation

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.