Skip to content
Memory corruption Write-up Advanced

mast1c0re: Hacking the PS4 / PS5 through the PS2 Emulator - Part 1 - Escape

The PS2 emulator on the PS4/PS5 lacked bounds checks when writing to CDVD status registers, so repeated writes overflowed fixed-size status buffers. An attacker with PS2 code execution could chain this into arbitrary native read/write and control-flow redirection, eventually achieving ROP and escaping the emulator.

CTurt Follow

Published on cturt.github.io

Contact About Articles Home

CTurt (@CTurtE), on cturt.github.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

The emulator wrote bytes into fixed-size status buffers indexed by a counter that was never bounds-checked, allowing consecutive register writes to overflow into adjacent variables.

Impact

An attacker with PS2 code execution could gain arbitrary native code execution in the emulator process, potentially running homebrew or pirated games, though the author notes the chain is described as unpatchable only with caveats.

What the attacker needed

PS2 code execution via an exploitable game; A crafted save file or controller input; USB save import signed in to PSN

How it was found

  1. Gain code execution inside a PS2 game running in the emulator, for example through a save game exploit.
  2. Write repeatedly to the CDVD S Status register to overflow the S status buffer and corrupt the N status index.
  3. Write to the CDVD N Status register to perform an arbitrary byte write at a chosen index.
  4. Overwrite an IO read handler function pointer and read from that register to call an arbitrary address and get the result.
  5. Use a partial pointer overwrite to leak the eboot base address and defeat ASLR.
  6. Redirect a write handler and use a stack pivot gadget chain to run a ROP chain.

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 write-up has not been written yet. The Original tab links to the source.

A console runs old PlayStation 2 games inside a program called an emulator, which pretends to be a PS2. That emulator kept incoming data in small fixed-size boxes without checking how much was being put in, so extra data spilled into nearby memory. Someone who could already run their own code inside a PS2 game could use that spill to take control of the emulator itself.

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 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.