chonked pt.2: exploiting cve-2023-33476 for remote code execution
A heap overflow in ReadyMedia MiniDLNA's handling of HTTP chunked encoding allowed an attacker to write out of bounds with controlled data. The author developed a full exploit using heap grooming and tcache poisoning to achieve remote code execution.
This is the second part of the two-part series covering a heap overflow I found in ReadyMedia MiniDLNA (CVE-2023-33476). This post will focus on the exploit development side of things, going over the various challenges that had to be overcome and how everything was put together to achieve remote code execution and pop…
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 chunk size parsed from the request is used as the length in a memmove call without any bounds check, allowing an out-of-bounds write.
Impact
An attacker could achieve remote code execution and pop a shell on the vulnerable server.
What the attacker needed
Network access to the MiniDLNA service; ability to send crafted HTTP requests
How it was found
- Open several connections to allocate upnphttp structures.
- Send partial request data on some connections to allocate request buffers sequentially.
- Send a placeholder request to reserve a heap chunk for the corruption buffer.
- Free the placeholder by closing its connection.
- Send the corruption request with a crafted chunk size and whitespace to control the shift distance.
- Send a request containing payload data to be written to the target.
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 server software had a bug in how it read incoming web requests that were split into pieces. It trusted a size number in the request and copied too much data into a small memory area, letting an attacker overwrite nearby memory. The author then carefully arranged memory to turn this into running their own code on the server.
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.