CVE-2026-41324: Basic ftp Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-rp42-5vxx-qpwr
CVSS 7.5
CWE-400 CWE-770
Published
Advisory Summary

CVE-2026-41324 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Basic ftp libraries in the npm ecosystem. The issue involves basic-ftp vulnerable to denial of service via unbounded memory consumption in client.list(). Remediation is available by upgrading affected packages to version 5.3.0.

CVE-2026-41324 at a Glance

CVE Identifier CVE-2026-41324
GHSA Identifier GHSA-rp42-5vxx-qpwr
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Basic ftp
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-41324

To remediate this vulnerability, upgrade all affected Basic ftp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

basic-ftp fixed: 5.3.0
npm install basic-ftp@5.3.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls basic-ftp

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-41324, inspect your project dependencies using npm:

npm ls basic-ftp

Analyze the terminal output to locate any version of Basic ftp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.3.0), your application is affected.

Note: The npm ls basic-ftp command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Basic ftp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 async _requestListWithCommand(command) { const buffer = new StringWriter_1.StringWriter(); await (0, transfer_1.downloadTo)(buffer, { ftp: this.ftp, tracker: this._progressTracker, command, remotePath: "", type: "list" }); const text = buffer.getText(this.ftp.encoding); this.ftp.log(text); return this.parseList(text); } ``` The vulnerable sink is `StringWriter`, which grows an in-memory `Buffer` with no limit: File: `dist/StringWriter.js:5-20` ```js class StringWriter extends stream_1.Writable { constructor() { super(...arguments); this.buf = Buffer.alloc(0); } _write(chunk, _, callback) { if (chunk instanceof Buffer) { this.buf = Buffer.concat([this.buf, chunk]); callback(null); } else { callback(new Error("StringWriter expects chunks of type 'Buffer'.")); } } getText(encoding) { return this.buf.toString(encoding); } } ``` The critical operation is: ```js this.buf = Buffer.concat([this.buf, chunk]); ``` There is no maximum size check, no truncation, and no streaming parser. Because the remote FTP server controls the listing response, it can force the client to keep allocating memory until the process is terminated. How it happens: 1. An application connects to an attacker-controlled or compromised FTP server. 2. The application calls `client.list()`. 3. The server returns an extremely large or unbounded directory listing. 4. `basic-ftp` buffers the full response in `StringWriter`. 5. Memory grows without bound due to repeated `Buffer.concat(...)` calls. ### PoC The following PoC exercises the vulnerable buffering primitive directly: ```js const { StringWriter } = require("basic-ftp/dist/StringWriter.js"); function mb(n) { return Math.round(n / 1024 / 1024) + "MB"; } const writer = new StringWriter(); let wrote = 0; for (let i = 0; i < 32; i++) { const chunk = Buffer.alloc(4 * 1024 * 1024, 0x41); writer.write(chunk); wrote += chunk.length; if ((i + 1) % 8 === 0) { const m = process.memoryUsage(); console.log("written", mb(wrote), "rss", mb(m.rss), "heap", mb(m.heapUsed), "buf", mb(m.arrayBuffers)); } } console.log("final text len", writer.getText("utf8").length); ``` Observed output: ```text written 32MB rss 116MB heap 4MB buf 64MB written 64MB rss 296MB heap 4MB buf 240MB written 96MB rss 340MB heap 3MB buf 284MB written 128MB rss 436MB heap 3MB buf 376MB final text len 134217728 ``` This demonstrates sustained memory growth in the same code path used to buffer directory listing data. Supporting files saved alongside this report: - `poc.js` - `poc_output.txt` ### Impact This is a denial-of-service vulnerability affecting applications that use `basic-ftp` to list directories from remote FTP servers. - Vulnerability class: Memory exhaustion / Denial of Service - Attack precondition: The victim connects to a malicious or compromised FTP server and performs `Client.list()` - Impacted users: Any application or service using `basic-ftp@5.2.2` against untrusted FTP endpoints - Security effect: The attacker can cause excessive memory consumption, process instability, and potential process termination Recommended remediation: 1. Enforce a maximum listing size. 2. Abort transfers that exceed the configured limit. 3. Prefer incremental or streaming parsing over full-response buffering. Example defensive check: ```js if (this.buf.length + chunk.length > MAX_LISTING_BYTES) { callback(new Error("FTP listing exceeds maximum allowed size.")); return; } this.buf = Buffer.concat([this.buf, chunk]); ```

CVE-2026-41324 Affected Basic ftp Versions

1 component(s)
Fixed Versions:
5.3.0
Product / Package Ecosystem Affected Versions Fixed Version
basic-ftp
npm
< 5.3.0
5.3.0

References

Frequently Asked Questions

What is CVE-2026-41324?
CVE-2026-41324 is a security vulnerability in Basic ftp involving basic-ftp vulnerable to denial of service via unbounded memory consumption in Client.list() under CWE-400: Uncontrolled Resource Consumption.
Which Basic ftp versions are affected?
Affected versions include releases prior to 5.3.0 across affected packages: basic-ftp.
What version fixes CVE-2026-41324?
Upgrading to 5.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is basic-ftp affected?
Yes, basic-ftp is affected in releases prior to 5.3.0. Upgrade your dependency to 5.3.0 or later.
What is the CVSS score of CVE-2026-41324?
CVE-2026-41324 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-41324?
CVE-2026-41324 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2026-41324?
Run the dependency tree command: 'npm ls basic-ftp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rp42-5vxx-qpwr",
  "modified" : "2026-04-24T21:02:13Z",
  "published" : "2026-04-16T21:37:48Z",
  "aliases" : [ "CVE-2026-41324" ],
  "summary" : "basic-ftp vulnerable to denial of service via unbounded memory consumption in Client.list()",
  "details" : "### Summary\n`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.\n\n### Details\nThe issue is in the package's default directory listing flow.\n\n`Client.list()` reaches `dist/Client.js`, where the full listing response is downloaded into a `StringWriter` before parsing:\n\nFile: `dist/Client.js:516-527`\n\n```js\nasync _requestListWithCommand(command) {\n    const buffer = new StringWriter_1.StringWriter();\n    await (0, transfer_1.downloadTo)(buffer, {\n        ftp: this.ftp,\n        tracker: this._progressTracker,\n        command,\n        remotePath: \"\",\n        type: \"list\"\n    });\n    const text = buffer.getText(this.ftp.encoding);\n    this.ftp.log(text);\n    return this.parseList(text);\n}\n```\n\nThe vulnerable sink is `StringWriter`, which grows an in-memory `Buffer` with no limit:\n\nFile: `dist/StringWriter.js:5-20`\n\n```js\nclass StringWriter extends stream_1.Writable {\n    constructor() {\n        super(...arguments);\n        this.buf = Buffer.alloc(0);\n    }\n    _write(chunk, _, callback) {\n        if (chunk instanceof Buffer) {\n            this.buf = Buffer.concat([this.buf, chunk]);\n            callback(null);\n        }\n        else {\n            callback(new Error(\"StringWriter expects chunks of type 'Buffer'.\"));\n        }\n    }\n    getText(encoding) {\n        return this.buf.toString(encoding);\n    }\n}\n```\n\nThe critical operation is:\n\n```js\nthis.buf = Buffer.concat([this.buf, chunk]);\n```\n\nThere is no maximum size check, no truncation, and no streaming parser. Because the remote FTP server controls the listing response, it can force the client to keep allocating memory until the process is terminated.\n\nHow it happens:\n\n1. An application connects to an attacker-controlled or compromised FTP server.\n2. The application calls `client.list()`.\n3. The server returns an extremely large or unbounded directory listing.\n4. `basic-ftp` buffers the full response in `StringWriter`.\n5. Memory grows without bound due to repeated `Buffer.concat(...)` calls.\n\n### PoC\nThe following PoC exercises the vulnerable buffering primitive directly:\n\n```js\nconst { StringWriter } = require(\"basic-ftp/dist/StringWriter.js\");\n\nfunction mb(n) {\n  return Math.round(n / 1024 / 1024) + \"MB\";\n}\n\nconst writer = new StringWriter();\nlet wrote = 0;\n\nfor (let i = 0; i < 32; i++) {\n  const chunk = Buffer.alloc(4 * 1024 * 1024, 0x41);\n  writer.write(chunk);\n  wrote += chunk.length;\n\n  if ((i + 1) % 8 === 0) {\n    const m = process.memoryUsage();\n    console.log(\"written\", mb(wrote), \"rss\", mb(m.rss), \"heap\", mb(m.heapUsed), \"buf\", mb(m.arrayBuffers));\n  }\n}\n\nconsole.log(\"final text len\", writer.getText(\"utf8\").length);\n```\n\nObserved output:\n\n```text\nwritten 32MB rss 116MB heap 4MB buf 64MB\nwritten 64MB rss 296MB heap 4MB buf 240MB\nwritten 96MB rss 340MB heap 3MB buf 284MB\nwritten 128MB rss 436MB heap 3MB buf 376MB\nfinal text len 134217728\n```\n\nThis demonstrates sustained memory growth in the same code path used to buffer directory listing data.\n\nSupporting files saved alongside this report:\n\n- `poc.js`\n- `poc_output.txt`\n\n### Impact\nThis is a denial-of-service vulnerability affecting applications that use `basic-ftp` to list directories from remote FTP servers.\n\n- Vulnerability class: Memory exhaustion / Denial of Service\n- Attack precondition: The victim connects to a malicious or compromised FTP server and performs `Client.list()`\n- Impacted users: Any application or service using `basic-ftp@5.2.2` against untrusted FTP endpoints\n- Security effect: The attacker can cause excessive memory consumption, process instability, and potential process termination\n\nRecommended remediation:\n\n1. Enforce a maximum listing size.\n2. Abort transfers that exceed the configured limit.\n3. Prefer incremental or streaming parsing over full-response buffering.\n\nExample defensive check:\n\n```js\nif (this.buf.length + chunk.length > MAX_LISTING_BYTES) {\n    callback(new Error(\"FTP listing exceeds maximum allowed size.\"));\n    return;\n}\nthis.buf = Buffer.concat([this.buf, chunk]);\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "basic-ftp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.3.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.2.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-rp42-5vxx-qpwr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41324"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/patrickjuchli/basic-ftp"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-16T21:37:48Z",
    "nvd_published_at" : "2026-04-24T04:16:20Z"
  }
}