# CVE-2023-23608: spotipy Path traversal vulnerability that may lead to type confusion in URI handling code

> Attackers can manipulate URIs to redirect API requests to unintended endpoints, potentially exposing or modifying data.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 24 Jan 2023
- **Updated:** 10 Mar 2025
- **Also known as:** GHSA-q764-g6fm-555v, PYSEC-2026-926

## What is CVE-2023-23608?

CVE-2023-23608 is a path traversal vulnerability in spotipy-dev spotipy, published on 24 Jan 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Spotipy is a light weight Python library for the Spotify Web API. In versions prior to 2.22.1, 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. The code Spotipy uses to parse URIs and URLs allows an attacker 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. The impact of this vulnerability depends heavily on what operations a client application performs when it handles a URI from a user and how it uses the responses it receives from the API. This issue is patched in version 2.22.1.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2023-23608?

3 open source packages ship an affected version, including spotipy. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `spotipy` | PyPI | All versions | 2.22.1 |
| `spotipy` | PyPI | All versions | 2.22.1 |
| `spotipy` | PyPI | All versions | 2.22.1 |

Products: Spotipy Project Spotipy.

## How do I fix CVE-2023-23608?

Upgrade spotipy to 2.22.1 or later.

## Is CVE-2023-23608 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-23608 exists.

## Other vulnerabilities in spotipy-dev spotipy

- [CVE-2025-27154](https://insights.sbomify.com/CVE-2025-27154/): Spotipy's cache file, containing spotify auth token, is created with overly broad permissions (high 8.4)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-23608 and fix it if it is affected.

What it is: CVE-2023-23608 is a path traversal vulnerability in spotipy-dev spotipy, published on 24 Jan 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-23608 exists.

Affected packages and fixed versions:
- spotipy (PyPI): affected all versions; fixed in 2.22.1
- spotipy (PyPI): affected all versions; fixed in 2.22.1
- spotipy (PyPI): affected all versions; fixed in 2.22.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-23608/ (Markdown: https://insights.sbomify.com/CVE-2023-23608/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-23608
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-23608
- OSV: https://osv.dev/vulnerability/CVE-2023-23608

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-23608/
Summaries are generated and may contain mistakes; the official description above is the record.
