basic-ftp
Ecosystem: npm
Downloads:
- 1CriticalAffects 1 version
- 5HighAffects 5 versions
- 0MediumAffects 0 versions
- 2ModerateAffects 2 versions
- 0LowAffects 0 versions
- Critical1 (12.5%)
- High5 (62.5%)
- Medium0 (0.0%)
- Moderate2 (25.0%)
- Low0 (0.0%)
Monthly breakdown
- Critical
- High
- Medium
- Moderate
- Low
- 2 vulnerabilities
- Critical: 0
- High: 0
- Medium: 0
- Moderate: 2
- Low: 0
- 1 vulnerabilities
- Critical: 0
- High: 1
- Medium: 0
- Moderate: 0
- Low: 0
- 1 vulnerabilities
- Critical: 0
- High: 1
- Medium: 0
- Moderate: 0
- Low: 0
- 3 vulnerabilities
- Critical: 0
- High: 3
- Medium: 0
- Moderate: 0
- Low: 0
- 1 vulnerabilities
- Critical: 1
- High: 0
- Medium: 0
- Moderate: 0
- Low: 0
Vulnerabilities (8)
Known vulnerabilities affecting basic-ftp, based on data from OSV.
| ID | Severity | Summary | Affected versions | Published | Source |
|---|---|---|---|---|---|
| GHSA-5pm8-86m8-9m6r | Moderate | basic-ftp: Uncaught TypeError in MLSD directory-listing parser via __proto__ fact name causes DoS in Client.list()### Summary basic-ftp's MLSD directory-listing parser (src/parseListMLSD.ts) looks up fact-handler functions in a plain object literal keyed directly by fact names taken from the FTP server's response, with no validation. A directory-listing line containing the fact name "__proto__" resolves this lookup to Object.prototype (inherited, non-own, non-function) instead of undefined, so the "not a function" guard is bypassed and the code throws `TypeError: factHandler is not a function`. This TypeError is not an FTPError, so it is not caught by Client.list()'s retry logic and propagates as a reje |
| GitHub (opens in a new tab) | |
| GHSA-r4jh-29pc-gfqr | Moderate | basic-ftp: Uncaught exception crashes the Node.js process when a password (or resumed-download path) contains CR/LF### Summary Client.login() calls FTPContext.send() from inside the control-socket data event handler. send() throws on CR, LF or NUL, and nothing catches the throw. A password containing \r\n therefore raises an uncaught exception and terminates the whole Node.js process. It does not reject the returned promise. Any application that passes untrusted input as the FTP password can be crashed remotely with one request. The same pattern exists in the REST/RETR path of downloadTo() when the remote path contains control characters. ### Details The CRLF guard (FTPContext.send, src/FtpContext.ts ~L |
| GitHub (opens in a new tab) | |
| GHSA-c475-qrg2-pj4r | High | basic-ftp: Quadratic-time CPU denial of service in Client.list() Unix directory-listing parser (RE_LINE backtracking)## Summary `Client.list()` parses the server's directory listing with the Unix-style parser in `parseListUnix.js`. Its `RE_LINE` regex has two adjacent `(\S+(?:\s\S+)*)` groups (owner name, then group name) followed by a required numeric size group. When a line starts with a valid listing prefix but the tokens after it never satisfy the size and date fields, the engine backtracks over every way of splitting those tokens between the two groups before it can fail, so matching one line costs roughly O(n²) in the line's length. The server whose directory a client lists controls that listing, so |
| GitHub (opens in a new tab) | |
| GHSA-rpmf-866q-6p89 | High | basic-ftp allows a malicious FTP server to cause client-side denial of service via unbounded multiline control response buffering## Summary `basic-ftp` is vulnerable to client-side denial of service when parsing FTP control-channel multiline responses. A malicious or compromised FTP server can send an unterminated multiline response during the initial FTP banner phase, before authentication. The client keeps appending attacker-controlled data into `FtpContext._partialResponse` and repeatedly reparses the accumulated buffer without enforcing a maximum control response size. As a result, an application using `basic-ftp` can remain stuck in `connect()` while memory and CPU usage grow under attacker-controlled input. Thi |
| GitHub (opens in a new tab) | |
| GHSA-rp42-5vxx-qpwr | High | basic-ftp vulnerable to denial of service via unbounded memory consumption in Client.list()### Summary `basic-ftp@5.2.2` is vulnerable to denial of service through unbounded memory growth while processing directory listings from a remote FTP server. A malicious or compromised server can send an extremely large or never-ending listing response to `Client.list()`, causing the client process to consume memory until it becomes unstable or crashes. ### Details The issue is in the package's default directory listing flow. `Client.list()` reaches `dist/Client.js`, where the full listing response is downloaded into a `StringWriter` before parsing: File: `dist/Client.js:516-527` ```js as |
| GitHub (opens in a new tab) | |
| GHSA-6v7q-wjvx-w8wg | High | basic-ftp: Incomplete CRLF Injection Protection Allows Arbitrary FTP Command Execution via Credentials and MKD Commands## Summary basic-ftp's CRLF injection protection (added in commit 2ecc8e2 for GHSA-chqc-8p9q-pq6q) is incomplete. Two code paths bypass the `protectWhitespace()` control character check: (1) the `login()` method directly concatenates user-supplied credentials into USER/PASS FTP commands without any validation, and (2) the `_openDir()` method sends an MKD command before `cd()` invokes `protectWhitespace()`, creating a TOCTOU bypass. Both vectors allow an attacker who controls input to inject arbitrary FTP commands into the control connection. ## Details ### Vector 1: Credential Injection (lo |
| GitHub (opens in a new tab) | |
| GHSA-chqc-8p9q-pq6q | High | basic-ftp has FTP Command Injection via CRLF## Summary `basic-ftp` version `5.2.0` allows FTP command injection via CRLF sequences (`\r\n`) in file path parameters passed to high-level path APIs such as `cd()`, `remove()`, `rename()`, `uploadFrom()`, `downloadTo()`, `list()`, and `removeDir()`. The library's `protectWhitespace()` helper only handles leading spaces and returns other paths unchanged, while `FtpContext.send()` writes the resulting command string directly to the control socket with `\r\n` appended. This lets attacker-controlled path strings split one intended FTP command into multiple commands. ## Affected product | Prod |
| GitHub (opens in a new tab) | |
| GHSA-5rq4-664w-9x2c | Critical | Basic FTP has Path Traversal Vulnerability in its downloadToDir() methodThe `basic-ftp` library contains a path traversal vulnerability in the `downloadToDir()` method. A malicious FTP server can send directory listings with filenames containing path traversal sequences (`../`) that cause files to be written outside the intended download directory. ## Source-to-Sink Flow ``` 1. SOURCE: FTP server sends LIST response └─> "-rw-r--r-- 1 user group 1024 Jan 20 12:00 ../../../etc/passwd" 2. PARSER: parseListUnix.ts:100 extracts filename └─> file.name = "../../../etc/passwd" 3. VALIDATION: parseListUnix.ts:101 checks └─> if (name === "." || name === "..") ❌ (only f |
| GitHub (opens in a new tab) |
- GHSA-5pm8-86m8-9m6rModeratebasic-ftp: Uncaught TypeError in MLSD directory-listing parser via __proto__ fact name causes DoS in Client.list()
< 6.2.4
### Summary basic-ftp's MLSD directory-listing parser (src/parseListMLSD.ts) looks up fact-handler functions in a plain object literal keyed directly by fact names taken from the FTP server's response, with no validation. A directory-listing line containing the fact name "__proto__" resolves this lookup to Object.prototype (inherited, non-own, non-function) instead of undefined, so the "not a function" guard is bypassed and the code throws `TypeError: factHandler is not a function`. This TypeError is not an FTPError, so it is not caught by Client.list()'s retry logic and propagates as a reje
CVE: CVE-2026-126345
- GHSA-r4jh-29pc-gfqrModeratebasic-ftp: Uncaught exception crashes the Node.js process when a password (or resumed-download path) contains CR/LF
< 6.2.3
### Summary Client.login() calls FTPContext.send() from inside the control-socket data event handler. send() throws on CR, LF or NUL, and nothing catches the throw. A password containing \r\n therefore raises an uncaught exception and terminates the whole Node.js process. It does not reject the returned promise. Any application that passes untrusted input as the FTP password can be crashed remotely with one request. The same pattern exists in the REST/RETR path of downloadTo() when the remote path contains control characters. ### Details The CRLF guard (FTPContext.send, src/FtpContext.ts ~L
CVE: CVE-2026-126346
- GHSA-c475-qrg2-pj4rHighbasic-ftp: Quadratic-time CPU denial of service in Client.list() Unix directory-listing parser (RE_LINE backtracking)
< 6.2.1
## Summary `Client.list()` parses the server's directory listing with the Unix-style parser in `parseListUnix.js`. Its `RE_LINE` regex has two adjacent `(\S+(?:\s\S+)*)` groups (owner name, then group name) followed by a required numeric size group. When a line starts with a valid listing prefix but the tokens after it never satisfy the size and date fields, the engine backtracks over every way of splitting those tokens between the two groups before it can fail, so matching one line costs roughly O(n²) in the line's length. The server whose directory a client lists controls that listing, so
CVE: CVE-2026-102990
- GHSA-rpmf-866q-6p89Highbasic-ftp allows a malicious FTP server to cause client-side denial of service via unbounded multiline control response buffering
< 5.3.1
## Summary `basic-ftp` is vulnerable to client-side denial of service when parsing FTP control-channel multiline responses. A malicious or compromised FTP server can send an unterminated multiline response during the initial FTP banner phase, before authentication. The client keeps appending attacker-controlled data into `FtpContext._partialResponse` and repeatedly reparses the accumulated buffer without enforcing a maximum control response size. As a result, an application using `basic-ftp` can remain stuck in `connect()` while memory and CPU usage grow under attacker-controlled input. Thi
CVE: CVE-2026-44240
- GHSA-rp42-5vxx-qpwrHighbasic-ftp vulnerable to denial of service via unbounded memory consumption in Client.list()
< 5.3.0
### Summary `basic-ftp@5.2.2` is vulnerable to denial of service through unbounded memory growth while processing directory listings from a remote FTP server. A malicious or compromised server can send an extremely large or never-ending listing response to `Client.list()`, causing the client process to consume memory until it becomes unstable or crashes. ### Details The issue is in the package's default directory listing flow. `Client.list()` reaches `dist/Client.js`, where the full listing response is downloaded into a `StringWriter` before parsing: File: `dist/Client.js:516-527` ```js as
CVE: CVE-2026-41324
- GHSA-6v7q-wjvx-w8wgHighbasic-ftp: Incomplete CRLF Injection Protection Allows Arbitrary FTP Command Execution via Credentials and MKD Commands
< 5.2.2
## Summary basic-ftp's CRLF injection protection (added in commit 2ecc8e2 for GHSA-chqc-8p9q-pq6q) is incomplete. Two code paths bypass the `protectWhitespace()` control character check: (1) the `login()` method directly concatenates user-supplied credentials into USER/PASS FTP commands without any validation, and (2) the `_openDir()` method sends an MKD command before `cd()` invokes `protectWhitespace()`, creating a TOCTOU bypass. Both vectors allow an attacker who controls input to inject arbitrary FTP commands into the control connection. ## Details ### Vector 1: Credential Injection (lo
- GHSA-chqc-8p9q-pq6qHighbasic-ftp has FTP Command Injection via CRLF
>= 5.2.0, < 5.2.1
## Summary `basic-ftp` version `5.2.0` allows FTP command injection via CRLF sequences (`\r\n`) in file path parameters passed to high-level path APIs such as `cd()`, `remove()`, `rename()`, `uploadFrom()`, `downloadTo()`, `list()`, and `removeDir()`. The library's `protectWhitespace()` helper only handles leading spaces and returns other paths unchanged, while `FtpContext.send()` writes the resulting command string directly to the control socket with `\r\n` appended. This lets attacker-controlled path strings split one intended FTP command into multiple commands. ## Affected product | Prod
CVE: CVE-2026-39983
- GHSA-5rq4-664w-9x2cCriticalBasic FTP has Path Traversal Vulnerability in its downloadToDir() method
< 5.2.0
The `basic-ftp` library contains a path traversal vulnerability in the `downloadToDir()` method. A malicious FTP server can send directory listings with filenames containing path traversal sequences (`../`) that cause files to be written outside the intended download directory. ## Source-to-Sink Flow ``` 1. SOURCE: FTP server sends LIST response └─> "-rw-r--r-- 1 user group 1024 Jan 20 12:00 ../../../etc/passwd" 2. PARSER: parseListUnix.ts:100 extracts filename └─> file.name = "../../../etc/passwd" 3. VALIDATION: parseListUnix.ts:101 checks └─> if (name === "." || name === "..") ❌ (only f
CVE: CVE-2026-27699