Summary
A directory traversal flaw in Budibase's PWA ZIP processing endpoint lets an authenticated builder read arbitrary files from the server filesystem by abusing paths defined in an uploaded ZIP archive.
When exploited, this access extends to sensitive files such as /proc/1/environ, exposing JWT secrets, database credentials, encryption keys, and API tokens, which can lead to full platform compromise.
Affected context
This vulnerability affects Budibase instances that:
- Run version 3.31.5 or earlier
- Enable builder access to the PWA ZIP processing endpoint at
POST /api/pwa/process-zip - Accept user-uploaded ZIP files that include an
icons.jsonmanifest
The issue manifests in environments where server-side code resolves file paths using path.join() or equivalent mechanisms with user-controlled segments and then accesses the underlying filesystem or object storage without sufficient normalization or validation.
Exploit preconditions
- Attack surface: HTTP API endpoint
POST /api/pwa/process-zipexposed by the Budibase server. - Required access: Authenticated Budibase account with builder privileges capable of uploading PWA ZIP archives.
- Trigger point: Submission of a crafted ZIP file whose
icons.jsonreferences filesystem paths that traverse outside the intended directory (e.g., using../sequences or absolute-like paths). - Why exploitation is possible:
- The server takes icon paths from
icons.jsonand concatenates them into filesystem paths viapath.join()without canonicalization, validation, or restriction to an allowed base directory. - The resulting paths are used to read files from the server's filesystem; the contents are then uploaded to the configured object store (MinIO/S3) and exposed via signed URLs.
- No checks ensure that resolved paths remain within the application's expected assets directory, making arbitrary file read via path traversal feasible.
Why this happens
The underlying bug is a classic directory traversal / arbitrary file read issue, mapped primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory and related to CWE-73: External Control of File Name or Path.
Application logic assumes that icon paths supplied in icons.json refer only to benign resources within a specific PWA context. Instead of enforcing this assumption, the code:
- Uses a generic path concatenation function (
path.join()) directly with user-controlled segments. - Fails to normalize and verify that the final, resolved path remains under a trusted root directory.
- Treats the resulting path as safe, reading filesystem content and then uploading it to an object store.
Abstractly, this pattern is: user-controlled path → naive concatenation → no canonicalization or directory boundary enforcement → filesystem read. Whenever file operations depend on externally controllable path components without strict constraints, attackers can escape the intended directory and target sensitive system or application files.
Potential impact
- Exfiltration of environment variables (e.g., via
/proc/1/environ), including: - JWT signing and encryption secrets
- Database credentials and connection strings
- API keys and third-party service tokens
- Encryption keys for stored data
- Ability to forge or decode authentication tokens, leading to full administrative takeover of Budibase.
- Unauthorized access to backing databases, enabling data theft, modification, or deletion.
- Lateral movement to other infrastructure components that share credentials or tokens exposed in environment variables.
- Reading of other sensitive local files (configuration files, logs, SSH keys, or service-specific secrets) depending on server configuration and file permissions.
- Long-term persistence through leaked credentials, even if the original path traversal code is later fixed, unless secrets are fully rotated.
General mitigation guidance
Effective mitigation focuses on rigorously constraining file access and treating all path components derived from user input as untrusted:
- Enforce strict base directories: Resolve, normalize, and verify any computed path against a fixed, allowed root directory. Reject or ignore paths that escape this boundary.
- Normalize and validate paths: Canonicalize paths (e.g., resolving
.., symbolic links if appropriate) before access, and apply allowlists or structured schemas (e.g., only known filenames or relative paths without separators). - Avoid direct filesystem access where possible: Prefer storing and referencing assets through logical identifiers or metadata records rather than direct paths derived from client input.
- Constrain ZIP and manifest handling: When parsing ZIP contents and manifest files like
icons.json, map entries to an internal representation that restricts where files may be written or read, instead of trusting user-supplied paths. - Apply least privilege to the application process: Run the Budibase server under an account with minimal filesystem permissions; ensure sensitive host files and system-level secrets are not readable by the application user.
- Harden secret management: Keep secrets in a dedicated, access-controlled store rather than environment variables where possible, and segregate them from application-readable filesystems to reduce impact if arbitrary reads occur.
- Rotate secrets defensively: After any suspected exposure, rotate JWT keys, database passwords, and API tokens; design operational runbooks to make this rotation straightforward.
How teams detect issues like this
Detection is centered on identifying improper file path handling and anomalous file access patterns:
- Static analysis and code scanning:
- Flag instances where filesystem APIs (readFile, createReadStream, open, etc.) are called with parameters influenced by HTTP request data, ZIP structs, or JSON manifest fields.
- Define rules to detect
path.join()or similar path operations where user-controlled input is part of the path, without subsequent normalization and boundary checks. - Look for functions that accept arbitrary filenames or relative paths from clients and do not verify against allowlists.
- Targeted code review:
- Review endpoints dealing with file uploads, ZIP processing, and manifest parsing for assumptions about "safe" relative paths.
- Check that all apparent "asset" or "icon" file references are validated against a known set of permitted directories and file names.
- Examine integration with object stores (MinIO/S3) to ensure only intended file content is uploaded and shared.
- Runtime and logging-based detection:
- Enable verbose logging for file access originating from web endpoints, and monitor for access patterns targeting
/proc,/etc, or other system directories. - Use anomaly detection to alert on unexpected reads of configuration or environment-related paths.
- Security testing and CI/CD enforcement:
- Integrate DAST/SAST tools that specifically test for directory traversal in upload and file processing endpoints.
- Add CI policies that block merges when newly introduced code reads files based on externally controlled paths without explicit validation gates.

