Spotipy's cache file, containing spotify auth token, is created with overly broad permissions
The CacheHandler class creates a cache file to store the auth token here: https://github.com/spotipy-dev/spotipy/blob/master/spotipy/cache_handler.py#L93-L98
The file created has rw-r--r-- (644) permissions by default, when it could be locked down to rw------- (600) permissions. I think 600 is a sensible default.

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.
Run an application that uses spotipy with client creation like this:
```python
from pathlib import Path
import spotipy
from os import getenv
def create_spotify_client(client_id: str, client_secret: str) -> spotipy.Spotify:
"""Create and return an authenticated Spotify client.
Args:
client_id: Spotify API client ID
client_secret: Spotify API client secret
Returns:
An authenticated Spotify client instance
"""
cache_path = Path.home() / ".cache" / "spotify-backup/.auth_cache"
cache_path.parent.mkdir(parents=True, exist_ok=True)
cache_handler = spotipy.cache_handler.CacheFileHandler(cache_path=str(cache_path))
client = spotipy.Spotify(
auth_manager=spotipy.oauth2.SpotifyOAuth(
client_id=client_id,
client_secret=client_secret,
redirect_uri="http://localhost:8000/callback",
cache_handler=cache_handler,
scope=[
"user-library-read",
"playlist-read-private",
"playlist-read-collaborative",
],
)
)
return client
create_spotify_client()
```
And then check the file permissions on the cache file that was created with:
```bash
$ ls -la ~/.cache/spotify-backup/.auth_cache`
.rw-r--r--. alichtman alichtman 562 B Thu Feb 20 02:12:33 2025 /home/alichtman/.cache/spotify-backup/.auth_cache
```
If this issue is combined with another misconfiguration, like having o+r permissions set on your home directory, an attacker will be able to read this file and steal this auth token.
Good defense in depth would be to restrict read permissions on this cache file that contains an auth token
Potential exposure of Spotify auth token to other users with access to the machine. A worst case scenario is if the token is granted all permissions, and can be used to do any of:
If someone were to discover an RCE in Spotify that you could trigger on a machine by having a song played (or song metadata parsed or something), this auth token could maybe be used to add a song to a playlist, or control playback (allowing further exploitation).
This issue can be reached with local access to the system, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. Rated impact: confidentiality high, integrity high, availability none.
The score comes from this vector: CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
CVE-2025-27154 is classified as CWE-276: Incorrect Default Permissions. Files or resources are created with permissions that are broader than they need to be.
CVE-2025-27154 is recorded against 1 package.
Published on 28 February 2025 and last revised on 7 July 2026. A public exploit is known to exist, which raises the urgency of patching considerably. A vendor advisory or fix has been published. Record sourced from OSV.
github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Package)
github.com (Web)
github.com (Web)
spotipy has other advisories on record. If you are patching this one, these are worth checking on the same host:
These advisories are the same class of weakness (CWE-276: Incorrect Default Permissions) in other software:
Each distribution ships its own build and its own fixed version. Pick the one you run:
Details
CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| spotipy | — | 2.25.1 |
References
Similar Threats
Exploit Protection
CVE-2025-27154 carries CVSS 8.0 High rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.
Check My Site For CVE-2025-27154 →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.
Stay up to date with the latest from Boteraser.
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Manage your cookie preferences below:
Essential cookies enable basic functions and are necessary for the proper function of the website.
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
You can find more information in our Cookie Policy and Privacy Policy.