GHSA-2M8M-JHRM-W6J2

Vulnerability from github – Published: 2026-08-05 20:37 – Updated: 2026-08-05 20:37
VLAI
Summary
rclone: PowerShell Smart-Quote Filename Injection Enables SFTP Server-Side Command Execution
Details

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.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 1.74.4"
      },
      "package": {
        "ecosystem": "Go",
        "name": "github.com/rclone/rclone"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.75.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-71312"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-78"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-08-05T20:37:56Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "## 1. Summary\n\nrclone 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\u0027s SSH account.\n\n## 2. Affected Assets \u0026 Attack Surface\n\n- Audited commit: `a0c09f1381ae93e2a9a33c529d170186c61ad058`\n- Backend: `backend/sftp`\n- Relevant code:\n  - `backend/sftp/sftp.go:1802-1812` \u2014 PowerShell hash commands\n  - `backend/sftp/sftp.go:1663-1699` \u2014 `Fs.run`\n  - `backend/sftp/sftp.go:1988-2067` \u2014 `Object.Hash`\n  - `backend/sftp/sftp.go:2071-2090` \u2014 `quoteOrEscapeShellPath`\n- Exposed input: remote filename controlled by an SFTP collaborator, upstream storage source, or other party able to create or rename files.\n- Required execution context: PowerShell as the SSH command shell, SSH exec enabled, and server-side hashing invoked.\n\n## 3. Technical Root Cause Analysis\n\nFor PowerShell, `quoteOrEscapeShellPath` wraps a path in ASCII apostrophes and doubles only `U+0027`:\n\n```go\nreturn \"\u0027\" + strings.ReplaceAll(shellPath, \"\u0027\", \"\u0027\u0027\") + \"\u0027\", nil\n```\n\nWindows 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.\n\nThe security boundary fails because shell syntax is constructed by string concatenation rather than passing data through a non-code channel.\n\n## 4. Proof-of-Concept \u0026 Evidence\n\n- Each of the four Unicode smart quotes was passed through the production quoting function and used to terminate the path literal.\n- A harmless injected `Set-Content` statement created a marker file.\n- The stronger test invoked the exact production `Object.Hash` path and MD5 PowerShell command against a fake SSH session backed by local PowerShell.\n- A valid prefix file allowed `Get-FileHash` to complete; the appended statement then executed.\n- The filename used only characters permitted by Windows filesystems and did not depend on slash, colon, pipe, or ASCII apostrophe.\n- The focused test passed normally and under Go\u0027s race detector.\n\nReproduction outline:\n\n1. Configure an SFTP remote whose command shell is PowerShell.\n2. Enable or autodetect the PowerShell hash command.\n3. Place a file whose name contains a smart quote followed by a harmless marker-writing statement and PowerShell comment syntax.\n4. Trigger an rclone operation that calculates the remote hash.\n5. Observe the marker created with the SSH account\u0027s permissions.\n\n## 5. Impact Assessment\n\nSuccessful exploitation provides arbitrary command execution as the victim\u0027s SSH account. This can permit file theft, modification, deletion, credential access, persistence, and lateral movement allowed by that account.\n\nThe attacker needs filename-control capability but does not need the victim\u0027s SSH credentials or an interactive shell. The rclone user\u0027s hash operation supplies the execution step.",
  "id": "GHSA-2m8m-jhrm-w6j2",
  "modified": "2026-08-05T20:37:56Z",
  "published": "2026-08-05T20:37:56Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/rclone/rclone/security/advisories/GHSA-2m8m-jhrm-w6j2"
    },
    {
      "type": "WEB",
      "url": "https://github.com/rclone/rclone/commit/e122fba1a57641b63a580aa26c026903a84e2e88"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/rclone/rclone"
    },
    {
      "type": "WEB",
      "url": "https://github.com/rclone/rclone/releases/tag/v1.75.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "rclone: PowerShell Smart-Quote Filename Injection Enables SFTP Server-Side Command Execution"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…