Executive brief
basic-ftp is a software library used by Node.js applications to transfer files via the FTP protocol. A vulnerability in this library allows an attacker to inject unauthorized commands into an FTP session if the application uses untrusted user input for file paths. This could lead to unauthorized file deletion, data theft, or the creation of malicious directories on the connected FTP server.
Technical details
A CRLF injection vulnerability exists in basic-ftp prior to version 5.2.1. The library's protectWhitespace() helper fails to sanitize carriage return (\r) and line feed (\n) characters in path parameters, while the FtpContext.send() method appends its own CRLF and writes directly to the control socket. An attacker providing a crafted path string can split a single intended FTP command into multiple commands. This allows for the execution of arbitrary FTP commands such as DELE, RETR, or MKD. The vulnerability affects high-level APIs including cd(), remove(), rename(), uploadFrom(), downloadTo(), list(), and removeDir(). The issue is fixed in version 5.2.1 by rejecting paths containing control characters.
Affected products
- patrickjuchli basic-ftp < 5.2.1
- Red Hat Red Hat Developer Hub 1.8 affected
- Red Hat Red Hat Developer Hub 1.9 affected
- Red Hat Red Hat OpenShift Container Platform 4 affected
- Red Hat Self-service automation portal 2 affected
Timeline
- 2026-04-08: patched: Version 5.2.1 released to address the vulnerability.
- 2026-04-09: disclosed: Vulnerability disclosed via GitHub Security Advisory.
- 2026-04-09: advisory: NVD published CVE-2026-39983.
References
- https://github.com/patrickjuchli/basic-ftp/commit/2ecc8e2c500c5234115f06fd1dbde1aa03d70f4b
- https://github.com/patrickjuchli/basic-ftp/releases/tag/v5.2.1
- https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-chqc-8p9q-pq6q
- https://access.redhat.com/errata/RHSA-2026:13826
- https://access.redhat.com/errata/RHSA-2026:9742
- https://access.redhat.com/security/cve/CVE-2026-39983
- https://bugzilla.redhat.com/show_bug.cgi?id=2456971