GHSL-2020-025: OOB read and DoS in PureFTPd
The last item in the diraliases linked list is not terminated with a NULL pointer, so functions that traverse the list read past its end. An authenticated attacker can send a SITE alias command to trigger an out-of-bounds read and crash the server.
Originally disclosed on GitHub Security Lab
An uninitialized pointer vulnerability has been detected in PureFTPd which results in out-of-bounds (OOB) reads. It could also allow an attacker to trigger a Denial of Service against PureFTPD.
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 init_aliases function fails to set the next pointer of the last linked-list item to NULL, so list traversal does not stop at the end.
Impact
This issue may lead to an out-of-bounds read and a denial of service that requires authentication.
What the attacker needed
Valid user credentials; diraliases feature enabled; server running with alias configuration
The fix
The fix was to set the next pointer of the last list item to NULL.
How it was found
- Compile PureFTPD with AddressSanitizer and comment out setrlimit(RLIMIT_DATA).
- Copy the provided alias configuration file into the configuration directory.
- Run PureFTPD as root with the -S parameter.
- Connect to the FTP server and log in with a valid user and password.
- Send the SITE alias command.
- PureFTPD should crash.
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.
A linked list is a chain of items where each item points to the next. The last item should point to nothing (NULL) to mark the end. Here the last item was left pointing to an undefined place, so when the program walks the list it keeps going into memory it should not read, which can crash the server.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.