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.
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:
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.