Miggo Logo

CVE-2025-60787: motionEye vulnerable to RCE via unsanitized motion config parameter

7.2

CVSS Score
3.1

Basic Information

EPSS Score
0.95686%
Published
11/3/2025
Updated
11/3/2025
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
motioneyepip< 0.43.1b50.43.1b5

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability allows for Remote Code Execution by injecting shell commands into configuration fields in the MotionEye web UI. The provided vulnerability description explicitly mentions that the root cause is the lack of sanitization in config.py before writing to configuration files, and points to ConfigHandler.set_config() in the execution flow.

To pinpoint the exact vulnerable function, I analyzed the patch that fixed the vulnerability. The patch was identified by comparing the last vulnerable version (0.43.1b4) and the first patched version (0.43.1b5). The key commit f47d20088de1c15fba93c42e8a3ba4d888cc9a13 is titled "enh(backend): apply input sanity checks as well in backend".

This commit modifies the file motioneye/config.py and introduces server-side validation within the motion_camera_ui_to_dict function. Before this patch, user-controlled input for fields like movie_file_name and image_file_name was taken directly from the UI dictionary (ui) and placed into the configuration data structure. The patch adds calls to a new input_sanity_check function to validate these inputs against a regex, preventing the injection of shell metacharacters.

Therefore, the motion_camera_ui_to_dict function is the precise location where the vulnerability existed, as it was the function that processed the malicious input without proper validation. While ConfigHandler.set_config() is part of the chain, the lack of sanitization itself was within motion_camera_ui_to_dict.

Vulnerable functions

motion_camera_ui_to_dict
motioneye/config.py
This function is responsible for taking configuration parameters from the web interface and preparing them to be written into motion's configuration files. The vulnerability existed because this function did not sanitize user-provided values for parameters like `movie_filename` and `picture_filename` (Image File Name in the UI). An attacker with admin access could inject malicious shell commands into these fields. The function would then process these strings and include them in the configuration file. When the motion service was restarted, the motion daemon would execute these commands, leading to Remote Code Execution.

WAF Protection Rules

WAF Rule

## Summ*ry * *omm*n* inj**tion vuln*r**ility in Motion*y* *llows *tt**k*rs to ***i*v* R*mot* *o** *x**ution (R**) *y supplyin* m*li*ious v*lu*s in *on*i*ur*tion *i*l*s *xpos** vi* t** W** UI. ****us* Motion*y* writ*s us*r-suppli** v*lu*s *ir**tly int

Reasoning

T** vuln*r**ility *llows *or R*mot* *o** *x**ution *y inj**tin* s**ll *omm*n*s into *on*i*ur*tion *i*l*s in t** Motion*y* w** UI. T** provi*** vuln*r**ility **s*ription *xpli*itly m*ntions t**t t** root **us* is t** l**k o* s*nitiz*tion in `*on*i*.py