CVE-2023-51442: Github.com/navidrome/navidrome Authentication Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-wq59-4q6r-635r
CVSS 8.6
CWE-287
Published
Advisory Summary

CVE-2023-51442 is a HIGH (CVSS 8.6) authentication bypass vulnerability (CWE-287: Improper Authentication) affecting Github.com/navidrome/navidrome libraries in the Go ecosystem. The issue involves authentication bypass vulnerability in navidrome's subsonic endpoint. Remediation is available by upgrading affected packages to version 0.50.2.

CVE-2023-51442 at a Glance

CVE Identifier CVE-2023-51442
GHSA Identifier GHSA-wq59-4q6r-635r
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-287: Improper Authentication
Affected Product Github.com/navidrome/navidrome
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability High (A:H)

How to Fix CVE-2023-51442

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

github.com/navidrome/navidrome fixed: 0.50.2
Upgrade github.com/navidrome/navidrome to 0.50.2
Verify Direct and Transitive Dependencies

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

inspect dependencies for github.com/navidrome/navidrome

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-51442, inspect your project dependencies for Github.com/navidrome/navidrome:

inspect dependencies for github.com/navidrome/navidrome

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Github.com/navidrome/navidrome, 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 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.

CVE-2023-51442 Affected Github.com/navidrome/navidrome Versions

1 component(s)
Fixed Versions:
0.50.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/navidrome/navidrome
Go
< 0.50.2
0.50.2

References

Frequently Asked Questions

What is CVE-2023-51442?
CVE-2023-51442 is a security vulnerability in Github.com/navidrome/navidrome involving Authentication bypass vulnerability in navidrome's subsonic endpoint under CWE-287: Improper Authentication.
Which Github.com/navidrome/navidrome versions are affected?
Affected versions include releases prior to 0.50.2 across affected packages: github.com/navidrome/navidrome.
What version fixes CVE-2023-51442?
Upgrading to 0.50.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/navidrome/navidrome affected?
Yes, github.com/navidrome/navidrome is affected in releases prior to 0.50.2. Upgrade your dependency to 0.50.2 or later.
What is the CVSS score of CVE-2023-51442?
CVE-2023-51442 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H.
What CWE is associated with CVE-2023-51442?
CVE-2023-51442 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check Go dependencies for CVE-2023-51442?
Run the dependency tree command: 'inspect dependencies for github.com/navidrome/navidrome'. 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-wq59-4q6r-635r",
  "modified" : "2023-12-21T15:58:09Z",
  "published" : "2023-12-19T23:37:45Z",
  "aliases" : [ "CVE-2023-51442" ],
  "summary" : "Authentication bypass vulnerability in navidrome's subsonic endpoint",
  "details" : "### Summary\n\nA 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\".\n\nThe vulnerability can only be exploited on instances that have never been restarted.\n\n### Details\n\nNavidrome 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).\n\nDuring 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\".\n\nA 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.\n\nThe 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.\n\nAfter navidrome is restarted, the random key generated during the previous startup is loaded and the flaw becomes inexploitable.\n\n### PoC\n\nGenerate 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).\n\n```\n$ podman run -d --name navidrome -p 127.0.0.1:4533:4533 -e ND_DEVAUTOCREATEADMINPASSWORD=password docker.io/deluan/navidrome:0.50.1\n$ curl \"http://localhost:4533/rest/ping.view?c=dummy&v=1&u=admin&jwt=$JWT\"\n<subsonic-response xmlns=\"http://subsonic.org/restapi\" status=\"ok\" version=\"1.16.1\" type=\"navidrome\" serverVersion=\"0.50.1 (f69c27d1)\" openSubsonic=\"true\"></subsonic-response>\n```\n\nThe `ND_DEVAUTOCREATEADMINPASSWORD` parameter does not influence the bypass, it also works if the admin or extra users are created manually after starting navidrome.\n\nRestarting navidrome prevents the bypass:\n\n```\n$ podman restart navidrome\n$ curl \"http://localhost:4533/rest/ping.view?c=dummy&v=1&u=admin&jwt=$JWT\"\n<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>\n```\n\n### Impact\n\nThis 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).\n\nThe 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.\n\nFor 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/navidrome/navidrome"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.50.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.50.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/navidrome/navidrome/security/advisories/GHSA-wq59-4q6r-635r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-51442"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/navidrome/navidrome/commit/1132abb0135d1ecaebc41ed97a1e908a4ae02f7c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/navidrome/navidrome"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-12-19T23:37:45Z",
    "nvd_published_at" : "2023-12-21T15:15:13Z"
  }
}