[Switch] Remote stack buffer overflow in the LDN/LP2P DHCP server leads to control-flow hijack
The ldn system module's DHCP server copies an attacker-controlled total length into a fixed stack buffer without checking it, so a single oversized DHCP frame from a nearby Wi-Fi peer overflows the stack and overwrites the saved return address and callee-saved registers. This lets an attacker within wireless range redirect execution to a chosen address and build a ROP chain to run arbitrary code.
- Triaged in 12 days
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 5 months
Summary by the program
Description
A stack-based buffer overflow vulnerability in the Nintendo Switch local wireless networking functionality may allow an attacker within wireless range to execute arbitrary code using return-oriented programming (ROP) through crafted network traffic.
Summary by the researcher
The ldn system module runs a DHCP server while the console hosts a local-wireless lp2p/LDN session (for example, photo sharing or local session in Mario Kart Live: Home Circuit). On receiving a frame, it reassembles received data into a fixed stack buffer with memmove(dst, src, total_size) and never checks total_size against the buffer size. src is the global BPF capture buffer holding the frame exactly as it arrived; total_size is the sum of the parsed layer lengths, and the DHCP-layer length is attacker-controlled - so a single oversized DHCP frame from a Wi-Fi peer overflows the stack, overwriting the saved return address and callee-saved registers. On Switch, the function returns to an attacker-chosen address. Overwriting only the low 2 bytes of the saved LR redirects PC within a 64 KB window of the module's own code without knowing the ASLR base.
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 DHCP reassembly code passes an attacker-controlled total length to memmove without validating it against the destination stack buffer's size.
Impact
An attacker within wireless range could overwrite the saved return address and callee-saved registers and redirect execution, potentially achieving arbitrary code execution via ROP; the text does not state that this was demonstrated end to end.
What the attacker needed
Attacker within wireless range; console hosting an lp2p/LDN session
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.
When a console hosts a local wireless session, a small program inside it acts as a DHCP server, the service that hands out network addresses. It takes the size of an incoming message from the sender and copies that many bytes into a fixed-size area of memory without checking the size first, so a large message spills over into neighbouring memory. That spilled data can overwrite the address the program will jump back to when it finishes, letting the sender choose where the console goes next.
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.