Summary
Pulpy injected a privileged pulpy.fs JavaScript API into every packaged web app, but relied on an incomplete validateFsPath() blocklist to sandbox filesystem access.
As a result, any packaged web app could read and write arbitrary files in the user's home directory, including sensitive keys and credentials, whenever a user ran the app.
Affected context
This vulnerability affects web applications packaged as desktop apps using Pulpy versions prior to 0.1.1.
When these applications run on a user's machine, Pulpy automatically exposes a pulpy.fs JavaScript API that has direct access to the host filesystem.
The intended sandbox relied on a validation function that enforced a blocklist of forbidden paths, but the rules were incomplete and could be bypassed for many locations under the user's home directory.
The issue is particularly relevant on systems where users store SSH keys, cloud credentials, and keychains in standard home-directory paths.
Exploit preconditions
- Attack surface: Malicious or compromised Pulpy-packaged desktop applications executed by the user.
- Required access: Ability to ship or influence a Pulpy-based packaged web app that a user downloads and runs (e.g., through phishing, trojanized app, or compromised update channel).
- Trigger point: Invocation of the
pulpy.fsAPI from within the packaged application's JavaScript code, targeting paths in the user's home directory. - Why exploitation is possible: The filesystem sandbox is implemented using an incomplete blocklist inside
validateFsPath(). It does not robustly constrain paths to a safe allowlisted directory nor correctly handle all valid path variants, enabling access to sensitive files in the home directory.
Why this happens
The core issue stems from implementing filesystem sandboxing using a fragile, path-based blocklist instead of a strict allowlist and robust path canonicalization.
The pulpy.fs API is inherently privileged, but its guard function validateFsPath() attempts to prevent dangerous access by checking for certain disallowed paths.
This design maps to CWE-22: Path Traversal and CWE-284: Improper Access Control, because:
- It relies on string matching and incomplete checks, which can miss valid path encodings or alternate locations within the home directory.
- It does not enforce confinement to a specific, safe directory (e.g., an app-specific data folder), thus failing to uphold a clear security boundary.
As a result, web content bundled as a desktop application is effectively granted broad filesystem privileges in the user's home directory, contrary to the intended sandbox.
Potential impact
- The application may read private SSH keys (e.g.,
~/.ssh/id_rsa), enabling later impersonation and unauthorized server access. - The application could access cloud provider credentials in files like
~/.aws/credentials, allowing remote account takeover or data theft. - The application can read from keychain or credential store directories (e.g.,
~/Library/Keychains/), potentially exposing authentication tokens or encrypted material. - The application may overwrite or corrupt user files in the home directory, leading to data loss, configuration tampering, or denial of access.
- The application could exfiltrate collected secrets to an attacker-controlled server, resulting in broader compromise beyond the local machine.
General mitigation guidance
Effective mitigation focuses on redesigning the privilege model and filesystem sandbox rather than patching individual paths:
- Favor a deny-by-default, allowlist-based approach: restrict
pulpy.fsoperations to a specific application data directory under the user's profile, and reject all paths outside that directory. - Perform canonicalization and normalization of requested paths (resolving symlinks,
.and..segments) before enforcement, and apply checks only on the canonical path. - Remove or minimize implicit trust in packaged web content: avoid exposing high-privilege APIs by default and require explicit opt-in or capability flags for apps that truly need filesystem access.
- Introduce capability scoping and per-app permissions so each packaged app only gets the smallest set of filesystem operations essential for its functionality.
- Consider user-mediated access patterns for highly sensitive operations (e.g., open-file dialogs) rather than raw path-based read/write APIs.
- Run filesystem operations under least-privilege OS accounts, with directories and permissions configured to limit access to sensitive files by design.
How teams detect issues like this
Detection involves both code-centric and behavior-centric approaches:
- Static analysis and code review:
- Flag any global, always-on injection of privileged APIs (like
pulpy.fs) into untrusted application code. - Search for path validation logic that uses blocklists, regular expressions, or string contains checks instead of strict allowlisting and canonicalization.
- Review interface boundaries where low-privilege code (web app JavaScript) can invoke high-privilege operations (filesystem, network, credentials).
- Policy and design checks:
- Enforce architectural guidelines that require capability scoping and "no raw filesystem access" defaults for embedded runtimes.
- Introduce security design reviews for any API that bridges between web content and the host OS.
- Runtime monitoring (where feasible):
- Instrument packaged applications or underlying runtime to log and analyze file access patterns from embedded web content.
- Use host-level monitoring tools to detect unexpected access to sensitive files (e.g., SSH keys, credential stores) originating from desktop apps.

