Buffer Overflow Windows Seh
A parameter in the body of a POST request to the EFS Easy Chat Server 3.1 application is copied into a stack buffer without sufficient bounds checking, allowing an attacker to overwrite the SEH chain. By controlling the next SEH record and the handler address, an attacker can redirect execution to their own shellcode and run arbitrary code on the server.
Published on systemweakness.com
In this article will be discussed the buffer overflow vulnerability in Windows based on SEH. To best understand the article you need to know the process of exploitation in a simple buffer overflow on Windows.
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 application copies the UserName parameter into a fixed-size stack buffer without checking its length, so a long value overwrites the saved SEH chain.
Impact
An attacker who can reach the registration endpoint could run arbitrary code on the server, as demonstrated by the exploit launching the calculator.
What the attacker needed
Network access to the web server; vulnerable EFS Easy Chat Server 3.1
How it was found
- Send a POST request to the registration endpoint with a long UserName value to crash the application.
- Inspect the crash in Immunity Debugger and view the SEH chain to confirm the overwrite.
- Use mona to create a cyclic pattern, find the EIP value at the crash, and calculate the offset.
- Replace the overwritten bytes with a short jump in the next SEH record and a POP POP RET address in the SEH handler.
- Set a breakpoint to confirm execution reaches the next SEH record, then place shellcode after the SEH structure.
- Send the final request containing the shellcode to execute arbitrary code.
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 buffer overflow happens when a program copies more data into a fixed-size memory area than it can hold, so the extra data spills over into nearby memory. On Windows, the exception handling records (SEH) sit on the stack and can be overwritten too; if an attacker controls them, they can make the program jump to code they supplied. Here the attacker sends a long username in a web request and gets the server to run their own program.
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.