motionEye's Absolute Path Traversal in Media File Handlers Allows Arbitrary File Read
Description
Summary
mEye contains an absolute path traversal vulnerability in multiple media file handlers that allows an attacker to read arbitrary files from the filesystem.
The affected handlers accept a user-controlled filename parameter and construct filesystem paths using os.path.join(). When an absolute path is supplied, Python discards the configured media directory and returns the attacker-supplied path directly. The application then bypasses Tornado's built-in path validation by overriding the relevant safety checks.
As a result, an attacker can access files outside of the configured camera media directory, subject to the permissions of the motionEye process.
Details
The issue exists in the media playback and download functionality.
The filename parameter is passed to mediafiles.get_media_path():
def get_media_path(camera_config, path, media_type):
target_dir = camera_config.get('target_dir')
full_path = os.path.join(target_dir, path)
return full_path
When path is an absolute path (e.g. /etc/motioneye/motion.conf), Python's os.path.join() discards target_dir entirely and returns the absolute path as-is. This would normally be caught by Tornado's StaticFileHandler path validation, but MoviePlaybackHandler explicitly overrides both safety checks (movie_playback.py lines 111-115):
def get_absolute_path(self, root, path):
return path
def validate_absolute_path(self, root, absolute_path):
return absolute_path
This allows reading any file on the filesystem that the motionEye process can access.
The same path traversal exists in the movie download, picture download, and picture preview handlers:
- GET /movie/<camera_id>/download/
- GET /picture/<camera_id>/download/
- GET /picture/<camera_id>/preview/
# PoC
GET /movie/1/playback//etc/motioneye/motion.conf HTTP/1.1
Host: target:8765
# Fix
Do not allow absolute paths supplied by user input.
Validate that the fully resolved canonical path remains within the configured camera media directory before serving a file.
Additionally, Tornado’s built-in path validation should not be bypassed unless equivalent validation is performed by motionEye.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
motioneyePyPI | < 0.44.0 | 0.44.0 |
Affected products
1Patches
Vulnerability mechanics
Root cause
"Missing input validation in media file handlers allows an absolute path supplied by the attacker to bypass directory restriction via Python's os.path.join() behavior."
Attack vector
An attacker sends an HTTP GET request to endpoints such as `/movie/<camera_id>/playback/<filename>` where `<filename>` is an absolute path like `/etc/motioneye/motion.conf` [ref_id=2]. Because `os.path.join()` discards the configured media directory when given an absolute path, and the handler overrides Tornado's path validation, the server reads and returns any file the motionEye process can access [CWE-22]. No authentication is required beyond whatever access the motionEye web interface normally requires.
Affected code
The vulnerability resides in `mediafiles.get_media_path()` which calls `os.path.join(target_dir, path)` — when `path` is absolute, Python discards `target_dir` and returns the attacker-supplied path. The `MoviePlaybackHandler` in `movie_playback.py` (lines 111-115) then overrides Tornado's `get_absolute_path` and `validate_absolute_path` methods, bypassing built-in path validation. The same pattern affects the movie download, picture download, and picture preview handlers.
What the fix does
The advisory recommends not allowing absolute paths supplied by user input and validating that the fully resolved canonical path remains within the configured camera media directory before serving a file [ref_id=2]. Additionally, Tornado's built-in path validation should not be bypassed unless equivalent validation is performed by motionEye. No patch diff is included in the bundle.
Preconditions
- networkThe attacker must be able to reach the motionEye web interface (default port 8765).
- configThe motionEye process must have filesystem read permissions on the target file.
Generated on Jun 23, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2News mentions
0No linked articles in our index yet.