Wu Ftpd — 1 vulnerability check
noctis ships 1 vulnerability check for Wu Ftpd, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
FTPD glob '~{' heap corruption
| CVE | CVE-2001-0550, CVE-2001-0249 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | ftp |
| Detection | script, tcp_open, tcp_send, tcp_close, sleep, match, tcp_dialogue · highest QoD 75 |
| Feed | tests/vulnerabilities/wu-ftpd/ftpd-glob-heap-corruption.yaml |
wu-ftpd 2.6.1 and earlier, Solaris ftpd and the BSD / AIX / Darwin ftpd sharing the same glob() code mishandle an unterminated '~{' brace and free memory that may hold user data. Any user able to log in, including anonymous users, can corrupt the heap with a CWD/LIST argument and execute code as the ftpd user (typically root).
The feed logs in (scan credentials, else anonymous) and sends `CWD ~{` and `CWD ~*{`. A finding is raised when the server answers with the AIX / Darwin buggy-glob replies, or when the session dies on the probe (no reply, later writes fail with broken pipe) while the daemon still greets new connections. Without a login it falls back to the wu-ftpd <= 2.6.1 / BeroFTPD banner (QoD 70). Intrusive: it can kill the forked session process.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends
USER {{cred_username}}on the open socket - Sends
PASS {{cred_password}}on the open socket - Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends
USER anonymouson the open socket - Sends
PASS noctis@example.comon the open socket - Parses / computes the next value with a Rhai script
- Sends
PWDon the open socket - Sends
CWD ~{on the open socket - Sends
CWD ~*{on the open socket - Sends
NOOPon the open socket - Sends
NOOPon the open socket - … and 5 more steps — see the feed source below
References:
- https://nvd.nist.gov/vuln/detail/CVE-2001-0550
- https://nvd.nist.gov/vuln/detail/CVE-2001-0249
- https://www.kb.cert.org/vuls/id/886083
Feed source — tests/vulnerabilities/wu-ftpd/ftpd-glob-heap-corruption.yaml
# FTPD glob heap corruption — CVE-2001-0550 (wu-ftpd <= 2.6.1) and CVE-2001-0249
# (Solaris ftpd), the shared glob() flaw also present in BSD / AIX / Darwin ftpd.
#
# The ftpd glob code does not report an error on an unterminated '~{' brace, then
# frees memory that may hold user data. Any user who can log in — anonymous
# included — reaches it with a single `CWD ~{`, and a working exploit gives code
# execution as the ftpd user (usually root).
#
# Port of OpenVAS `pre2008/ftpglob.nasl` (OID 1.3.6.1.4.1.25623.1.0.10821,
# GPL-2.0-only), with fail-closed tightening:
#
# 1. Log in on one persistent socket — scan credentials when given, and
# anonymous (the NASL's default KB login) when there are none or they are
# refused — then send PWD, `CWD ~{`, `CWD ~*{`, wait 5 s, send NOOP.
# 2. Buggy-glob reply (QoD 75): the brace is mis-parsed into the AIX / Darwin
# glob replies "550 Unknown user name after ~" / "550 ~: No such file or
# directory".
# 3. Session crash (QoD 75): PWD was answered, a `CWD ~{`/`~*{` got no reply,
# the NOOP sent 5 s later on the SAME socket gets nothing either, AND a
# later write on that socket fails (broken pipe: the peer process is gone
# — a slow server, however slow, keeps accepting writes), AND a fresh
# connection still gets a 220 greeting — the per-session ftpd process died, the service did not.
# Skipped when the banner names an ftpd without this glob code (vsftpd,
# ProFTPD, Pure-FTPd, Microsoft FTP, FileZilla, Serv-U): an inline IPS
# dropping '~{' sessions (classic Snort rules 1377/1378) looks the same.
# The NASL counts any missing reply as "exploitable", even a slow one.
# 4. Banner fallback (QoD 70, CVE-2001-0550 only) when no login was possible:
# wu-ftpd <= 2.6.1 / BeroFTPD, minus the Red Hat wu-2.6.1-2x and HP-UX
# PHNE fixed builds the NASL also excludes.
#
# Deliberately dropped from the NASL (both flag patched servers):
# - its "250 CWD command successful" FreeBSD/OpenBSD test: current ProFTPD
# (1.3.8b, checked live) expands `CWD ~{` to the home directory and answers
# exactly that;
# - its "':' in the reply" NetBSD test: every normal glob error carries a colon
# ("550 ~*{: No such file or directory" on ProFTPD).
#
# Intrusive: on a vulnerable server `CWD ~{` corrupts the heap of (and usually
# kills) the forked session process — never the listening daemon, and nothing is
# written. Tagged `category: rce` + `intrusive` so it can be excluded.
uid: 8441dc83-c9b3-40c2-891a-18df417e9e85
name: "FTPD glob '~{' heap corruption (CVE-2001-0550, CVE-2001-0249)"
description: |
wu-ftpd 2.6.1 and earlier, Solaris ftpd and the BSD / AIX / Darwin ftpd sharing
the same glob() code mishandle an unterminated '~{' brace and free memory that
may hold user data. Any user able to log in, including anonymous users, can
corrupt the heap with a CWD/LIST argument and execute code as the ftpd user
(typically root).
The feed logs in (scan credentials, else anonymous) and sends `CWD ~{` and
`CWD ~*{`. A finding is raised when the server answers with the AIX / Darwin
buggy-glob replies, or when the session dies on the probe (no reply, later
writes fail with broken pipe) while the daemon still greets new connections.
Without a login it falls back to the wu-ftpd <= 2.6.1 / BeroFTPD banner
(QoD 70). Intrusive: it can kill the forked session process.
cves: [CVE-2001-0550, CVE-2001-0249]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.10
tags: [ftp, wu-ftpd, solaris, glob, heap-corruption, memory-corruption, rce, intrusive]
services: [ftp]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2001-0550"
- "https://nvd.nist.gov/vuln/detail/CVE-2001-0249"
- "https://www.kb.cert.org/vuls/id/886083"
steps:
# ── 1. Which login: scan credentials (user + password) or anonymous ──────
- id: pick-login
action: script
code: |
cred_enabled && is_def_var("cred_username") && is_def_var("cred_password")
store_as: use_cred
- id: open
action: tcp_open
handle: ftp
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: ftpo
- id: cred-user
action: tcp_send
condition: "use_cred == true"
handle: ftp
send: "USER {{cred_username}}\r\n"
store_as: cuser
- id: cred-pass
action: tcp_send
condition: "use_cred == true"
handle: ftp
send: "PASS {{cred_password}}\r\n"
store_as: cpass
- id: login-state
action: script
code: |
use_cred && is_def_var("cpass") && type_of(cpass.response) == "string"
&& ereg("(^|\n)230[ -]", cpass.response)
store_as: cred_ok
# Credentials absent or refused (they are request-wide and often meant for
# another service): fall back to anonymous on a fresh connection.
- id: reopen
action: tcp_close
condition: "cred_ok == false && use_cred == true"
handle: ftp
- id: reopen-anon
action: tcp_open
condition: "cred_ok == false && use_cred == true"
handle: ftp
port: "{{port}}"
read_banner: true
timeout_secs: 10
store_as: ftpo2
- id: anon-user
action: tcp_send
condition: "cred_ok == false"
handle: ftp
send: "USER anonymous\r\n"
store_as: auser
- id: anon-pass
action: tcp_send
condition: "cred_ok == false"
handle: ftp
send: "PASS noctis@example.com\r\n"
store_as: apass
- id: logged-in
action: script
code: |
cred_ok || (is_def_var("apass") && type_of(apass.response) == "string"
&& ereg("(^|\n)230[ -]", apass.response))
store_as: logged_in
# ── 2. Glob probe on the logged-in session ───────────────────────────────
- id: pwd
action: tcp_send
condition: "logged_in == true"
handle: ftp
send: "PWD\r\n"
store_as: pwd
- id: cwd-brace
action: tcp_send
condition: "logged_in == true"
handle: ftp
send: "CWD ~{\r\n"
store_as: cwd1
- id: cwd-star-brace
action: tcp_send
condition: "logged_in == true"
handle: ftp
send: "CWD ~*{\r\n"
store_as: cwd2
# A slow server's late replies arrive in the socket buffer meanwhile.
- id: settle
action: sleep
condition: "logged_in == true"
duration_ms: 5000
- id: noop
action: tcp_send
condition: "logged_in == true"
handle: ftp
send: "NOOP\r\n"
store_as: noop
# Dead-socket proof: once the peer process is gone, the first write after its
# FIN draws a reset and the next write fails (sent == false, broken pipe). A
# merely slow server keeps accepting writes, however long its reply takes.
- id: settle-2
action: sleep
condition: "logged_in == true"
duration_ms: 1000
- id: noop-2
action: tcp_send
condition: "logged_in == true"
handle: ftp
send: "NOOP\r\n"
store_as: noop2
- id: close
action: tcp_close
handle: ftp
# ── 3. Classify ──────────────────────────────────────────────────────────
- id: analyze
action: script
code: |
let banner = "";
if is_def_var("ftpo2") && type_of(ftpo2.banner) == "string" { banner = ftpo2.banner; }
else if is_def_var("ftpo") && type_of(ftpo.banner) == "string" { banner = ftpo.banner; }
let pwd_r = "";
if is_def_var("pwd") && type_of(pwd.response) == "string" { pwd_r = pwd.response; }
let b = "";
if is_def_var("cwd1") && type_of(cwd1.response) == "string" { b = cwd1.response; }
let e = "";
if is_def_var("cwd2") && type_of(cwd2.response) == "string" { e = cwd2.response; }
let noop_r = "";
if is_def_var("noop") && type_of(noop.response) == "string" { noop_r = noop.response; }
let session_closed = (is_def_var("noop") && noop.sent == false)
|| (is_def_var("noop2") && noop2.sent == false);
let pwd_ok = ereg("(^|\n)257[ -]", pwd_r);
let marker = "550 Unknown user name after ~|550 ~: No such file or directory";
let buggy = logged_in && (ereg(marker, b) || ereg(marker, e));
let unaffected = ereg("(?i)vsftpd|proftpd|pure-ftpd|microsoft ftp|filezilla|serv-u", banner);
let crashed = logged_in && pwd_ok && !buggy && !unaffected
&& (b == "" || e == "") && noop_r == "" && session_closed;
let wu_old = ereg("wu-([01]\\.|2\\.[0-5]\\.|2\\.6\\.[01]([^0-9]|$))", banner)
&& !ereg("wu-2\\.6\\.1-[2-9][0-9]", banner);
let hpux_fixed = ereg("PHNE_(27765|29461|30432|31931|30990)", banner);
let banner_vuln = !logged_in && !hpux_fixed && (wu_old || ereg("BeroFTPD", banner));
#{
logged_in: logged_in,
buggy: buggy,
crashed: crashed,
banner_vuln: banner_vuln,
banner: banner,
cwd1: if b == "" { "<no reply>" } else { b },
cwd2: if e == "" { "<no reply>" } else { e }
}
store_as: glob
# ── 3a. Buggy glob reply ─────────────────────────────────────────────────
- id: detect-buggy-glob
action: match
condition: "glob.buggy == true"
source: glob.cwd1
pattern: ".*"
on_match:
finding:
title: "FTPD glob heap corruption — '~{' accepted by the glob code"
description: "After login, the server answered 'CWD ~{' / 'CWD ~*{' with the reply of the buggy AIX / Darwin glob() implementation (the brace is parsed as a user name / a bare '~') instead of a brace error, so the glob heap corruption (free of user-controlled memory) is reachable by any user able to log in."
remediation: "Upgrade wu-ftpd to 2.6.2 or later, or apply the vendor ftpd patch (Solaris, AIX, BSD, Mac OS X); disable anonymous FTP until then."
confidence_delta: 0.80
qod: 75
evidence: "{{glob.banner}} | CWD ~{ -> {{glob.cwd1}} | CWD ~*{ -> {{glob.cwd2}}"
# ── 3b. Session crash — confirm the daemon itself is still up ────────────
- id: alive-check
action: tcp_dialogue
condition: "glob.crashed == true"
port: "{{port}}"
read_banner: true
timeout_secs: 10
commands:
- "QUIT"
store_as: alive
- id: detect-session-crash
action: match
condition: "glob.crashed == true && type_of(alive.banner) == \"string\""
source: alive.banner
pattern: "^220[ -]"
on_match:
finding:
title: "FTPD glob heap corruption — session process crashed on a '~{' glob"
description: "After a successful login and an answered PWD, the server dropped the session without replying to 'CWD ~{' / 'CWD ~*{', a NOOP sent 5 s later on the same socket got nothing either and the socket was closed by the peer (broken pipe), while a new connection is still greeted: the per-session ftpd process died in glob(), the exploitable heap corruption of wu-ftpd <= 2.6.1 / Solaris ftpd."
remediation: "Upgrade wu-ftpd to 2.6.2 or later, or apply the vendor ftpd patch (Solaris, AIX, BSD, Mac OS X); disable anonymous FTP until then."
confidence_delta: 0.80
qod: 75
evidence: "{{glob.banner}} | CWD ~{ -> {{glob.cwd1}} | CWD ~*{ -> {{glob.cwd2}} | NOOP (5 s later) -> <no reply> | reconnect -> {{alive.banner}}"
# ── 4. Banner fallback when no login was possible ────────────────────────
- id: detect-banner
action: match
condition: "glob.banner_vuln == true"
source: glob.banner
pattern: "wu-|BeroFTPD"
on_match:
finding:
title: "FTPD glob heap corruption — vulnerable wu-ftpd version in banner"
description: "The FTP banner announces wu-ftpd 2.6.1 or earlier (or BeroFTPD), affected by the glob '~{' heap corruption. No login was possible, so the flaw could not be triggered; this is a version fingerprint (backported vendor fixes are not visible in the banner)."
remediation: "Upgrade wu-ftpd to 2.6.2 or later (or the vendor's fixed package)."
confidence_delta: 0.70
qod: 70
cves: [CVE-2001-0550]
evidence: "Banner: {{glob.banner}}"