Skip to content
Memory corruption Advisory Intermediate

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.

antonio-morales Follow

Originally disclosed on GitHub Security Lab

An out-of-bounds (OOB) read vulnerability has been detected in the purestrcmp function.

antonio-morales, on GitHub Security Lab

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

  1. Compile PureFTPD with AddressSanitizer (ASAN) and comment out setrlimit(RLIMIT_DATA).
  2. Create a new user 'fuzzing' with password 'fuzzing'.
  3. Run PureFTPd server as root, enabling an affected login module (e.g., pgsql or unix).
  4. Connect to the FTP server and log in with the created user.
  5. 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.

More by antonio-morales

View all

45 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.