GHSA-qxvg-h7q2-hcxh: motionEye Remote Code Execution Vulnerability
CRITICALGHSA-qxvg-h7q2-hcxh is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-269: Improper Privilege Management) affecting motionEye libraries in the PyPI ecosystem. The issue involves lfi → pass‑the‑hash admin → unsafe restore → unauth action exec (rce). Remediation is available by upgrading affected packages to version 0.44.0.
GHSA-qxvg-h7q2-hcxh at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix GHSA-qxvg-h7q2-hcxh
To remediate this vulnerability, upgrade all affected motionEye dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install motioneye>=0.44.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show motioneye
How to Check if You Are Affected
To determine whether your Python environment is affected by GHSA-qxvg-h7q2-hcxh, inspect your installed packages using pip:
pip show motioneye
Analyze the terminal output to locate any version of motionEye in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.44.0), your application is affected.
Note: The pip show motioneye command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In motionEye, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-qxvg-h7q2-hcxh Affected motionEye Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
motioneye
|
PyPI |
< 0.44.0
|
0.44.0
|
References
Frequently Asked Questions
What is GHSA-qxvg-h7q2-hcxh?
Which motionEye versions are affected?
What version fixes GHSA-qxvg-h7q2-hcxh?
Is motioneye affected?
What is the CVSS score of GHSA-qxvg-h7q2-hcxh?
What CWE is associated with GHSA-qxvg-h7q2-hcxh?
How can I check PyPI dependencies for GHSA-qxvg-h7q2-hcxh?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qxvg-h7q2-hcxh",
"modified" : "2026-06-23T18:53:04Z",
"published" : "2026-06-23T18:53:04Z",
"aliases" : [ ],
"summary" : "motionEye: LFI → pass‑the‑hash admin → unsafe restore → unauth action exec (RCE)",
"details" : "## Summary\nA multi‑stage chain in motionEye leads to remote code execution. The chain combines:\n\n1. **Arbitrary file read (LFI)** via the picture download endpoint for **local motion cameras** using absolute paths.\n2. **Pass‑the‑hash admin auth** due to accepting request signatures computed with password hashes.\n3. **Unsafe config restore** that extracts attacker‑controlled tarballs into `CONF_PATH`.\n4. **Unauthenticated action execution** via `/action/<id>/<action>`.\n\nIf the **normal user password is unset**, the chain becomes **unauthenticated RCE**. If a normal password exists, a **normal user** can still achieve **admin escalation and RCE**.\n\n---\n\n## Affected Code (motionEye repo)\n\n### 1) LFI (absolute path) — `picture/<id>/download`\n**Files:**\n- `motioneye/motioneye/handlers/picture.py` → `download()` (local motion camera branch)\n- `motioneye/motioneye/mediafiles.py` → `get_media_content()`\n\n**Issue:** `get_media_content()` only blocks `..` and then joins `target_dir` with `path`. Absolute paths (e.g. `/etc/hosts`) bypass the join and are read directly.\n\n### 2) Pass‑the‑hash admin auth\n**File:** `motioneye/motioneye/handlers/base.py` → `get_current_user()`\n\n**Issue:** The signature check allows signatures computed using the **admin password hash** (SHA1) as the key. If the hash is leaked (via LFI), admin access can be obtained without the plaintext password.\n\n### 3) Unsafe restore (tar extraction)\n**File:** `motioneye/motioneye/config.py` → `restore()`\n\n**Issue:** `tar zxC CONF_PATH` is used on user‑supplied data without sanitizing entries. A crafted tar can drop executable files into `CONF_PATH`.\n\n### 4) Unauthenticated action execution\n**File:** `motioneye/motioneye/handlers/action.py` → `post()`\n\n**Issue:** No authentication decorator is present. It executes `<action>_<camera_id>` found in `CONF_PATH` with `subprocess.Popen`.\n\n---\n\n## Exploit Chain (Detailed)\n\n1. **Create or find a local motion camera id** (local motion cameras are required for the vulnerable LFI path).\n2. **LFI via picture download**:\n - Request: `/picture/<id>/download/<absolute_path>`\n - Example: `/picture/1/download/%2Fetc%2Fhosts`\n - Result: Arbitrary file read.\n3. **Read admin hash** from `/etc/motioneye/motion.conf`:\n - Contains `@admin_password <SHA1_HASH>`.\n4. **Pass‑the‑hash admin**:\n - Compute signature for `/config/restore?_username=admin` using the **hash** as key.\n - Admin access is accepted with hash‑based signatures.\n5. **Restore malicious tar**:\n - Upload a tar containing `lock_<id>` (or any action) as an executable.\n - File is written into `CONF_PATH` by restore.\n6. **Trigger unauth action**:\n - POST `/action/<id>/lock`\n - The server executes the injected file.\n\n---\n\n## Proof of Execution (Observed Output)\nIn local testing, the injected action created a marker file:\n\n```\n/tmp/meye_rce_ok\n```\n\nVerification command:\n```\ndocker exec -it motioneye ls -la /tmp | grep meye_rce_ok\n```\nExample output:\n```\n-rw-r--r-- 1 root root 0 ... /tmp/meye_rce_ok\n```\n\n---\n\n## Preconditions / Requirements\n\n- At least **one local motion camera** exists (e.g., `netcam_url`, `videodevice`).\n- `picture/<id>/download` is reachable:\n - **Unauth** if `@normal_password` is empty (default in some installs).\n - **Auth required** if normal password is set (attacker needs normal creds).\n\n---\n\n## Impact\n- **Unauth RCE** (normal password unset).\n- **Authenticated RCE** (normal user → admin → RCE).\n- Arbitrary file read on server filesystem.\n- Full compromise of motionEye process account.\n\n---\n\n## Suggested Fixes\n1. **Block absolute paths** in `get_media_content()` and `get_media_path()`.\n2. **Remove hash‑based signature acceptance**; only accept signatures computed with plaintext passwords.\n3. **Harden restore**: reject absolute paths, `..`, symlinks, non‑regular files.\n4. **Require authentication** on `ActionHandler` (admin‑only).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "motioneye"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.44.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/motioneye-project/motioneye/security/advisories/GHSA-qxvg-h7q2-hcxh"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/motioneye-project/motioneye"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22", "CWE-269", "CWE-306", "CWE-347", "CWE-434" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-23T18:53:04Z",
"nvd_published_at" : null
}
}