Summary
A path traversal vulnerability in Streambert allows a compromised renderer to cause the application to copy files from arbitrary readable locations. Because the renderer also controls the destination path, an attacker may disclose sensitive local data or overwrite files in writable locations.
Affected context
The vulnerability occurs in Streambert's subtitle-download workflow when the renderer invokes the download IPC channel with a subtitle URL using the file: scheme. Risk is present when renderer content is compromised and the StreamBERT process can read the selected source file and write to the renderer-controlled destination path.
Exploit preconditions
- Attack surface: Electron renderer-to-main-process IPC handling
- Required access: Control of, or code execution within, a Streambert renderer context
- Trigger point: Subtitle download processing through the
run-downloadchannel - Relevant inputs: Renderer-controlled subtitle URL and download destination path
- Why exploitation is possible: The decoded local pathname is passed to a file-copy operation without sufficiently restricting the source and destination paths
Why this happens
The underlying issue is insufficient validation of filesystem paths derived from renderer-controlled input. A file: URI is decoded into a local pathname and used as a source for file copying, while the destination is also controlled by the renderer. This behavior maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with CWE-73: External Control of File Name or Path also applicable because untrusted input influences filesystem locations.
Potential impact
- Sensitive local files may be disclosed to an attacker-controlled location
- Existing writable files may be overwritten or corrupted
- Application data or user configuration may be modified
- Persistence or follow-on compromise may become possible if high-value writable files are targeted
- Confidentiality and integrity of data accessible to the StreamBERT process may be affected
General mitigation guidance
Mitigation generally focuses on reducing renderer authority and enforcing filesystem boundaries at the privileged IPC layer.
Common defensive patterns include:
- Rejecting local-file schemes unless they are explicitly required and narrowly authorized
- Resolving and canonicalizing paths before access, then enforcing approved source and destination directories
- Deriving destination paths in the main process rather than trusting renderer-supplied paths
- Using allowlists for permitted files, extensions, and download locations
- Separating file-read and file-write capabilities and applying least privilege
- Enforcing strong Electron context isolation, sandboxing, and narrow IPC contracts
- Avoiding overwrites by default and requiring explicit, policy-controlled replacement behavior
How teams detect issues like this
Detection can combine static analysis, review practices, and runtime policy controls:
- Search for filesystem APIs such as
copyFileSync,readFile, andwriteFilereceiving values derived from IPC messages, URI parsing, or renderer input - Review IPC handlers for missing sender validation, path canonicalization, directory containment checks, and scheme restrictions
- Use static analysis or automated code-review tools to trace untrusted renderer data into filesystem operations
- Add tests for traversal sequences, alternate path representations, local-file URI handling, symbolic links, and destination escapes
- Monitor file operations initiated by the application outside approved download directories
- Enforce application policies that restrict renderer access to privileged filesystem capabilities

