Summary
Budibase before 3.40.0 does not properly sanitize S3 object keys during workspace export, allowing authenticated builders to preserve directory traversal sequences in uploaded filenames. When the export process handles these names, an attacker may write arbitrary content to paths writable by the Budibase process.
Affected context
The vulnerability occurs in Budibase workspace export workflows that process uploaded files using S3 object keys or filenames without reliably removing traversal segments. Exploitation requires an authenticated builder account capable of uploading files and a deployment in which the export process has write access to sensitive filesystem locations.
Exploit preconditions
- Attack surface: Authenticated file-upload and workspace-export functionality
- Required access: A Budibase account with builder privileges
- Trigger point: Processing uploaded object keys during workspace export
- Why exploitation is possible: Traversal segments remain in filenames and can cause writes outside the intended temporary directory
Why this happens
The underlying bug is improper canonicalization and validation of attacker-controlled file paths. S3 object keys containing parent-directory traversal segments are preserved rather than reduced to a safe basename or confined to the designated export directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), because untrusted path components influence filesystem write destinations.
Potential impact
- An attacker may overwrite files writable by the Budibase process
- The application may experience unauthorized modification of exported content
- Sensitive application behavior or data may be disrupted
- Arbitrary file writes could contribute to code execution or broader compromise, depending on process permissions and writable paths
General mitigation guidance
Mitigation generally focuses on treating uploaded object keys as untrusted data
and enforcing a strict export-directory boundary.
Common defensive patterns include:
- Normalize and canonicalize paths before filesystem operations
- Reject traversal components and absolute-path forms
- Prefer generated server-side filenames or validated basenames over user-controlled names
- Verify that the resolved destination remains beneath the intended export directory
- Use isolated temporary directories with restrictive permissions
- Run the Budibase process with only the filesystem privileges it requires
- Separate uploaded content from executable or security-sensitive filesystem locations
How teams detect issues like this
Organizations can identify path traversal risks through:
- Static analysis rules for filesystem writes that incorporate request, upload, or object-key data
- Code review checks for path joining without canonicalization and containment validation
- Tests using traversal segments, encoded separators, absolute paths, and mixed path formats
- Runtime monitoring for export processes writing outside approved temporary directories
- Policy enforcement requiring trusted filename generation and restricted filesystem permissions
Automated application-security review tools may help flag unsafe path construction patterns.

