CVE-2026-71312
This vulnerability in rclone's PowerShell path handling stems from a fundamental mismatch: the quoteOrEscapeShellPath function attempts to sanitize filenames by escaping ASCII single quotes, but PowerShell's lexer treats multiple Unicode quotation marks (U+2018, U+2019, U+201A, U+201B) as equivalent delimiters to the ASCII apostrophe. These Unicode quotes bypass the escape logic entirely because rclone never accounts for them in its character substitution. The attack surface is specific and noteworthy: it targets hash operations where rclone constructs a PowerShell command string via the -Command flag and passes it to the shell. This -Command parsing re-lexes the entire string through PowerShell's tokenizer, which is precisely where Unicode quotes become structural delimiters. A compromised or malicious SFTP server can supply filenames containing these Unicode quotes, and rclone will pass them unescaped into a PowerShell command that then interprets them as quote delimiters — enabling injection. The correct remediation is not enumerating more quote characters; that's a whack-a-mole game with no end. Instead, rclone should use PowerShell's literal-path mechanisms that bypass quote interpretation entirely. The -LiteralPath parameter (available on most path-related cmdlets) treats the entire argument as a literal string with no lexical interpretation. Where -LiteralPath isn't available, here-strings ($'...') provide a more architecturally honest approach because they explicitly acknowledge content is being handed to a different lexer with different delimiter rules. However, there's a deeper architectural problem worth addressing: rclone's design interpolates Go strings into PowerShell commands, requiring developers to accurately model PowerShell's lexer from within Go. This is the same class of failure that produced SQL injection despite parameterized queries existing. Consider whether the long-term fix involves structured IPC (passing arguments as discrete argv entries rather than -Command strings) to eliminate the translation layer entirely.
Reviewed through automated stages and approved by a human before publication.