GHSA-gx4c-2hqx-cw2r is a low-severity (CVSS 3.1) CWE-319 vulnerability in github.com/rclone/rclone. A fix is available for github.com/rclone/rclone — see the affected versions and patch details below.
rclone: S3 backend does not strip X-Amz-Security-Token on a same-host HTTPS->HTTP redirect
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-gx4c-2hqx-cw2r.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-gx4c-2hqx-cw2r plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 377,166 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
github.com/rclone/rcloneReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Vulnerability Details
File: backend/s3/s3.go
Lines: 1359-1380 (functions s3CheckRedirect / s3RedirectCrossesHost)
Root Cause
Commit e7b1eb774 (released in v1.74.3) added a CheckRedirect policy for
the S3 HTTP client whose purpose is to strip the X-Amz-Security-Token
header (the AWS STS session token) whenever a redirect chain "crosses a
host", so the token isn't forwarded to an unintended origin.
s3RedirectCrossesHost decides this purely by comparing url.URL.Host
(hostname[:port]); it never looks at url.URL.Scheme. A redirect that keeps
the exact same host:port but changes the scheme from https:// to http://
therefore compares as "same host" and X-Amz-Security-Token is not
stripped — it is sent again, this time over plaintext HTTP.
func s3RedirectCrossesHost(req *http.Request, via []*http.Request) bool {
if len(via) == 0 {
return false
}
host := via[0].URL.Host
for _, redirect := range via[1:] {
if redirect.URL.Host != host {
return true
}
}
return host != req.URL.Host
}
Attack Scenario
- The user configures an
s3remote (or--s3-endpointpointing at a self-hosted/third-party S3-compatible service) using temporary credentials that include an STSsession_token(common for assumed-role / CI / Kubernetes IRSA setups). - The configured endpoint responds to a request with a 3xx redirect to the
same host:port but with
http://instead ofhttps://(TLS-front misconfiguration, maintenance redirect, or a malicious/compromised storage provider trying to harvest the token). - rclone's S3 HTTP client follows the redirect and re-sends the request,
including
X-Amz-Security-Token, over the now-unencrypted connection to that same host. - Any passive observer on that now-plaintext network path can read the STS session token from the request headers.
Impact
Disclosure of the AWS STS session token (X-Amz-Security-Token) in
cleartext for the remainder of its validity window. This is the exact class
of leak that e7b1eb774 was written to close — it just doesn't cover the
scheme-downgrade axis of "crossing a host".
Vulnerable Code
func s3RedirectCrossesHost(req *http.Request, via []*http.Request) bool {
if len(via) == 0 {
return false
}
host := via[0].URL.Host
for _, redirect := range via[1:] {
if redirect.URL.Host != host {
return true
}
}
return host != req.URL.Host
}
Recommended Fix
Also compare URL.Scheme, so a scheme downgrade on the same host is treated
the same as a host change:
func s3RedirectCrossesHost(req *http.Request, via []*http.Request) bool {
if len(via) == 0 {
return false
}
scheme, host := via[0].URL.Scheme, via[0].URL.Host
for _, redirect := range via[1:] {
if redirect.URL.Host != host || redirect.URL.Scheme != scheme {
return true
}
}
return host != req.URL.Host || scheme != req.URL.Scheme
}
Verification
Added a unit test (backend/s3/redirect_scheme_test.go) that calls the real,
unmodified s3RedirectCrossesHost / s3CheckRedirect with an
https://bucket.example.com -> http://bucket.example.com redirect chain.
On unpatched code (commit 16091ce365, current master / v1.74.3):
s3RedirectCrossesHostreturnsfalses3CheckRedirectleavesX-Amz-Security-Token: SECRET-SESSION-TOKENintact on the outgoing (plaintext) request.
=== RUN TestSchemeDowngradeNotDetectedAsCrossHost
redirect_scheme_test.go:23: initial=https://bucket.example.com final=http://bucket.example.com s3RedirectCrossesHost=false
--- PASS: TestSchemeDowngradeNotDetectedAsCrossHost (0.00s)
After applying the one-line fix above (also adding scheme comparison), the
token is correctly stripped and all existing redirect tests
(TestClientRemovesSecurityTokenOnCrossHostRedirect,
TestClientDoesNotRestoreSecurityTokenAfterCrossHostRedirect,
TestClientKeepsSecurityTokenOnSameHostRedirect,
TestClientStopsAfterTenRedirects) continue to pass.
A minimal fix commit is ready and can be pushed to a private fork once this report is acknowledged.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/rclone/rclone | all versions | 1.74.4go get github.com/rclone/rclone@v1.74.4 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/rclone/rclone, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/rclone/rclone to 1.74.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-gx4c-2hqx-cw2r is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-gx4c-2hqx-cw2r can be triaged on real exposure rather than presence alone.
Tailored to GHSA-gx4c-2hqx-cw2r. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-gx4c-2hqx-cw2r in your dependencies?
O3 Security finds GHSA-gx4c-2hqx-cw2r across Go dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.