GHSA-qxvg-h7q2-hcxh: motionEye Remote Code Execution Vulnerability

CRITICAL
Advisory Summary

GHSA-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

CVE Identifier N/A
GHSA Identifier GHSA-qxvg-h7q2-hcxh
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-269: Improper Privilege Management
Affected Product motionEye
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (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.

motioneye fixed: 0.44.0
pip install motioneye>=0.44.0
Verify Direct and Transitive Dependencies

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

## Summary A multi‑stage chain in motionEye leads to remote code execution. The chain combines: 1. **Arbitrary file read (LFI)** via the picture download endpoint for **local motion cameras** using absolute paths. 2. **Pass‑the‑hash admin auth** due to accepting request signatures computed with password hashes. 3. **Unsafe config restore** that extracts attacker‑controlled tarballs into `CONF_PATH`. 4. **Unauthenticated action execution** via `/action/<id>/<action>`. If 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**. --- ## Affected Code (motionEye repo) ### 1) LFI (absolute path) — `picture/<id>/download` **Files:** - `motioneye/motioneye/handlers/picture.py` → `download()` (local motion camera branch) - `motioneye/motioneye/mediafiles.py` → `get_media_content()` **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. ### 2) Pass‑the‑hash admin auth **File:** `motioneye/motioneye/handlers/base.py` → `get_current_user()` **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. ### 3) Unsafe restore (tar extraction) **File:** `motioneye/motioneye/config.py` → `restore()` **Issue:** `tar zxC CONF_PATH` is used on user‑supplied data without sanitizing entries. A crafted tar can drop executable files into `CONF_PATH`. ### 4) Unauthenticated action execution **File:** `motioneye/motioneye/handlers/action.py` → `post()` **Issue:** No authentication decorator is present. It executes `<action>_<camera_id>` found in `CONF_PATH` with `subprocess.Popen`. --- ## Exploit Chain (Detailed) 1. **Create or find a local motion camera id** (local motion cameras are required for the vulnerable LFI path). 2. **LFI via picture download**: - Request: `/picture/<id>/download/<absolute_path>` - Example: `/picture/1/download/%2Fetc%2Fhosts` - Result: Arbitrary file read. 3. **Read admin hash** from `/etc/motioneye/motion.conf`: - Contains `@admin_password <SHA1_HASH>`. 4. **Pass‑the‑hash admin**: - Compute signature for `/config/restore?_username=admin` using the **hash** as key. - Admin access is accepted with hash‑based signatures. 5. **Restore malicious tar**: - Upload a tar containing `lock_<id>` (or any action) as an executable. - File is written into `CONF_PATH` by restore. 6. **Trigger unauth action**: - POST `/action/<id>/lock` - The server executes the injected file. --- ## Proof of Execution (Observed Output) In local testing, the injected action created a marker file: ``` /tmp/meye_rce_ok ``` Verification command: ``` docker exec -it motioneye ls -la /tmp | grep meye_rce_ok ``` Example output: ``` -rw-r--r-- 1 root root 0 ... /tmp/meye_rce_ok ``` --- ## Preconditions / Requirements - At least **one local motion camera** exists (e.g., `netcam_url`, `videodevice`). - `picture/<id>/download` is reachable: - **Unauth** if `@normal_password` is empty (default in some installs). - **Auth required** if normal password is set (attacker needs normal creds). --- ## Impact - **Unauth RCE** (normal password unset). - **Authenticated RCE** (normal user → admin → RCE). - Arbitrary file read on server filesystem. - Full compromise of motionEye process account. --- ## Suggested Fixes 1. **Block absolute paths** in `get_media_content()` and `get_media_path()`. 2. **Remove hash‑based signature acceptance**; only accept signatures computed with plaintext passwords. 3. **Harden restore**: reject absolute paths, `..`, symlinks, non‑regular files. 4. **Require authentication** on `ActionHandler` (admin‑only).

GHSA-qxvg-h7q2-hcxh Affected motionEye Versions

1 component(s)
Fixed Versions:
0.44.0
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?
GHSA-qxvg-h7q2-hcxh is a security vulnerability in motionEye involving LFI → pass‑the‑hash admin → unsafe restore → unauth action exec (RCE) under CWE-269: Improper Privilege Management.
Which motionEye versions are affected?
Affected versions include releases prior to 0.44.0 across affected packages: motioneye.
What version fixes GHSA-qxvg-h7q2-hcxh?
Upgrading to 0.44.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is motioneye affected?
Yes, motioneye is affected in releases prior to 0.44.0. Upgrade your dependency to 0.44.0 or later.
What is the CVSS score of GHSA-qxvg-h7q2-hcxh?
GHSA-qxvg-h7q2-hcxh has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with GHSA-qxvg-h7q2-hcxh?
GHSA-qxvg-h7q2-hcxh is classified under CWE-269: Improper Privilege Management (The product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor.).
How can I check PyPI dependencies for GHSA-qxvg-h7q2-hcxh?
Run the dependency tree command: 'pip show motioneye'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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
  }
}