Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS13cTU5LTRxNnItNjM1cs4AA360

Authentication bypass vulnerability in navidrome's subsonic endpoint

Summary

A security vulnerability has been identified in navidrome's subsonic endpoint, allowing for authentication bypass. This exploit enables unauthorized access to any known account by utilizing a JSON Web Token (JWT) signed with the key "not so secret".

The vulnerability can only be exploited on instances that have never been restarted.

Details

Navidrome supports an extension to the subsonic authentication scheme, where a JWT can be provided using a jwt query parameter instead of the traditional password or token and salt (corresponding to resp. the p or t and s query parameters).

During the first initialization, navidrome generates a random key that is then used by the authentication module to validate JWTs before extracting the username from the sub claim. If for some reason the key cannot be retrieved by the initialization code, a hardcoded value is used instead: "not so secret".

A bug in the order of operations during navidrome startup results in the authentication module initializing before the module responsible for generating and persisting the random key. As a consequence, the authentication module falls back to using the hardcoded value, which remains in use until the instance gets restarted. Additionally, an error that was meant to be logged when the fallback value is used does not get logged due to another bug, preventing the operator from becoming aware of the issue.

The flaw allows the creation of a JWT with the sub claim set to any existing user on the server, signed with the key "not so secret", which can then be used to authenticate against the subsonic endpoint with the chosen user's privileges.

After navidrome is restarted, the random key generated during the previous startup is loaded and the flaw becomes inexploitable.

PoC

Generate a JWT token with the subject "admin", and key "not so secret" (e.g. online on: http://jwtbuilder.jamiekurtz.com; the other parameters can be left in, it doesn't seem that navidrome validates anything). In a shell, assign the token to the variable JWT (for the curl commands below).

$ podman run -d --name navidrome -p 127.0.0.1:4533:4533 -e ND_DEVAUTOCREATEADMINPASSWORD=password docker.io/deluan/navidrome:0.50.1
$ curl "http://localhost:4533/rest/ping.view?c=dummy&v=1&u=admin&jwt=$JWT"
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.16.1" type="navidrome" serverVersion="0.50.1 (f69c27d1)" openSubsonic="true"></subsonic-response>

The ND_DEVAUTOCREATEADMINPASSWORD parameter does not influence the bypass, it also works if the admin or extra users are created manually after starting navidrome.

Restarting navidrome prevents the bypass:

$ podman restart navidrome
$ curl "http://localhost:4533/rest/ping.view?c=dummy&v=1&u=admin&jwt=$JWT"
<subsonic-response xmlns="http://subsonic.org/restapi" status="failed" version="1.16.1" type="navidrome" serverVersion="0.50.1 (f69c27d1)" openSubsonic="true"><error code="40" message="Wrong username or password"></error></subsonic-response>

Impact

This authentication bypass vulnerability potentially affects all instances that don't protect the subsonic endpoint /rest/, which is expected to be most instances in a standard deployment, and most instances in the reverse proxy setup too (as the documentation mentions to leave that endpoint unprotected).

The impact is limited by the fact that the flaw becomes inexploitable after a first restart, and the attacker needs to know the username of existing users on the instance.

For each known user, the attacker could mess with (create/delete/change) playlists, bookmarks, media annotations, shares (which are currently global) and radios. He is also able to get the user's email address (which is PII) with the getUser operation. And lastly he can use the media retrieval operations which could potentially affect the availability of the system.

Permalink: https://github.com/advisories/GHSA-wq59-4q6r-635r
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS13cTU5LTRxNnItNjM1cs4AA360
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 4 months ago
Updated: 4 months ago


CVSS Score: 8.6
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H

Identifiers: GHSA-wq59-4q6r-635r, CVE-2023-51442
References: Repository: https://github.com/navidrome/navidrome
Blast Radius: 0.0

Affected Packages

go:github.com/navidrome/navidrome
Dependent packages: 0
Dependent repositories: 1
Downloads:
Affected Version Ranges: <= 0.50.1
Fixed in: 0.50.2
All affected versions: 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.13.0, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.14.5, 0.15.0, 0.16.0, 0.16.1, 0.17.0, 0.18.0, 0.19.0, 0.20.0, 0.21.0, 0.22.0, 0.23.0, 0.23.1, 0.24.0, 0.25.0, 0.26.0, 0.26.1, 0.27.0, 0.28.0, 0.29.0, 0.30.0, 0.30.1, 0.31.0, 0.32.0, 0.33.0, 0.34.0, 0.34.1, 0.35.0, 0.35.1, 0.36.0, 0.36.1, 0.37.0, 0.38.0, 0.39.0, 0.40.0, 0.41.0, 0.41.1, 0.42.0, 0.42.1, 0.43.0, 0.44.0, 0.44.1, 0.45.0, 0.45.1, 0.46.0, 0.47.0, 0.47.5, 0.48.0, 0.49.0, 0.49.1, 0.49.2, 0.49.3, 0.50.0, 0.50.1
All unaffected versions: 0.50.2, 0.51.0, 0.51.1