basic-ftp MLSD parser bug lets an FTP server crash Node.js apps
One crafted directory-listing line from an FTP server can crash Node.js services using basic-ftp 6.2.3 or earlier, and the 5.3 score understates that risk.
Automated engineering analysis by the Khalid Aboubakr Engineering Desk, from the primary sources listed below. Not reviewed by a person before publication. About the desk
Bottom line
basic-ftp 6.2.3 and earlier are affected, and the fix is in 6.2.4. A server, or an on-path attacker on plaintext FTP, can send one listing line that makes list() and the calls built on it reject with a TypeError, which ends the whole Node.js process if the rejection is unhandled. Upgrade to 6.2.4, including any transitive copies, and prioritise services that poll third-party or partner FTP endpoints.
What happened
The maintainer of the npm package basic-ftp published advisory GHSA-5pm8-86m8-9m6r (CVE-2026-126345). Versions up to and including 6.2.3 are affected, and 6.2.4 is the release that fixes it.
The bug is in the MLSD directory-listing parser. That parser looks up fact handlers in a plain object, using fact names supplied by the server. When a listing line contains a fact named __proto__, the lookup resolves to Object.prototype. That value passes the existence guard, and the code then throws TypeError: factHandler is not a function.
This TypeError is not an FTPError, so Client.list() neither retries nor suppresses it, and the promise rejects. The advisory lists these affected call paths, all of which end up in Client.list():
list()downloadToDir()clearWorkingDir()removeDir()
The advisory states that if the rejection is unhandled, it terminates the Node.js process, which is the default behaviour since Node 15.
Other Object.prototype names the reporter tested resolve to real functions and do not crash; only __proto__ does.
The published CVSS v3.1 vector is AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L, scoring 5.3 (Moderate). The advisory's own impact text, however, rates availability as High and says the whole application or service can go down.
The fix commit only accepts own keys of the handler table, so names like __proto__ are ignored. The 6.2.4 release notes reference the advisory.
Why it matters
The trust direction is the important part. Here the attacker is the FTP server your application connects to, or anyone who can tamper with a plaintext FTP session in transit.
Services that pull files from partner, supplier or legacy endpoints are the obvious exposure case, especially where those servers are treated as trusted. If such a server is compromised, misbehaves or is impersonated on a non-TLS path, it can take down the consuming process.
The outage is not limited to the FTP job. With default Node settings, an unhandled rejection kills the whole process, so a scheduled sync job that shares a process with an API takes the API down with it.
Neither the Node.js runtime nor the FTP protocol is at fault. The cause is an unguarded dictionary lookup on server input inside one library.
What should not be overstated: the evidence shows no confidentiality or integrity impact. This is not a prototype-pollution write; it is a crash.
Engineering assessment
Our assessment: the 5.3 score with A:L understates the practical risk for a specific class of deployment. It fits applications that already handle rejections from these calls far better than those that do not.
The advisory's own narrative describes process termination, which reads like Availability High. Real severity therefore depends mostly on two properties of your code, not on the library alone:
- Whether every call to
list()and the calls built on it is wrapped in error handling. - Whether the FTP work shares a process with anything else that matters.
Exposure is narrow but real. It requires:
basic-ftpat 6.2.3 or earlier.- Code paths that list directories.
- A counterparty server that is hostile or compromised, or a plaintext FTP connection that an on-path attacker can reach.
TLS-protected connections to servers you operate carry lower risk, unless the server itself is compromised. Polling external endpoints over plain FTP is the high-exposure case.
The fix is a small change confined to the parser, and it ignores unrecognised keys instead of throwing. Compatibility risk from this patch-level upgrade therefore looks low, although the evidence contains no broader changelog for 6.2.4.
basic-ftp may also arrive as a transitive dependency; the evidence does not say which packages depend on it or when they will update.
The lesson is not new, but this is a clean example. Data from a remote peer is untrusted input, even in a client. Exceptions that are not the library's own error type bypass narrow catch filters, both inside the library and in application code that only catches expected errors. Even after upgrading, a process-wide crash triggered by one bad response is a design weakness worth fixing on its own.
Is this you?
npm ls basic-ftpshows any version at 6.2.3 or lower, directly or transitively.- Your code calls
list(),downloadToDir(),uploadFromDir(),clearWorkingDir()orremoveDir(). - You connect to FTP servers you do not control, such as partners, suppliers or public endpoints.
- Any of those connections use plain FTP rather than TLS.
- Those calls are not wrapped in error handling that catches all errors, not just
FTPError. - The FTP work runs in the same Node.js process as user-facing services.
What to do
- Upgrade now. Move
basic-ftpto 6.2.4 (npm install basic-ftp@6.2.4), then confirm withnpm ls basic-ftpandnpm audit. - Find transitive copies. Run
npm explain basic-ftp(or your package manager's equivalent) to see which packages pull it in. If an upstream package pins an affected version, use your package manager's overrides or resolutions feature to force 6.2.4 until upstream updates. Not vendor guidance. - Test listing paths. Exercise
list(),downloadToDir()and any directory sync jobs against your real counterparties after upgrading. - Harden error handling. Wrap FTP operations so that any error type fails the job rather than the process, and monitor for unhandled rejections. Not vendor guidance.
- Isolate integrations. Run third-party FTP polling in a separate worker or process under a supervisor, so one bad counterparty cannot take down user-facing services. Not vendor guidance.
- Plan transport hardening. Inventory plain-FTP connections and move them to TLS where counterparties support it. This narrows the on-path case but does not remove the risk from a hostile or compromised server. Not vendor guidance.
What we don't know yet
- The evidence says nothing about whether this bug has been used in attacks.
- The advisory does not explain why its text says Availability High while the vector says
A:L. - It is unclear whether applications that do catch the error end up with jobs that fail repeatedly on the same listing; the advisory covers only the unhandled case.
- It is unknown which downstream packages depend on
basic-ftpand when they will ship releases that pull in 6.2.4. - FTPS sessions with a malicious server are not discussed beyond the general statement that any server the client connects to can trigger the crash.
The desk will revisit this if exploitation reports, a revised CVSS vector or downstream package updates appear.
Sources
Latest engineering analysis
6 min read
zod-msg-tools 0.1.4: npm malware hides an auth-bypassing SQL backdoor
A fake Zod helper on npm patches Node's HTTP server at runtime and adds a hidden endpoint that sits in front of your router and auth, runs queries on your database pools and, where the psql client is present, can reach OS command execution on Postgres deployments.
7 min read
Filament Curator picker search leaked media metadata across tenants
Filament Curator's picker search skipped the tenant scope, and an ungrouped orWhere chain also escaped the directory limit; upgrading is the only fix.
7 min read
array-flatten-utils on npm: malware loader that fires only in CI builds
A lookalike of array-flatten runs a native-addon loader at require() time, only in CI and build environments, where deploy tokens are stored.