chore(deps): update dependency basic-ftp@<5.2.0 to v5.2.2 [security]#6322
Merged
renovate[bot] merged 1 commit intomainfrom Apr 11, 2026
Merged
Conversation
|
✅ Meticulous spotted 0 visual differences across 274 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.1→5.2.2GitHub Vulnerability Alerts
GHSA-6v7q-wjvx-w8wg
Summary
basic-ftp's CRLF injection protection (added in commit 2ecc8e2 for GHSA-chqc-8p9q-pq6q) is incomplete. Two code paths bypass the
protectWhitespace()control character check: (1) thelogin()method directly concatenates user-supplied credentials into USER/PASS FTP commands without any validation, and (2) the_openDir()method sends an MKD command beforecd()invokesprotectWhitespace(), creating a TOCTOU bypass. Both vectors allow an attacker who controls input to inject arbitrary FTP commands into the control connection.Details
Vector 1: Credential Injection (login)
The
login()method constructs FTP commands by direct string concatenation with no CRLF validation:FtpContext.send()writes directly to the TCP socket:The
protectWhitespace()method (line 762) rejects\r,\n, and\0characters — but it is only called for path-based operations. Credentials never pass through it.The public
access()method (line 268) passesoptions.userandoptions.passworddirectly tologin()with no sanitization.Vector 2: MKD TOCTOU Bypass (_openDir)
The
_openDir()method sends an MKD command before the CRLF check incd():This is called from
ensureDir()(line 729) which splits a user-supplied remote path by/and passes each fragment to_openDir(), and from_uploadToWorkingDir()(line 679) which passes local directory names read from the filesystem.PoC
Vector 1: Credential Injection
Vector 2: MKD TOCTOU Bypass
Impact
An attacker who controls credentials or remote paths passed to basic-ftp can inject arbitrary FTP commands into the control connection. This enables:
DELEcommands to remove files on the FTP serverRNFR/RNTOto rename files,MKD/RMDto create/remove directoriesSITEcommands (e.g.,SITE CHMOD) to change permissionsUSER/PASSto re-authenticate as a different userThe credential injection vector (Vector 1) is particularly dangerous because it occurs before authentication, meaning the injected commands execute with whatever default permissions the server grants during the login handshake.
Applications that accept user-supplied FTP credentials (e.g., web-based file managers, backup tools, deployment systems) are directly vulnerable.
Recommended Fix
Add CRLF validation to both code paths:
1. Validate credentials in
login():2. Validate dirName in
_openDir()before sending MKD:Alternatively, centralize CRLF validation in
FtpContext.send()so that all FTP commands are protected regardless of the calling code path.Release Notes
patrickjuchli/basic-ftp (basic-ftp@<5.2.0)
v5.2.2Compare 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.