CVE-2026-27699 — Vulnerability in basic-ftp — CVE Details
Basic FTP has Path Traversal Vulnerability in its downloadToDir() method
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (1.21%). Schedule for your next planned update.
Does your project use an affected basic-ftp version?
Paste your package-lock.json to check it for CVE-2026-27699 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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 filters exact matches)
└─> "../../../etc/passwd" !== "." && !== ".." ✅ PASSES
4. SINK: Client.ts:707 uses filename directly
└─> const localPath = join(localDirPath, file.name)
└─> join("/safe/download", "../../../etc/passwd")
└─> Result: "/safe/download/../../../etc/passwd" → resolves to "/etc/passwd"
5. FILE WRITE: Client.ts:512 opens file
└─> fsOpen(localPath, "w") → writes to /etc/passwd (outside intended directory)
Vulnerable Code
File: src/Client.ts:707
protected async _downloadFromWorkingDir(localDirPath: string): Promise<void> {
await ensureLocalDirectory(localDirPath)
for (const file of await this.list()) {
const localPath = join(localDirPath, file.name) // ⚠ VULNERABLE
// file.name comes from untrusted FTP server, no sanitization
await this.downloadTo(localPath, file.name)
}
}
Root Cause:
- Parser validation (parseListUnix.ts:101) only filters exact . or .. entries
- No sanitization of ../ sequences in filenames
path.join()doesn't prevent traversal,fs.open()resolves paths
Impact
A malicious FTP server can: - Write files to arbitrary locations on the client filesystem - Overwrite critical system files (if user has write access) - Potentially achieve remote code execution
Affected Versions
- Tested: v5.1.0
- Likely: All versions (code pattern exists since initial implementation)
Mitigation
Workaround: Do not use downloadToDir() with untrusted FTP servers.
Fix: Sanitize filenames before use:
import { basename } from 'path'
// In _downloadFromWorkingDir:
const sanitizedName = basename(file.name) // Strip path components
const localPath = join(localDirPath, sanitizedName)
Advisory Timeline
- First published February 25, 2026 (274 days ago).
- Last revised September 10, 2026 — 196 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
npm install basic-ftp@5.2.0
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: npm (1).
| Package | Fixed In |
|---|---|
| basic-ftp npm · Affected: All versions | 5.2.0 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-22Path TraversalMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.1 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H
References
- https://github.com/patrickjuchli/basic-ftp/security/advisories/GHSA-5rq4-664w-9x2cWEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-27699ADVISORY
- https://github.com/patrickjuchli/basic-ftp/commit/2a2a0e6514357b9eda07c2f8afbd3f04727a7cd9WEB
- https://github.com/patrickjuchli/basic-ftpPACKAGE
- https://github.com/patrickjuchli/basic-ftp/releases/tag/v5.2.0WEB
Frequently Asked Questions
- What is CVE-2026-27699?
- Basic FTP has Path Traversal Vulnerability in its downloadToDir() method. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.1/10).
- How do I check if my project is affected by CVE-2026-27699?
- CVE-2026-27699 affects basic-ftp. It has a 1.2% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-27699 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This is an above-median EPSS score — 68.3% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-76807CRITICAL
Todoist MCP Server: Browser DNS rebinding lets websites write and delete Todoist data through local MCP server
- CVE-2026-114516CRITICAL
Etherpad: Pre-auth arbitrary file read