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

rclone's PowerShell path quoting only escapes ASCII apostrophes, so a filename with a Unicode smart quote breaks out of the quoted literal and executes PowerShell as the SSH account.

- Payout: Research
- Severity: high
- Program: rclone
- Found by: cyberlanc3r
- Disclosed: 2026-08-05
- CVE: CVE-2026-71312
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-2m8m-jhrm-w6j2
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-2m8m-jhrm-w6j2
- Tags: area:oss domain:oss impact:rce kind:research platform:ghsa sev:high tech:go tech:windows technique:source-review technique:unicode-normalization vuln:command-injection

**Target:** rclone SFTP backend PowerShell hash command construction
**Root cause:** quoteOrEscapeShellPath wraps paths in ASCII apostrophes and doubles only U+0027, but PowerShell also treats U+2018/U+2019/U+201A/U+201B as single-quote delimiters, letting an attacker-controlled filename close the literal and append statements.
**Steps:**
1. Configure an SFTP remote whose SSH command shell is PowerShell and enable/autodetect the PowerShell hash command.
2. Create a remote file whose name contains a smart quote (U+2018/U+2019/U+201A/U+201B) followed by a PowerShell statement and comment syntax.
3. Trigger an rclone operation that computes the remote hash (Object.Hash -> Fs.run -> SSH exec).
4. Observe the injected statement execute with the SSH account's permissions (e.g. marker file via `Set-Content`).
**How found:** Code review of the quoting helper: noticed it only escapes ASCII apostrophe while PowerShell accepts four Unicode smart quotes as delimiters; validated each of the four by passing them through the production quoting function and the real Object.Hash/MD5 PowerShell command against a fake SSH session backed by local PowerShell.
**Exploitation:** Attacker with filename-control on the SFTP server (collaborator, upstream storage source) names a file with a smart quote plus PowerShell payload; when the victim runs a hash operation, rclone interpolates the path into the PowerShell hash command sent over SSH exec, terminating the literal and running the appended statement as the victim's SSH account.
**Insight:** When a quoting routine targets a specific shell, enumerate that shell's full delimiter set — PowerShell accepts Unicode smart quotes as single-quote delimiters, so ASCII-only escaping is bypassable with filenames legal on Windows filesystems.

