Summary
rclone: PowerShell Smart-Quote Filename Injection Enables SFTP Server-Side Command Execution
1. Summary
rclone interpolates remote SFTP paths into PowerShell hash commands. Its quoting helper escapes only ASCII apostrophe, although PowerShell accepts four Unicode smart quotes as single-quote delimiters. An attacker-controlled filename can therefore terminate the intended path literal and append PowerShell statements executed as the victim's SSH account.
2. Affected Assets & Attack Surface
- Audited commit:
a0c09f1381ae93e2a9a33c529d170186c61ad058 - Backend:
backend/sftp - Relevant code:
backend/sftp/sftp.go:1802-1812, PowerShell hash commandsbackend/sftp/sftp.go:1663-1699,Fs.runbackend/sftp/sftp.go:1988-2067,Object.Hashbackend/sftp/sftp.go:2071-2090,quoteOrEscapeShellPath
- Exposed input: remote filename controlled by an SFTP collaborator, upstream storage source, or other party able to create or rename files.
- Required execution context: PowerShell as the SSH command shell, SSH exec enabled, and server-side hashing invoked.
3. Technical Root Cause Analysis
For PowerShell, quoteOrEscapeShellPath wraps a path in ASCII apostrophes and doubles only U+0027:
return "'" + strings.ReplaceAll(shellPath, "'", "''") + "'", nil
Windows PowerShell also treats U+2018, U+2019, U+201A, and U+201B as single-quote delimiters. Those characters pass through the rclone encoder and can close the quoted path. The completed string is sent as shell source through an SSH exec request.
The security boundary fails because shell syntax is constructed by string concatenation rather than passing data through a non-code channel.
4. Proof-of-Concept & Evidence
- Each of the four Unicode smart quotes was passed through the production quoting function and used to terminate the path literal.
- A harmless injected
Set-Contentstatement created a marker file. - The stronger test invoked the exact production
Object.Hashpath and MD5 PowerShell command against a fake SSH session backed by local PowerShell. - A valid prefix file allowed
Get-FileHashto complete; the appended statement then executed. - The filename used only characters permitted by Windows filesystems and did not depend on slash, colon, pipe, or ASCII apostrophe.
- The focused test passed normally and under Go's race detector.
Reproduction outline:
- Configure an SFTP remote whose command shell is PowerShell.
- Enable or autodetect the PowerShell hash command.
- Place a file whose name contains a smart quote followed by a harmless marker-writing statement and PowerShell comment syntax.
- Trigger an rclone operation that calculates the remote hash.
- Observe the marker created with the SSH account's permissions.
5. Impact Assessment
Successful exploitation provides arbitrary command execution as the victim's SSH account. This can permit file theft, modification, deletion, credential access, persistence, and lateral movement allowed by that account.
The attacker needs filename-control capability but does not need the victim's SSH credentials or an interactive shell. The rclone user's hash operation supplies the execution step.
Impact
Untrusted input reaches a shell command, allowing arbitrary commands to run on the host. Typical impact: code execution in the application's environment.
CVE-2026-71312 has a CVSS score of 8.0 (High). The vector is network-reachable, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.75.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-71312? CVE-2026-71312 is a high-severity OS command injection vulnerability in github.com/rclone/rclone (go), affecting versions <= 1.74.4. It is fixed in 1.75.0. Untrusted input reaches a shell command, allowing arbitrary commands to run on the host.
- How severe is CVE-2026-71312? CVE-2026-71312 has a CVSS score of 8.0 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/rclone/rclone are affected by CVE-2026-71312? github.com/rclone/rclone (go) versions <= 1.74.4 is affected.
- Is there a fix for CVE-2026-71312? Yes. CVE-2026-71312 is fixed in 1.75.0. Upgrade to this version or later.
- Is CVE-2026-71312 exploitable, and should I be worried? Whether CVE-2026-71312 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-71312 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-71312? Upgrade
github.com/rclone/rcloneto 1.75.0 or later.