Analysis of CVE-2021-35211 (Part 2)
The Serv-U FTP server had a vulnerability where an uninitialised heap buffer could be used to call a function pointer, allowing remote code execution. The author developed an exploit that achieved code execution on Windows 10, though it was very unstable.
yichenchai.github.io
Published on yichenchai.github.io
In my last post, I provided an analysis of the vulnerability in Solarwinds Serv-U, CVE-2021-35211. Picking up from where I left off, this post will discuss my approach to achieving (a super unstable) RCE in Serv-U on Windows 10.
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 an uninitialised heap buffer in the OpenSSL AES key structure leads to a function pointer being called with attacker-influenced data.
Impact
An attacker could achieve remote code execution on the Serv-U server, though the exploit is extremely unstable and may crash the service.
What the attacker needed
Network access to Serv-U; Serv-U running on Windows 10; no ASLR on Serv-U DLL
How it was found
- Send packets in an invalid order to trigger the vulnerability.
- Allocate and free heap blocks of size 0x108 using SSH2_MSG_DEBUG packets to control the function pointer.
- Set the function pointer to a gadget that leaks a heap pointer via the AES CTR encryption output.
- Use the heap leak to build a JOP chain that pivots the stack to a controlled heap buffer.
- Use a ROP chain to call VirtualProtect and make shellcode executable.
- Send an egg hunter shellcode in a large SSH2_MSG_DEBUG packet to execute the final payload.
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.
This report describes a bug in an FTP server program called Serv-U. By sending specially crafted network messages in the wrong order, an attacker could make the program use a piece of memory that hadn't been properly set up, and eventually run their own code on the server. The author built a working but unreliable exploit.
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.