Summary
UXGROUP LLC Cast to TV Screen Mirroring v2.2.77 contains an arbitrary file overwrite vulnerability in its file import functionality, allowing attacker-controlled data to be written to internal application paths.
When abused, this flaw can enable arbitrary code execution or exposure of sensitive information if an attacker can influence or trigger the import process with crafted file metadata or paths.
Affected context
The vulnerability occurs in the file import process of the Cast to TV Screen Mirroring application, where imported files or their associated metadata are written to the local filesystem.
The issue is present when the application trusts file paths or names derived from user-controlled input (for example, from downloaded or shared media) and uses them to determine where to store or update internal files without adequate normalization or access control checks.
Risk increases in environments where the app runs with broad filesystem permissions or where sensitive configuration, executable, or cache files are stored in predictable locations reachable by the import logic.
Exploit preconditions
- Attack surface: The file import feature of the Cast to TV Screen Mirroring application.
- Required access: Ability to supply or influence files processed by the import mechanism (e.g., via local user interaction, shared content, or other app-to-app channels).
- Trigger point: Initiating or causing the application to process a crafted file whose path, name, or metadata is interpreted in a way that targets internal application directories or critical files.
- Why exploitation is possible: The application fails to properly restrict or sanitize filesystem paths used during import, allowing user-controlled values to traverse or point into sensitive directories and overwrite existing files.
Why this happens
This vulnerability stems from insufficient validation of filesystem paths used when saving imported content.
The application appears to construct destination paths using user-influenced values (such as filenames or relative paths) and passes them directly to file write operations without enforcing a confinement to a safe directory or checking for path traversal sequences.
This aligns with CWE-73: External Control of File Name or Path and CWE-22: Path Traversal, where untrusted data controls the file system location of read/write operations, enabling overwriting of internal resources or configuration data.
Potential impact
- Overwriting internal configuration or preference files that may alter application behavior.
- Replacing or modifying scripts, libraries, or executable components used by the app, which can lead to arbitrary code execution.
- Corrupting or exposing sensitive user data stored by the application.
- Disrupting application functionality or causing persistent crashes by corrupting critical internal files.
- Establishing persistence or further compromise on the device if overwritten files are executed in privileged contexts.
General mitigation guidance
Effective mitigation focuses on constraining how file paths are derived and where imported content can be stored:
- Enforce strict directory whitelisting so that all imported files are written only within a dedicated, application-controlled storage area.
- Normalize and canonicalize all paths (resolving ".." and symbolic links) before use, and reject any path that resolves outside the allowed directory boundary.
- Treat filenames and paths as untrusted input: strip dangerous characters, enforce simple patterns (e.g., alphanumeric with limited separators), and ignore embedded directory separators in user-controlled values.
- Use generated, application-assigned filenames instead of trusting user-provided names or paths when writing to disk.
- Apply least-privilege principles to the app's storage permissions so it cannot arbitrarily modify system-level or cross-application files.
How teams detect issues like this
Organizations and developers can detect this class of issue using a combination of review and automation:
- Static analysis: Flag file operations where the path is derived from external input (e.g., Intent extras, network responses, or user-supplied filenames) without normalization and directory checks.
- Code review: Look for uses of APIs that open or write files based on concatenated strings, user input, or deserialized metadata, especially when writing into shared or system directories.
- Runtime testing: Perform security tests that attempt path traversal via filenames (e.g., "../", absolute paths, or reserved locations) during file import and verify where data is actually written.
- Policy enforcement: Introduce CI/CD checks that enforce safe file handling patterns, such as mandatory path canonicalization helpers and repository-wide guidelines for filesystem access.

