basic-ftp@6.2.2

FTP client for Node.js, supports FTPS over TLS, IPv6, Async/Await, and Typescript.

  • latest version

    6.2.6

  • latest non vulnerable version

  • first published

    8 years ago

  • latest version published

    12 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the basic-ftp package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Uncaught Exception

    basic-ftp is a FTP client for Node.js, supports FTPS over TLS, IPv6, Async/Await, and Typescript.

    Affected versions of this package are vulnerable to Uncaught Exception via an uncaught exception in FTPContext._passToHandler. Client.login() calls FTPContext.send() from inside the control-socket data event handler, and send() throws when the command contains CR, LF, or NUL. Because the throw originates inside a socket event callback rather than a Promise executor, no try/catch or .catch() in application code can intercept it, and the process terminates with an uncaught exception. The same pattern exists in the REST/RETR path of downloadTo() when the remote path contains control characters. An attacker who controls the FTP password or the remote path of a resumed download can crash the entire Node.js process with a single request, taking down all other clients it serves.

    How to fix Uncaught Exception?

    Upgrade basic-ftp to version 6.2.3 or higher.

    <6.2.3
    • M
    Prototype Pollution

    basic-ftp is a FTP client for Node.js, supports FTPS over TLS, IPv6, Async/Await, and Typescript.

    Affected versions of this package are vulnerable to Prototype Pollution via the parseLine function in src/parseListMLSD.ts, which looks up fact-handler functions in a plain object literal keyed directly by fact names taken from the FTP server's MLSD directory-listing response without validating that the key is an own property. When a directory-listing line contains the fact name __proto__, the bracket lookup factHandlersByName["__proto__"] returns Object.prototype itself - a truthy, non-undefined value - bypassing the if (!factHandler) guard and causing the code to throw TypeError: factHandler is not a function. This TypeError is not an FTPError, so it is not caught by Client.list()'s retry logic and propagates as a rejected promise out of list() and every API built on top of it (downloadToDir, uploadFromDir, clearWorkingDir, removeDir), crashing the Node.js process when the rejection is unhandled.

    How to fix Prototype Pollution?

    Upgrade basic-ftp to version 6.2.4 or higher.

    <6.2.4