GHSL-2020-002: out-of-bounds (OOB) read in ProFTPD
An out-of-bounds read occurs in ProFTPD's mod_cap when cap_to_text calls getstateflags with a capability number that indexes beyond the caps struct. An authenticated attacker could trigger a crash of the FTP server.
Originally disclosed on GitHub Security Lab
The captotext() function on captext.c performs a call to getstateflags(caps, n) [line 255].
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the bundled libcap's cap_to_text function calls getstateflags with a capability number (37) that exceeds the size of the inheritable capability set in the caps struct, causing an out-of-bounds read.
Impact
This issue may lead to a post-authentication out-of-bounds read, which can crash the FTP server.
What the attacker needed
Valid user credentials; ProFTPD built with ASAN (for crash)
The fix
The vulnerability was fixed by updating the bundled libcap and relying on the system libcap.
How it was found
- Prepare a ProFTPD ASAN build.
- Run ProFTPD as root with the basic configuration and debug options.
- Log in to the server with a valid user.
- The FTP server crashes with an ASAN trace.
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.
An out-of-bounds read means a program looks at memory outside the area it was supposed to use. Here, a function in ProFTPD's capability module reads past the end of a data structure, which can make the server crash. An attacker who can log in to the FTP server could cause this crash.
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.