ProFTPD mod_auth — "authenticated" state persists when the internal PASS is aborted at PRE_CMD, yielding an unprivileged→root session (ban/wrap bypass + chroot escape + arbitrary read/write as root → RCE)
Status: FIXED by the ProFTPD project — commit 04f1ac85 (master, → 1.3.10) and 684bb161 (1.3.9 stable branch backport), 2026-11-07, crediting the reporter. Live-verified fixed 2026-11-08. No CVE assigned (see Timeline).
Reporter: Jelle Janssens (EverydaySparkling)
Component: modules/mod_auth.c (passwordless-auth / "authenticate without password" path), with contrib/mod_tls (AllowDotLogin/TLSUserName) as the enabling front-end and contrib/mod_ban or contrib/mod_wrap as the trigger.
Type: Authentication state confusion → access-control bypass, chroot escape, privilege escalation to root (CWE-287 / CWE-696 incorrect-behavior-order / CWE-269)
Severity: High, reaching Critical on common configurations.
- CVSS:4.0
AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H≈ 8.7 (High); ≈ 9.3 (Critical) on looser configs (see "Severity sensitivity"). (CVSS 4.0 scores derive from FIRST's macrovector table — please confirm in the official calculator.) - CVSS:3.1
AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H≈ 8.5.
Affected versions
- Live-verified on
1.3.10rc6(dev HEAD,a04f7d6c). - Source-confirmed vulnerable in every release tag from
1.3.5a(2015) through1.3.10rc5(git-verified 2026-11-08). In each, all three required ingredients are present: the stash-before-dispatch ordering inmodules/mod_auth.cauth_user(), themod_tlsAllowDotLogin/TLSUserNamepasswordless front-ends, andmod_ban'sban_pre_pass()PRE_CMD(PASS)aborter. Older versions (1.3.5a–1.3.9) are source-confirmed, not runtime-tested. - The passwordless-PASS mechanism (stash
"authenticated"→ dispatch synthetic PASS →return PR_HANDLEDwithout confirming the login completed) is already present in this repository's 2013 root-import commite1d6ca4a(a CVS→git boundary commit whose own message is unrelated), so the flaw predates the project's recorded git history; the true introducing commit cannot be pinned from this clone. (Correcting an earlier draft that attributed introduction toe1d6ca4a— that is the import boundary, not the origin.) - Issue #2319 (commits
21176e73,4ff74e00, 2026) introducedreset_authenticated_without_pass()to reset the passwordless-auth flag and remove the stashed record — but that reset first appears only in the 1.3.10rc series and does not cover the case where the internal PASS is aborted in aPRE_CMDhandler (this bug). Releases 1.3.5a through 1.3.9 have no such reset at all, so they are strictly less mitigated than the version that was live-tested. - Fixed: 1.3.10 (commit
04f1ac85, master) and the 1.3.9 stable branch (backport684bb161). Branches ≤ 1.3.8 are end-of-life and remain affected.
Summary
When a client is allowed to authenticate without a password — mod_tls AllowDotLogin or TLSUserName, i.e. client-certificate auth — mod_auth's USER handler (auth_user) stashes a server-config record "authenticated" = TRUE and then dispatches a synthetic PASS command to complete the login. The record is stashed before the dispatch and auth_user returns PR_HANDLED regardless of the dispatch outcome.
If a PRE_CMD(PASS) handler aborts that synthetic PASS by returning an error without disconnecting — which is exactly what mod_ban (banned user) and mod_wrap (host in hosts.deny) do (530, session continues) — the core command loop skips the CMD phase, so auth_pass/setup_env never run. That means:
- the privilege drop (
setuid/setgidto the user) never happens → the session keeps the daemon's root identity; - the chroot (
DefaultRoot/<Anonymous>) never happens → no jail; - yet the stashed
"authenticated"record is never reset, somod_auth's per-command gate (auth_cmd_chk_cb) treats the session as logged in and executes all subsequent commands.
Net effect: a client that the administrator has explicitly banned or denied instead obtains a session that runs as root, outside any chroot, and can read and write arbitrary files on the host — i.e. full host compromise. The containment control (ban / hosts.deny) becomes the privilege-escalation trigger.
Root cause (source, HEAD = 1.3.10rc6)
modules/mod_auth.c, auth_user() — the passwordless branch:
reset_authenticated_without_pass(cmd); /* :2534 (only reset here, at USER-top) */
...
} else if (pr_auth_requires_pass(cmd->tmp_pool, user) == FALSE) { /* mod_tls AllowDotLogin/TLSUserName */
cmd_rec *fakecmd = pr_cmd_alloc(cmd->pool, 2, NULL);
fakecmd->argv[0] = pstrdup(fakecmd->pool, C_PASS);
...
c = add_config_param_set(&cmd->server->conf, "authenticated", 1, NULL); /* :2561 stash BEFORE dispatch */
c->argv[0] = pcalloc(c->pool, sizeof(unsigned char));
*((unsigned char *) c->argv[0]) = TRUE;
authenticated_without_pass = TRUE; /* :2565 */
pr_cmd_dispatch(fakecmd); /* :2568 may abort at PRE_CMD */
}
...
return PR_HANDLED(cmd); /* returns success regardless of the dispatch result */
The per-command authorization gate, auth_cmd_chk_cb() (:76), opens as soon as the record is set, independent of session.user:
authd = get_param_ptr(cmd->server->conf, "authenticated", FALSE); /* :80 */
if (authd == NULL || *authd == FALSE) { /* 530 Please login */ return FALSE; }
... return TRUE; /* command allowed */
The command loop skips the CMD phase (and therefore auth_pass→setup_env privilege-drop + chroot) when a PRE_CMD handler returns an error, without disconnecting (src/main.c, the PRE_CMD→POST_CMD_ERR/LOG_CMD_ERR→return path). reset_authenticated_without_pass() is only invoked at the top of auth_user (:2534), in auth_pass (:2762, skipped), and on auth failure — none of which runs on a PRE_CMD abort of the synthetic PASS — so the record persists.
The two realistic PRE_CMD(PASS) aborters:
contrib/mod_ban.cban_pre_pass()(:2761, registeredPRE_CMD C_PASSat:4166) →530for a banned user/host, no disconnect.contrib/mod_wrap.cwrap_handle_request()(registeredPRE_CMD C_PASS) →530for a host inhosts.deny, no disconnect.
Preconditions and threat model
- Passwordless auth enabled:
mod_tlswithAllowDotLoginorTLSUserName. (Without it, normalUSER/PASSnever takes the synthetic-PASS branch and the bug is unreachable.) - A
PRE_CMD(PASS)denier that returns 530 without disconnecting:mod_ban(banned username/host) ormod_wrap(hosts.deny). - The attacker is denied/banned — the condition the admin set up to contain them.
The attacker's required foothold = a client certificate the server's client CA trusts:
- With
AllowDotLogin, the exact cert must be in the target account's~/.tlslogin(fully provisioned user).PR:L. - With
TLSUserName, there is no per-user registration: any cert that verifies againstTLSCACertificateFileand carries the mapped identity field (e.g.CN=<username>) is accepted. Verified in the lab: a CA-signedCN=ftptestcert that was never in any.tlsloginreached root; a second independent key from the same CA also worked (not cert-pinned); a cert from an untrusted CA was rejected at the TLS handshake (unknown ca). So the real boundary is "a cert signed by the trusted client CA", and how low the privilege bar goes depends on who can obtain such a cert (internal CA with controlled issuance → insider; loose/public CA, or a CA that signs requester-chosen CNs → approaches unauthenticated, and enables cross-tenant impersonation — notesession.useris NULL in the bypass, so the CN need not even correspond to the attacker's own account).
Typical target: a shared-hosting / multi-tenant FTPS server using client-certificate auth, where a tenant who is banned for abuse (mod_ban) or whose IP is in hosts.deny (mod_wrap) escalates to root instead of being locked out.
Reproduction (verified end-to-end)
Lab: ProFTPD 1.3.10rc6 built with mod_sftp mod_tls mod_ban, DefaultRoot ~ftptest, User root, TLSEngine on/TLSVerifyClient on, passwordless auth via AllowDotLogin (and separately TLSUserName CommonName), and BanOnEvent LoginRate 2/00:30:00 00:30:00 to ban the user.
AUTH TLSpresenting the client cert;USER ftptestwith noPASS→232 User ftptest logged in(confirms the passwordless path;mod_tlslogs.tlslogin check successful).- Repeated logins trip the
LoginRateban. In a banned session,USER ftptest→530 Login incorrect(the synthetic PASS was aborted byban_pre_pass), but:PWD→257 ""(empty cwd —setup_envnever ran; a real login returns257 "/"); the command gate is open.CWD /,CWD /etc,CWD /root→ all250(the~ftptestchroot was never applied → jail escaped).STAT /root→ full listing of mode-700/root;STAT /etc/shadow,SIZE /etc/shadow→ succeed (running as root).
- Over a
PROT Pdata channel:RETR /etc/shadow→226 Transfer complete(arbitrary file read as root);MKD /root/.ssh+STOR /root/.ssh/authorized_keys→226, verified on disk asroot:root(arbitrary file write as root). - End-to-end code execution:
STOR /etc/cron.d/<name>with a cron line → cron runs it as root → an interactive root reverse shell (uid=0(root)), caught on a localhost listener.
On AllowOverwrite off (default): direct STOR-overwrite, APPE, and RNTO-over-an-existing-file are denied on an existing file — but this is not a barrier: as root the attacker (a) DELEs then STORs, (b) RNFR/RNTOs the existing file aside (non-destructive, preserves the original) then STORs, or (c) simply STORs a new root-run file (/etc/cron.d/*, /etc/sudoers.d/*, a systemd unit, /etc/profile.d/*.sh) that needs no overwrite. Each was verified.
PoCs available: session transition, CWD chroot-escape probe, RETR/STOR as root, and the cron→reverse-shell capstone (all localhost).
POC: https://poc.singto.io/proftpd-pf2-poc.tar.gz
Impact
A banned/denied client-certificate user obtains a root, un-chrooted session on the host: read any file (/etc/shadow, keys, other tenants' data), write any file, and achieve root code execution (cron/authorized_keys). This is full host compromise, from a party the administrator explicitly tried to lock out.
Severity sensitivity
- Base (above): CVSS 4.0 ≈ 8.7 High —
AT:P(needs the AllowDotLogin/TLSUserName + ban/wrap deployment) andPR:L(needs a CA-trusted cert). - Looser config → ≈ 9.3 Critical: a public/loose client CA (
PR:N) and/or a self-inducible ban such asBanOnEvent LoginRate(AT:N). - The contestable metrics are
ATandPR; a reviewer who treats the ban as always-present and attacker-driven will pushAT:Nand raise the score.
Suggested fix
In auth_user() (modules/mod_auth.c), do not commit authentication state before the login is known to have succeeded:
- Stash the
"authenticated"record and setauthenticated_without_passonly afterpr_cmd_dispatch(fakecmd)returns and the session is actually logged in (e.g. gate on the same conditionauth_passuses to mark success); or - After the dispatch, if the session is not logged in (
session.user == NULL/ the login flag is still false), callreset_authenticated_without_pass(cmd)and remove the stashed"authenticated"record before returning.
Either way, a PRE_CMD-aborted synthetic PASS must leave the session unauthenticated. (This extends the Issue #2319 reset to the PRE_CMD-abort path.)
Timeline
- 2026-11-07 — identified, reproduced end-to-end to root RCE on 1.3.10rc6, draft prepared.
- 2026-11-07 — reported to the ProFTPD maintainer (TJ Saunders).
- 2026-11-07 — fixed: commit
04f1ac85bef8ee0cae4cdbe915c7278b451f11c8onmaster(for 1.3.10) and backport684bb161c8f5e9159e8ca51eaf2ae49f8dea4c21on the1.3.9stable branch. The fix commits authentication state only afterpr_cmd_dispatch()of the synthetic PASS returns success (== 1) andsession.user != NULL; otherwisereset_authenticated_without_pass()is called — i.e. the "suggested fix" above. The commit credits the reporter by name. - 2026-11-08 — fix live-verified: patched build denies the banned client-cert session end-to-end (
USER/PWD/STATall530; no root, no chroot escape).