Summary
A relative path traversal vulnerability in Livebook allows an attacker-authored notebook to cause attacker-controlled content to be written to an arbitrary filesystem path. The risk arises when a victim opens the notebook and triggers retrieval of a URL-based file entry within an authenticated Livebook session.
Affected context
The vulnerability occurs in Livebook notebook import and file-entry retrieval workflows when a .livemd notebook supplies file_entries metadata. Imported names can bypass the filename validation applied by user-interface-created entries, and URL-type entries may be resolved beneath a temporary session directory without verifying that the final path remains within that directory. The issue is relevant where the Livebook process has write permission to the targeted filesystem location.
Exploit preconditions
- Attack surface: Livebook notebook import and URL-based file-entry retrieval
- Required access: No account on the target instance; the attacker must provide a notebook that a victim can open
- Trigger point: The victim opens the notebook and causes the URL-type file entry to be fetched
- Why exploitation is possible: Imported entry names are used without the normal flat-filename validation, and path resolution does not enforce containment within the session temporary directory
Why this happens
The underlying bug is insufficient canonical-path validation for attacker-influenced filenames. The import path accepts a file-entry name verbatim, while later resolution collapses parent-directory components without checking that the resulting path remains under the intended temporary directory. This behavior maps to CWE-23: Relative Path Traversal, because untrusted path components can escape an expected directory and direct writes elsewhere on the filesystem.
Potential impact
- Attacker-controlled content may be written to arbitrary paths the Livebook process can access
- Sensitive files may be overwritten or corrupted
- Application behavior or local configuration may be altered
- The Livebook service may be disrupted
- Further compromise could occur if a writable target is later executed or trusted by another process
General mitigation guidance
Mitigation generally focuses on treating notebook metadata and URL-derived filenames as untrusted input and enforcing directory containment at the final filesystem operation.
Common defensive patterns include:
- Accepting only validated, flat filenames for imported file entries
- Canonicalizing paths and verifying that the resolved destination remains beneath the designated storage directory
- Rejecting absolute paths, parent-directory segments, and ambiguous path formats
- Applying the same containment checks to every file-entry creation and attachment path
- Limiting the Livebook process to the least filesystem privileges required
- Using isolated, non-sensitive writable directories for fetched content
- Requiring explicit trust or review before retrieving external notebook resources
How teams detect issues like this
Organizations can look for:
- Static-analysis findings where user-controlled names reach filesystem path joins or write operations without canonical containment checks
- Code-review signals involving path normalization that clamps only at the filesystem root rather than an application-owned directory
- Tests using parent-directory segments, absolute paths, encoded separators, and platform-specific path forms
- Runtime telemetry showing unexpected writes outside approved Livebook temporary or attachment directories
- Policy checks requiring canonical-path validation before file creation and restricting external URL retrieval
- Automated security review tools configured to flag path traversal and arbitrary file-write patterns

