Exploiting PSoC4 for fun and profit
The article describes how the author reverse-engineered the PSoC4 microcontroller's supervisor ROM (SROM) and found a way to read its protected contents and unlock extra flash. An attacker with physical access could use these techniques to dump the SROM, develop rootkits for touchpads, or steal IP.
dmitry.gr
Published on dmitry.gr
This article explains how I figured out how Cypress's jury-rigged "supervisor" mode in the PSoC4 family works, dumped the secret unreadable SROM, exploited it, and found a way to unlock extra flash in the PSoC4 as well as how you can develop scary rootkits for touchpads and touchscreens that use Cypress chips. I…
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
Likely the SROM's privilege mechanism can be bypassed by using return-oriented programming (ROP) gadgets within the SROM itself to set the PRIVILEGED bit, read data, and then clear it before returning to user code.
Impact
An attacker with physical access could read the protected SROM, potentially enabling IP theft, rootkit development, and unlocking extra flash memory.
What the attacker needed
Physical access to the device; a debugger (SWD); knowledge of ARM Cortex-M0
The fix
The author tried to disclose the vulnerability but had no luck; the text does not state a fix.
How it was found
- Find the SROM's address by monitoring the program counter (PCSR) during a syscall.
- Attempt to read the SROM directly with the debugger, which fails.
- Use a lockup condition to halt the CPU with ROM_ACCESS_EN set, then dump the first 512 bytes.
- Analyze the 512-byte dump to find ROP gadgets.
- Construct a ROP chain to set the PRIVILEGED bit, read a word from SROM, clear the bit, and return to RAM.
- Use the ROP chain to dump the entire SROM.
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.
The PSoC4 is a small computer chip. It has a secret internal memory area that the manufacturer says cannot be read. The author found a clever way to read it anyway by making the chip run tiny pieces of its own code in a special order. This could let someone copy protected code or hide malicious software on the chip.
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.