CVE-2023-51665
Executive Summary
CVE-2023-51665 is a critical unauthenticated blind Server-Side Request Forgery (SSRF) vulnerability discovered in Audiobookshelf, a self-hosted audiobook and podcast server. The vulnerability resides within the Auth.js authentication module, allowing an unauthenticated attacker to force the server to make arbitrary HTTP requests to internal or external resources. This can lead to internal network reconnaissance, port scanning, and potential access to cloud metadata endpoints (e.g., AWS, GCP). The vulnerability is present in all versions prior to 2.7.0. No public proof-of-concept (PoC) or exploit code has been released, and the EPSS score is 0.0%, indicating low exploitation activity in the wild. However, given the self-hosted nature of the software and the potential for internal network pivoting, this vulnerability poses a significant risk to organizations using Audiobookshelf.
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. The vulnerability is introduced through the Auth.js library, which is a direct dependency. The supply chain risk is moderate, as the vulnerable component is a widely used authentication library. Organizations should verify the integrity of their Audiobookshelf installation and ensure that no malicious packages have been introduced. The patch in version 2.7.0 addresses the SSRF vector within the authentication flow.
CVSS Breakdown & Threat Level
- CVSS Score: 4.3 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
- Attack Vector (AV): Network – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low – No special conditions are required.
- Privileges Required (PR): None – No authentication is needed.
- User Interaction (UI): None – No user action is required.
- Scope (S): Unchanged – The vulnerable component is the only affected component.
- Confidentiality (C): Low – Limited information disclosure (e.g., internal network mapping).
- Integrity (I): None – No data modification is possible.
- Availability (A): None – No denial of service is expected.
Threat Level: Medium. While the CVSS score is relatively low, the potential for internal network reconnaissance and cloud metadata access elevates the risk in cloud-native environments.
Deep Dive & Mechanics
The vulnerability is a blind SSRF in the Auth.js module. When a user initiates an authentication request (e.g., via OAuth or OpenID Connect), the server processes a URL provided by the client or derived from the authentication flow. Due to insufficient validation, an attacker can manipulate this URL to point to internal resources.
Technical Flow:
- An unauthenticated attacker sends a crafted authentication request to the Audiobookshelf server.
- The server's
Auth.jsmodule processes the request and attempts to fetch a resource from a URL that is partially controlled by the attacker. - The server makes an HTTP request to the attacker-specified URL (e.g.,
http://169.254.169.254/latest/meta-data/for AWS metadata). - The response is not directly returned to the attacker (blind SSRF), but the attacker can infer success or failure based on timing, error messages, or side-channel effects.
Impact:
- Internal network scanning (e.g., identifying live hosts, open ports).
- Access to cloud instance metadata (e.g., AWS, GCP, Azure) which may contain credentials.
- Potential to interact with internal services (e.g., databases, internal APIs) if the server has network access.
Vulnerable vs. Patched Code
The vulnerable code in Auth.js likely lacked proper validation of the redirect URI or the URL used during the authentication callback. The patch in version 2.7.0 introduces strict URL validation, ensuring that only allowed and safe URLs are processed.
Vulnerable Code (Conceptual):
// Vulnerable: No validation of the redirect URL
const redirectUrl = req.query.redirect_uri;
const response = await fetch(redirectUrl);
Patched Code (Conceptual):
// Patched: Validate the redirect URL against an allowlist
const allowedHosts = ['localhost', '127.0.0.1', '::1'];
const redirectUrl = new URL(req.query.redirect_uri);
if (!allowedHosts.includes(redirectUrl.hostname)) {
throw new Error('Invalid redirect URL');
}
const response = await fetch(redirectUrl);
Exploitation & Lab Setup
Red Team
Prerequisites:
- A vulnerable Audiobookshelf instance (version < 2.7.0).
- Network access to the server.
Exploitation Steps:
- Identify the authentication endpoint (e.g.,
/auth/login). - Craft a request with a manipulated
redirect_uriparameter pointing to an internal resource. - Observe the server's behavior (e.g., response time, error messages) to infer the success of the SSRF.
Example Request:
curl -v "http://target:port/auth/login?redirect_uri=http://169.254.169.254/latest/meta-data/"
Expected Outcome: The server will attempt to fetch the AWS metadata endpoint. If successful, the attacker may not see the response directly but can use timing or error-based techniques to confirm.
Blue Team
Detection:
- Monitor outbound HTTP requests from the Audiobookshelf server to unusual IP addresses (e.g., 169.254.169.254, internal RFC 1918 addresses).
- Look for authentication requests with suspicious
redirect_uriparameters. - Use network segmentation to limit the server's outbound access.
Hunting:
- Search logs for requests containing
redirect_uriwith internal IP addresses or cloud metadata endpoints. - Analyze server-side fetch calls to unexpected hosts.
Indicators of Compromise (IOCs)
- Network IOCs:
- Outbound HTTP requests to
169.254.169.254,100.100.100.200(Alibaba Cloud), or other cloud metadata IPs. - Requests to internal IP addresses (e.g.,
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16) from the Audiobookshelf server.
- Outbound HTTP requests to
- Log IOCs:
- Authentication logs showing
redirect_uriparameters with non-standard URLs. - Error logs indicating failed connections to internal hosts.
- Authentication logs showing
- File IOCs:
- Modified
Auth.jsfiles (if an attacker has gained code execution).
- Modified
Detection Engineering
YARA Rule
rule CVE_2023_51665_SSRF_Audiobookshelf {
meta:
description = "Detects exploitation attempts of CVE-2023-51665 in Audiobookshelf logs"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2023-51665"
strings:
$s1 = "redirect_uri" nocase
$s2 = "169.254.169.254" nocase
$s3 = "metadata" nocase
$s4 = "internal" nocase
condition:
any of ($s*) and #s1 > 0
}
Sigma Rule
title: CVE-2023-51665 Audiobookshelf SSRF Detection
id: 8a4b3c2d-1e5f-6a7b-8c9d-0e1f2a3b4c5d
status: experimental
description: Detects potential SSRF exploitation attempts against Audiobookshelf
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains: "redirect_uri"
cs-uri-query|contains|any:
- "169.254.169.254"
- "100.100.100.200"
- "metadata.google.internal"
- "metadata.azure.internal"
condition: selection
falsepositives:
- Legitimate OAuth redirects to known providers
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (
msg:"CVE-2023-51665 Audiobookshelf SSRF Attempt";
flow:to_server,established;
content:"redirect_uri"; http_uri;
content:"169.254.169.254"; http_uri;
classtype:attempted-recon;
sid:1000001;
rev:1;
reference:cve,2023-51665;
)
Remediation & Mitigation
Immediate Actions:
- Upgrade: Update Audiobookshelf to version 2.7.0 or later.
- Network Segmentation: Restrict outbound internet access from the Audiobookshelf server to only necessary services.
- Firewall Rules: Block outbound traffic to cloud metadata IPs (e.g., 169.254.169.254/32) and internal RFC 1918 ranges from the server.
Long-Term Measures:
- Implement strict input validation for all user-supplied URLs.
- Use an allowlist for redirect URIs in authentication flows.
- Regularly audit dependencies for known vulnerabilities.
- Deploy a Web Application Firewall (WAF) with SSRF protection rules.
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.