# basic-ftp CRLF injection via incomplete validation

Source: https://junglewise.ai/threats/basic-ftp-crlf-injection-via-incomplete-validation-c2967386  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-10. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/basic-ftp). Vendors: [npm](https://junglewise.ai/threats/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

  ```sh
  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

- [https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-6v7q-wjvx-w8wg](https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-6v7q-wjvx-w8wg)
- [https://github.com/patrickjuchli/basic-ftp/commit/20327d35126e57e5fdbaae79a4b65222fbadc53c](https://github.com/patrickjuchli/basic-ftp/commit/20327d35126e57e5fdbaae79a4b65222fbadc53c)

## Related threats

- [basic-ftp unhandled exception in control socket event handler](https://junglewise.ai/threats/cve-2026-126346-basic-ftp-uncaught-exception-crashes-the-node-js-process-when-a)
- [basic-ftp MLSD parser prototype pollution](https://junglewise.ai/threats/cve-2026-126345-basic-ftp-uncaught-typeerror-in-mlsd-directory-listing-parser)
- [basic-ftp quadratic-time denial of service in Client.list()](https://junglewise.ai/threats/cve-2026-102990-basic-ftp-is-an-ftp-client-for-node-js-prior-to-6-2-1-client)
- [basic-ftp denial of service via unbounded multiline response buffering](https://junglewise.ai/threats/cve-2026-44240-basic-ftp-denial-of-service-via-unbounded-multiline-control)
- [basic-ftp vulnerable to denial of service via unbounded memory consumption in Client.list()](https://junglewise.ai/threats/cve-2026-41324-basic-ftp-vulnerable-to-denial-of-service-via-unbounded-memory)
