Skip to content

rclone: PowerShell Smart-Quote Filename Injection Enables SFTP Server-Side Command Execution

High severity GitHub Reviewed Published Jul 31, 2026 in rclone/rclone • Updated Aug 5, 2026

Package

gomod github.com/rclone/rclone (Go)

Affected versions

<= 1.74.4

Patched versions

1.75.0

Description

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 commands
    • backend/sftp/sftp.go:1663-1699Fs.run
    • backend/sftp/sftp.go:1988-2067Object.Hash
    • backend/sftp/sftp.go:2071-2090quoteOrEscapeShellPath
  • 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-Content statement created a marker file.
  • The stronger test invoked the exact production Object.Hash path and MD5 PowerShell command against a fake SSH session backed by local PowerShell.
  • A valid prefix file allowed Get-FileHash to 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:

  1. Configure an SFTP remote whose command shell is PowerShell.
  2. Enable or autodetect the PowerShell hash command.
  3. Place a file whose name contains a smart quote followed by a harmless marker-writing statement and PowerShell comment syntax.
  4. Trigger an rclone operation that calculates the remote hash.
  5. 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.

References

@ncw ncw published to rclone/rclone Jul 31, 2026
Published to the GitHub Advisory Database Aug 5, 2026
Reviewed Aug 5, 2026
Last updated Aug 5, 2026

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(20th percentile)

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.

CVE ID

CVE-2026-71312

GHSA ID

GHSA-2m8m-jhrm-w6j2

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.