CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-27699

FTP: File Transfer Pwnage - Analyzing CVE-2026-27699 in basic-ftp

Amit Schendel
Amit Schendel
Senior Security Researcher

Feb 26, 2026·6 min read·141 visits

Executive Summary (TL;DR)

The `downloadToDir` function in `basic-ftp` (< 5.2.0) blindly trusts filenames sent by the server. A malicious server can return filenames like `../../.ssh/authorized_keys`, causing the client to write outside the sandbox. Fix: Update to 5.2.0.

A critical Path Traversal vulnerability in the popular Node.js `basic-ftp` library allows malicious FTP servers to write arbitrary files to the client's filesystem. By crafting malicious filenames in directory listings, an attacker can escape the intended download directory and overwrite sensitive system files or inject code.

The Hook: Trust Issues

FTP is the cockroach of internet protocols. It survives nuclear wars, modern firewall policies, and the scorn of every security engineer born after 1995. In the Node.js ecosystem, basic-ftp is the go-to library for interacting with these ancient beasts. It's simple, promise-based, and widely used for automated tasks like backing up databases or syncing assets.

But here is the problem with automation: it assumes everyone plays nice. When you connect your client to an FTP server and tell it to "download this directory," you are implicitly trusting that the server will send you... well, files inside that directory. You aren't expecting the server to reach out of the sandbox and stab you in the throat.

CVE-2026-27699 is exactly that stab. It’s a classic Path Traversal vulnerability that turns a standard file download operation into an arbitrary file write primitive. If your application uses basic-ftp to pull data from an untrusted (or compromised) source, your local filesystem is essentially open for business.

The Flaw: Blindly Joining Paths

The vulnerability hides in plain sight within the _downloadFromWorkingDir method. This function is responsible for recursively downloading a directory from the server to your local machine. The logic seems sound on paper: list the files on the server, iterate through them, and save them locally.

Here is where it goes wrong: the library takes the filename provided by the server and feeds it directly into Node's path.join(). In Node.js, path.join('/safe/dir', '../../evil') resolves to /evil. It dutifully normalizes the path, interpreting the .. segments as instructions to go up the directory tree.

> [!WARNING] > The library failed to ask the most important question in file handling: "Does this file stay where I put it?"

By failing to sanitize the file.name returned by the FTP LIST command, basic-ftp became a 'confused deputy.' It willingly accepts a filename like ../../../../etc/passwd from the server and overwrites the system password file, thinking it's just doing its job.

The Code: The Smoking Gun

Let's look at the code before the patch. This is from src/Client.ts. It’s short, readable, and dangerous.

// VULNERABLE CODE (< 5.2.0)
protected async _downloadFromWorkingDir(localDirPath: string): Promise<void> {
    await ensureLocalDirectory(localDirPath)
    // The server controls 'file.name'
    for (const file of await this.list()) {
        // FATAL FLAW: No validation on file.name before join
        const localPath = join(localDirPath, file.name)
        if (file.isDirectory) {
            await this.cd(file.name)
            // ... recursion ...
        } else {
            await this.downloadTo(createWriteStream(localPath), file.name)
        }
    }
}

The fix, introduced in version 5.2.0 (Commit 2a2a0e6514357b9eda07c2f8afbd3f04727a7cd9), is elegant in its simplicity. It uses path.basename() to verify that the filename provided by the server doesn't contain any directory separators.

// PATCHED CODE (5.2.0)
+ import { basename, join } from "path"
 
protected async _downloadFromWorkingDir(localDirPath: string): Promise<void> {
    await ensureLocalDirectory(localDirPath)
    for (const file of await this.list()) {
        // CHECK: Is the basename identical to the name?
        // If 'file.name' is '../foo', basename is 'foo'. mismatch -> block.
+       const hasInvalidName = !file.name || basename(file.name) !== file.name
+       if (hasInvalidName) {
+           this.ftp.log(`Invalid filename... skipping`)
+           continue
+       }
        const localPath = join(localDirPath, file.name)
        // ...
    }
}

If the server sends ../../evil.exe, basename returns evil.exe. Since ../../evil.exe !== evil.exe, the check fails, and the file is skipped. Simple, but effective.

The Exploit: How to Break It

To exploit this, you don't need fancy buffer overflows. You just need to be the server. This is a "Reverse Client" attack. The victim connects to us.

Scenario: A developer runs a script node backup-fetcher.js that connects to your FTP server to download logs.

  1. The Trap: You set up a malicious FTP server (using Python's pyftpdlib with some modifications to allow raw raw responses).
  2. The Bait: The victim authenticates and requests LIST.
  3. The Switch: Your server responds with a forged directory listing:
    -rw-r--r--   1 root     root         1024 Feb 25 10:00 ../../../../../home/victim/.ssh/authorized_keys
  4. The Execution: basic-ftp receives this line. It parses the filename as ../../../../../home/victim/.ssh/authorized_keys. It joins this with the user's download path (e.g., ./downloads).
  5. The Pwn: The final path resolves to /home/victim/.ssh/authorized_keys. The client opens a write stream to that path. Your server then sends your public SSH key as the file content.

Boom. You now have SSH access to the developer's machine.

The Impact: Why Panic?

This vulnerability is rated CVSS 9.1 (Critical) for a reason. While it requires the victim to connect to a malicious server, the consequences are catastrophic.

  • RCE: Overwriting .bashrc, .ssh/authorized_keys, or placing files in startup folders leads to immediate code execution.
  • Data Corruption: An attacker could overwrite critical application configuration files (e.g., web.config, .env) to disable security features or break the application.
  • Supply Chain Risk: If a build server uses basic-ftp to pull dependencies or assets from a compromised third-party FTP server, the build artifacts themselves could be backdoored.

This isn't just about reading files; it's about writing them anywhere the Node.js process has permission to write. If the script runs as root/admin (God forbid), you own the box.

The Fix: Stopping the Bleeding

The remediation is straightforward: Update basic-ftp to version 5.2.0 immediately.

If you cannot update for some reason (maybe you enjoy living dangerously), you must stop using the high-level downloadToDir() method. Instead, you would have to manually implement the directory listing and download logic, ensuring you sanitize every single filename before writing it to disk.

> [!TIP] > Developer Lesson: Never trust input from the network, even if it looks like a harmless file list. Treat every string from a socket as if it's trying to exploit you. Use path.basename() when handling filenames to ensure they are strictly filenames and not paths.

For security teams: Scan your repositories for package.json files containing "basic-ftp": "<5.2.0". This is a low-effort, high-impact fix.

Official Patches

GitHubCommit fixing the vulnerability

Fix Analysis (1)

Technical Appendix

CVSS Score
9.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H

Affected Systems

Node.js applications using basic-ftp < 5.2.0Automated backup scriptsCI/CD pipelines fetching assets via FTPData synchronization tools

Affected Versions Detail

Product
Affected Versions
Fixed Version
basic-ftp
Patrick Juchli
< 5.2.05.2.0
AttributeDetail
CWE IDCWE-22 (Path Traversal)
CVSS v3.19.1 (Critical)
Attack VectorNetwork (Malicious Server)
Affected ComponentdownloadToDir() / _downloadFromWorkingDir()
Exploit StatusPoC Available
Patch Date2026-02-23

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1566Phishing (via malicious server setup)
Initial Access
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.

Known Exploits & Detection

GitHub Security AdvisoryAdvisory containing technical description and fix analysis

Vulnerability Timeline

Patch committed to repository
2026-02-23
CVE-2026-27699 Published
2026-02-25
basic-ftp version 5.2.0 Released
2026-02-25

References & Sources

  • [1]GHSA-5rq4-664w-9x2c

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•39 minutes ago•CVE-2026-107396
5.4

CVE-2026-107396: Stored Cross-Site Scripting (XSS) in Indico

A stored Cross-Site Scripting (XSS) vulnerability was identified in Indico, an open-source event management system developed at CERN, prior to version 3.3.13. The vulnerability stems from weak URL validation in custom link fields and lack of HTML sanitization during Marshmallow serialization of event notes. This allows authenticated attackers with event modification privileges to inject malicious payloads that execute in the browser of users viewing the event pages or collaborating on notes.

Alon Barad
Alon Barad
1 views•6 min read
•about 2 hours ago•CVE-2026-107397
4.4

CVE-2026-107397: Stored Cross-Site Scripting via Collaborative Editor Conflict Resolution and Custom Link Fields in Indico

A technical analysis of CVE-2026-107397, a stored Cross-Site Scripting (XSS) vulnerability in Indico's collaborative notes editor and custom link generation fields. Prior to version 3.3.13, Marshmallow serialization schemas omitted HTML sanitization during conflict resolution, and form validators failed to enforce strict URI schemes, enabling authenticated low-privilege attackers to execute arbitrary JavaScript.

Alon Barad
Alon Barad
0 views•7 min read
•about 3 hours ago•CVE-2026-107395
4.3

CVE-2026-107395: Missing Authorization in Indico Legacy Session Export API

An authorization bypass vulnerability exists in the legacy session export API of Indico, an open-source event management system developed at CERN. Due to a missing object-level access check, authenticated users can bypass configuration-level restrictions to extract private session metadata (including session titles, descriptions, and list of conveners) from events that they are otherwise authorized to view.

Alon Barad
Alon Barad
6 views•5 min read
•about 4 hours ago•CVE-2026-107394
6.8

CVE-2026-107394: Server-Side Request Forgery Bypass via Parser Differential in Indico

An incomplete Server-Side Request Forgery (SSRF) validation check in Indico prior to version 3.3.13 allows authenticated event organizers to bypass outbound network restrictions. By utilizing backslash characters within crafted URLs, attackers can exploit a parser differential between the application's validator and the downstream HTTP client library to access internal network resources.

Alon Barad
Alon Barad
5 views•6 min read
•about 5 hours ago•CVE-2026-107717
6.5

CVE-2026-107717: Chat Role Injection and Prompt Boundary Bypass in Banks Library

CVE-2026-107717 represents a critical prompt boundary bypass and chat role injection vulnerability in the Banks Python package (versions prior to 2.5.0). The library parses generated template outputs line-by-line, attempting to validate each segment as a JSON-serialized ChatMessage object without validating the source boundaries of the text. If an application integrates user input directly into a prompt template, a remote, unauthenticated attacker can supply multi-line inputs with structured JSON payloads. This input is then parsed as high-privilege system instructions or tool execution responses, completely hijacking downstream Large Language Model behavior.

Alon Barad
Alon Barad
8 views•6 min read
•about 6 hours ago•CVE-2026-107716
7.3

CVE-2026-107716: Path Traversal and Link Following in banks DirectoryPromptRegistry

Improper pathname limitation and link resolution (CWE-22 and CWE-59) in the banks library prior to version 2.5.1 allow local attackers to read or write arbitrary files via crafted symbolic links in the prompt directory registry.

Amit Schendel
Amit Schendel
8 views•7 min read