CVE-2025-27154·Python vulnerability
Spotipy is a lightweight Python library for the Spotify Web API. The `CacheHandler` class creates a cache file to store the auth token. Prior to version 2.25.1, the file created has `rw-r--r--` (644) permissions by default, when it could be locked down to `rw-------` (600) permissions. This leads to overly broad exposure of the spotify auth token. If this token can be read by an attacker (another user on the machine, or a process running as another user), it can be used to perform administrative actions on the Spotify account, depending on the scope granted to the token. Version 2.25.1 tightens the cache file permissions.
- Severity
- critical
- Software
- Python
- Fixed in
- 2.25.1
- Published
- 2025-02-27
Affected versions
Until: 2.25.1
Fixed in: 2.25.1
How to fix this CVE
Update the Spotipy library to version 2.25.1 or later to remediate insecure cache file permissions that expose Spotify authentication tokens. The vulnerability allows other users or processes on the same system to read cached credentials with overly permissive (644) file modes. Upgrade immediately if your application uses Spotipy for Spotify API authentication, as compromised tokens enable attackers to perform administrative actions on linked Spotify accounts.
sudo dnf upgrade python3-spotipyDefensia detects this vulnerability
How to check if you are affected
- Check Spotipy version: pip show spotipy | grep Version
- Identify Spotipy cache directory: find ~/.cache -name '*spotipy*' -o find ~/.spotipy -type f 2>/dev/null
- Verify cache file permissions: ls -la ~/.cache/spotipy* or ls -la ~/.spotipy* (should show 600 or rw------- after patching, not 644 or rw-r--r--)
- Confirm patch applied: pip show spotipy | grep -q '2.25.1' && echo 'Patched' || echo 'Vulnerable'
FAQ
What is CVE-2025-27154?
CVE-2025-27154 is a file permission vulnerability in Spotipy's CacheHandler class that creates authentication token cache files with world-readable permissions (644), allowing local system users to steal and misuse Spotify API credentials.
Is CVE-2025-27154 being actively exploited?
No, this vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits are available, though the risk remains high for multi-user systems.
What versions of Spotipy are affected by CVE-2025-27154?
All versions of Spotipy prior to 2.25.1 are affected; version 2.25.1 and later restrict cache file permissions to 600 (rw-------).
How do I check if my server is vulnerable to CVE-2025-27154?
Run: pip show spotipy | grep Version && stat -c '%a' ~/.spotipy* 2>/dev/null — if the version is below 2.25.1 and file permissions show 644, the system is vulnerable.
Does Defensia detect CVE-2025-27154?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Spotipy is installed on a monitored server, CVE-2025-27154 will appear in your dashboard with remediation steps.
Related Python CVEs
References
- https://github.com/spotipy-dev/spotipy/blob/master/spotipy/cache_handler.py#L93-L98
- https://github.com/spotipy-dev/spotipy/commit/1ca453f6ef87a2a9e9876f52b6cb38d13532ccf2
- https://github.com/spotipy-dev/spotipy/releases/tag/2.25.1
- https://github.com/spotipy-dev/spotipy/security/advisories/GHSA-pwhh-q4h6-w599
- https://github.com/spotipy-dev/spotipy/security/advisories/GHSA-pwhh-q4h6-w599
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2025-27154. Free for 1 server.
Get started free