Summary
Rclone's SFTP server with --auth-proxy can confuse cached authentication results because its cache key does not include the authentication method. An attacker who knows a victim's base64 public key and can make a request from the same client IP may reuse a cached entry to gain read-write VFS access.
Affected context
The issue affects Rclone's serve sftp --auth-proxy authentication flow in versions from 1.51.0 to before 1.76.0. It becomes risky when authentication results are cached using a key that does not distinguish authentication methods, and an attacker can meet the conditions for reusing a victim's cached entry.
Exploit preconditions
- Attack surface: Rclone's SFTP service running with
--auth-proxy - Required access: Knowledge of the victim's base64 public key and the ability to make a request from the same client IP
- Trigger point: An authentication attempt using the public key value as a password
- Why exploitation is possible: The cache key omits the authentication method, allowing a cached result for one method to be reused for another
Why this happens
The authentication cache key is generated without including the method used to authenticate. As a result, requests with different authentication methods can map to the same cached entry. This is an authentication bypass pattern associated with CWE-287: Improper Authentication, because the system may accept a cached authentication result without correctly verifying the current request's method and identity.
Potential impact
- An attacker may gain unauthorized read-write access to the VFS
- Confidential files could be read or copied
- Files could be modified, added, or deleted
- Data integrity and service availability could be affected
General mitigation guidance
Defensive patterns focus on ensuring that cached authentication decisions are bound to the full security context of each request.
- Include the authentication method and relevant identity and client context in cache keys
- Avoid reusing authentication results across distinct authentication flows
- Apply short, appropriate lifetimes to authentication cache entries and invalidate them when relevant credentials or policy change
- Limit VFS permissions and service access according to least privilege
- Reduce trust in client-supplied identity data by validating it through the configured authentication authority
How teams detect issues like this
- Review authentication cache-key generation for omitted identity, method, or request-context fields
- Use static analysis or code review checks to flag cache lookups shared across distinct authentication paths
- Monitor for SFTP authentication attempts where a public-key value is presented through a different authentication method
- Audit authentication and file-operation logs for unexpected read-write access associated with cached sessions
- Enforce policies that require authentication decisions to be scoped to the current method and principal

