Summary
Zipline's upload handling can allow an authenticated uploader to write a file outside the intended upload directory by supplying traversal sequences in the x-zipline-filename header. If the Zipline process can write to the targeted location, an attacker using the local datasource may overwrite files, corrupt application data, or disrupt service.
Affected context
The issue concerns Zipline's file upload handling when the x-zipline-filename header is used to determine a destination path. Risk depends on whether the upload path is insufficiently constrained and whether the Zipline process has write permission outside the intended upload directory. The described exposure involves authenticated uploaders using the local datasource.
Exploit preconditions
- Attack surface: File upload through Zipline using the local datasource
- Required access: An authenticated account permitted to upload files
- Trigger point: Processing an upload whose
x-zipline-filenamevalue contains path traversal sequences - Why exploitation is possible: If the resulting path is not confined to the upload directory, the Zipline process may write to other locations where it has permission
Why this happens
The underlying issue is improper limitation of a user-controlled path, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The upload handler uses filename data to construct a filesystem destination without reliably ensuring that the resolved path remains within the intended upload directory.
Potential impact
- An attacker may create or overwrite files writable by the Zipline process.
- Application data could be corrupted or replaced.
- Service availability could be disrupted if important files are altered.
- The effects may be limited by the filesystem permissions of the Zipline process.
General mitigation guidance
Defensive patterns focus on keeping user-controlled filenames from determining unrestricted filesystem paths.
- Resolve candidate paths and verify they remain within a fixed upload directory.
- Prefer server-generated filenames and treat supplied names as display metadata rather than storage paths.
- Reject path separators and other unexpected filename forms using a clear allowlist.
- Store uploads in a dedicated location with narrowly scoped write permissions.
- Run the service with only the filesystem privileges it needs.
How teams detect issues like this
- Use static analysis to identify filesystem writes whose paths incorporate request headers or other user-controlled values.
- Review upload code for canonicalization and containment checks that occur before file creation or overwrite.
- Apply code-review policies requiring server-controlled storage names and dedicated upload directories.
- Monitor upload logs for suspicious filenames and unexpected writes outside designated storage locations.
- Automated code review tools may help flag path construction and file-write patterns for further assessment.

