Описание
Swing Music has a Directory Traversal & Filesystem can be accessed by a non-admin user
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:
PoC
- Create a non-admin user
- Authenticate as a non-admin user
- Send the following request:
- The response will list directories from
/proc/selfinstead of restricting to user-accessible paths:
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
Пакеты
swingmusic
< 2.1.4
2.1.4
Связанные уязвимости
Swing Music is a self-hosted music player for local audio files. Prior to version 2.1.4, 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. Version 2.1.4 fixes the issue.