Executive brief
basic-ftp is a Node.js library for FTP file transfer operations. The library's CRLF injection protection is incomplete, allowing attackers who control FTP credentials or directory paths to inject arbitrary FTP commands. This could enable file deletion, manipulation, permission changes, or session hijacking on the target FTP server.
Technical details
basic-ftp contains two CRLF injection vulnerabilities bypassing the protectWhitespace() control character check. Vector 1: the login() method directly concatenates user-supplied credentials into USER/PASS FTP commands without validation, allowing injection of arbitrary commands before authentication completes. Vector 2: the _openDir() method sends an MKD command before cd() applies protectWhitespace(), creating a TOCTOU race condition where injected commands in directory names execute before validation occurs. An attacker controlling credentials or remote paths can inject DELE, RNFR/RNTO, SITE CHMOD, or USER/PASS commands. Patches are available in version 5.2.2.
Affected products
- Patrick Juchli basic-ftp ≤ 5.2.1
Timeline
- 2026-04-10: disclosed
- 2026-04-10: patched: Version 5.2.2 released