Skip to content

← Public intelligence

PyPI package

spotipy

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

3 actionable advisories, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. Low, CVSS 3.6PyPIAmendedPublished

    Spotipy has a XSS vulnerability in its OAuth callback server

    CVE-2025-66040 · GHSA-r77h-rpp9-w2xm

    Affected
    • PyPI spotipy < 2.25.2
    Fixed in
    2.25.2· Vendor fix available
    Issue
    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.doGET) 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: Then embedded in HTML at line 1265: The error parameter comes from URL parsing (lines 388-393) without HTML escaping, allowing script injection. Attack Flow: 1. User starts OAuth authentication → local server runs on http://127.0.0.1:8080 2. Attacker crafts malicious URL: http://127.0.0.1:8080/?error=<scriptalert(1)</script&state=x 3. User visits URL → JavaScript executes in localhost origin PoC Simple Python Test: Run it: Output shows: The Proof: - Expected (safe):…

    Recommended action: Upgrade to 2.25.2 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  2. High, CVSS 8.4PyPIAmendedPublished

    Spotipy's cache file, containing spotify auth token, is created with overly broad permissions

    CVE-2025-27154 · GHSA-pwhh-q4h6-w599

    Affected
    • PyPI spotipy < 2.25.1
    Fixed in
    2.25.1· Vendor fix available
    Issue
    The CacheHandler class creates a cache file to store the auth token here: https://github.com/spotipy-dev/spotipy/blob/master/spotipy/cachehandler.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. Details 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. PoC Run an application that uses spotipy with client creation like this: And then check the file permissions on the cache file that was created with: 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…

    Recommended action: Upgrade to 2.25.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  3. Medium, CVSS 5.4PyPIAmendedPublished

    Path traversal in spotipy

    CVE-2023-23608 · GHSA-q764-g6fm-555v

    Affected
    • PyPI spotipy < 2.22.1
    Fixed in
    2.22.1· Vendor fix available
    Issue
    If a malicious URI is passed to the library, the library can be tricked into performing an operation on a different API endpoint than intended. Details The code Spotipy uses to parse URIs and URLs accepts user data too liberally which allows a malicious user to insert arbitrary characters into the path that is used for API requests. Because it is possible to include .., an attacker can redirect for example a track lookup via spotifyApi.track() to an arbitrary API endpoint like playlists, but this is possible for other endpoints as well. Before the security advisory feature was enabled on GitHub, I was already in contact with Stéphane Bruckert via e-mail, and he asked me to look into a potential fix. My recommendation is to perform stricter parsing of URLs and URIs, which I implemented in the patch included at the end of the report. If you prefer, I can also invite you to a private fork of the repository. Impact The impact of this vulnerability depends heavily on what…

    Recommended action: Upgrade to 2.22.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →