The target
The ALLO command handler in an IBM Sterling PeSIT FTP service copies a user-supplied digit string into a fixed 256-byte global buffer without a length check, and a length underflow lets an attacker trigger a huge memcpy into the .bss. Because the binary lacks ASLR and RELRO, the attacker can overwrite the Global Offset Table and redirect a later call to achieve command execution.
blog.lexfo.fr
Published on blog.lexfo.fr
A classical penetration test requires skills to assess a large variety of weaknesses, often dealing with common bug classes. Memory corruptions are rarely exploited during penetration tests.
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 ALLO handler computes the copy length from a signed length value that can underflow to a huge number, and then calls memcpy into a fixed 256-byte global buffer with no bounds check.
Impact
An unauthenticated attacker could overwrite memory and redirect execution to run commands, though the exploit relies on the binary lacking ASLR and RELRO and on the forked child crashing after the shell is obtained.
What the attacker needed
Network access to the FTP service; no authentication needed; binary built without ASLR or RELRO
The fix
The handler should bound the copy length against the size of the destination buffer and reject malformed ALLO arguments before copying.
How it was found
- Send a short command of fewer than five bytes followed by arbitrary data so the receive buffer holds attacker data.
- Send an ALLO command with a space and zero or one byte so the length calculation underflows and the copy length becomes huge.
- The oversized memcpy overwrites the .bss, including pointers used by the SIGSEGV handler, and the process faults.
- The signal handler runs and performs a second memcpy whose source and destination were overwritten, giving a controlled write.
- Overwrite Global Offset Table entries so a later call reaches TCP_SEND and then execl with controlled arguments.
- Spawn a shell or interpreter command to obtain command execution.
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 program keeps a small fixed-size box in memory for a number the client sends. The server copies whatever the client sends into that box without checking how long it is, so a long value spills over into neighbouring memory. The author then uses that spill to change which function the program calls next, ending in running a command of their choice.
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.