chore(deps): update dependency basic-ftp@<5.2.0 to v5.2.1 [security]#6316
Merged
renovate[bot] merged 1 commit intomainfrom Apr 9, 2026
Merged
Conversation
|
✅ Meticulous spotted 0 visual differences across 269 screens tested: view results. Meticulous evaluated ~4 hours of user flows against your PR. Expected differences? Click here. Last updated for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
5.2.0→5.2.1GitHub Vulnerability Alerts
GHSA-chqc-8p9q-pq6q
Summary
basic-ftpversion5.2.0allows FTP command injection via CRLF sequences (\r\n) in file path parameters passed to high-level path APIs such ascd(),remove(),rename(),uploadFrom(),downloadTo(),list(), andremoveDir(). The library'sprotectWhitespace()helper only handles leading spaces and returns other paths unchanged, whileFtpContext.send()writes the resulting command string directly to the control socket with\r\nappended. This lets attacker-controlled path strings split one intended FTP command into multiple commands.Affected product
Vulnerability details
CWE-93- Improper Neutralization of CRLF Sequences ('CRLF Injection')8.6(High)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:Ldist/Client.js, all path-handling methods viaprotectWhitespace()andsend()The vulnerability exists because of two interacting code patterns:
1. Inadequate path sanitization in
protectWhitespace()(line 677):This function only handles leading whitespace. It does not strip or reject
\r(0x0D) or\n(0x0A) characters anywhere in the path string.2. Direct socket write in
send()(FtpContext.js line 177):The
send()method appends\r\nto the command and writes directly to the TCP socket. If the command string already contains\r\nsequences (from unsanitized path input), the FTP server interprets them as command delimiters, causing the single intended command to be split into multiple commands.Affected methods (all call
protectWhitespace()→send()):cd(path)→CWD ${path}remove(path)→DELE ${path}list(path)→LIST ${path}downloadTo(localPath, remotePath)→RETR ${remotePath}uploadFrom(localPath, remotePath)→STOR ${remotePath}rename(srcPath, destPath)→RNFR ${srcPath}/RNTO ${destPath}removeDir(path)→RMD ${path}Technical impact
An attacker who controls file path parameters can inject arbitrary FTP protocol commands, enabling:
DELE /critical-fileto delete files on the FTP serverMKDorRMDcommands to create/remove directoriesRETRcommands to trigger downloads of unintended filesSITE EXEC, inject system commandsUSER/PASScommands to re-authenticate as a different userQUITto terminate the FTP session unexpectedlyThe attack is realistic in applications that accept user input for FTP file paths — for example, web applications that allow users to specify files to download from or upload to an FTP server.
Proof of concept
Prerequisites:
Mock FTP server (ftp-server-mock.js):
Exploit (poc.js):
Running the PoC:
Expected output on mock server:
This command trace was reproduced against the published
basic-ftp@5.2.0package on Linux with a local mock FTP server. The injected
DELEcommands arereceived as distinct FTP commands, confirming that CRLF inside path parameters
is not neutralized before socket write.
Mitigation
Immediate workaround: Sanitize all path inputs before passing them to basic-ftp:
Recommended fix for basic-ftp: The
protectWhitespace()function (or a new validation layer) should reject or strip\rand\ncharacters from all path inputs:References
Release Notes
patrickjuchli/basic-ftp (basic-ftp@<5.2.0)
v5.2.1Compare Source
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.