basic-ftp CRLF injection via incomplete validation

Severity: low · CVSS 3.1 · Published 2026-04-10

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.

Technologies: basic-ftp (npm). Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Low severity, with a CVSS score of 3.1, published 10 April 2026.
Which products and versions are affected?
basic-ftp (npm) SEMVER:introduced=0,fixed=5.2.2.
Is there a fix for This vulnerability?
Yes. basic-ftp (npm): upgrade to 5.2.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network.
Am I affected?
Check whether you run basic-ftp (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • basic-ftp (npm): upgrade to 5.2.2 or later
    npm install basic-ftp@5.2.2

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

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.