GHSL-2020-032: out-of-bounds (OOB) read vulnerability in PureFTPd
The pure_strcmp function in PureFTPd performs an out-of-bounds read when comparing strings of different lengths, reading beyond the shorter string's buffer. An attacker could potentially leak sensitive information from process memory or crash the server.
Originally disclosed on GitHub Security Lab
An out-of-bounds (OOB) read vulnerability has been detected in the purestrcmp function.
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
The loop in pure_strcmp iterates based on the length of the longer string without checking the length of the shorter string, leading to reads beyond the shorter string's buffer.
What the attacker needed
PureFTPd server with affected login module; Valid user credentials
The fix
The issue was fixed by ensuring that the comparison length does not exceed the length of the shorter string.
How it was found
- Compile PureFTPD with AddressSanitizer (ASAN) and comment out setrlimit(RLIMIT_DATA).
- Create a new user 'fuzzing' with password 'fuzzing'.
- Run PureFTPd server as root, enabling an affected login module (e.g., pgsql or unix).
- Connect to the FTP server and log in with the created user.
- Observe the crash and 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 happens when a program reads memory beyond the intended boundary of a buffer. In this case, a string comparison function reads past the end of the shorter string, which could expose data from other parts of memory or cause a 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.