Summary
Fireshare's unauthenticated /api/uploadChunked/public endpoint contains a path traversal vulnerability that allows attackers to control where uploaded files are written on the server's filesystem.
By abusing the checkSum parameter, an unauthenticated attacker can write arbitrary files to any writable path, enabling scenarios such as web shell placement, configuration overwrites, or data tampering.
Affected context
This vulnerability affects Fireshare instances that:
- Expose the
/api/uploadChunked/publicendpoint to unauthenticated users - Accept user-supplied upload metadata, including a
checkSumparameter - Run with filesystem locations that are writable by the Fireshare process and accessible by other components (e.g., web server, application runtime, or scheduled jobs)
The issue exists in the server-side upload handling logic in app/server/fireshare/api.py, where the public upload path is not subject to the same path validation and normalization controls as the authenticated upload path.
Exploit preconditions
- Attack surface: Network-accessible HTTP(S) interface exposing
/api/uploadChunked/public. - Required access: No authentication required; attacker only needs the ability to send crafted upload requests to the application.
- Trigger point: Submission of chunked upload requests where the
checkSumor related parameter influences the destination filename or path. - Why exploitation is possible: The server-side path construction logic incorporates user-controlled data (e.g.,
checkSum) into filesystem paths without consistently enforcing canonicalization, whitelisting, or confinement to a dedicated upload directory. This allows directory traversal and arbitrary file placement under any path writable by the Fireshare process.
Why this happens
The root cause aligns with CWE-22: Path Traversal, where user input is used to construct filesystem paths without robust validation.
In Fireshare's upload handler, the checkSum parameter or associated metadata is used to derive the output file path for chunked uploads.
Because this parameter is not subjected to strict normalization, allowed-character constraints, or confinement to a fixed base directory for the public endpoint, an attacker can inject traversal sequences or crafted values that escape the intended upload directory and write files elsewhere.
Conceptually, this reflects an insecure pattern of:
- Trusting client-controlled identifiers for both naming and locating stored files
- Applying security checks to one code path (authenticated endpoint) but not consistently mirroring them in analogous unauthenticated code paths.
Potential impact
- Arbitrary file creation or overwriting in any directory writable by the application process
- Possible remote code execution if the attacker can place executable code in a location interpreted by the runtime or web server (e.g., templates, plug-ins, or scripts)
- Overwriting application or configuration files, potentially modifying behavior, disabling security controls, or causing denial of service
- Planting backdoors or malicious artifacts for persistence or lateral movement
- Tampering with logs, uploaded content, or other data files to manipulate audit trails or user-visible resources
General mitigation guidance
Mitigation generally focuses on strict path handling and constraining file storage locations:
- Treat all user-supplied path components (including IDs like checksums) as untrusted and never use them directly as filesystem paths.
- Constrain uploads to a single, dedicated directory that is outside of any executable or web-accessible root, and ensure all paths are resolved relative to this base.
- Normalize and canonicalize any derived path, then enforce checks that reject inputs that attempt to escape the upload directory (e.g., by comparing canonical paths or using OS APIs to confine access).
- Use server-generated, opaque identifiers for file storage names rather than client-controlled values, storing any logical mapping in a database.
- Limit filesystem permissions so the application process can only write to a minimal set of directories, avoiding write access to application code, configuration, or system directories.
- Align security checks across similar endpoints so that protections applied to authenticated upload flows are also consistently applied to public or anonymous flows.
How teams detect issues like this
Detection can combine code-focused and operational approaches:
- Static analysis: Define rules to flag any filesystem write operations that incorporate request parameters, especially in upload handlers. Look for uses of
open, file move operations, or storage APIs where user input influences path components. - Code review signals:
- Endpoints that accept file uploads without strong authentication or authorization.
- Direct concatenation of user input into paths without normalization and base-directory checks.
- Separate code paths (authenticated vs public) that appear to duplicate logic but do not share common validation functions.
- Runtime monitoring:
- Log file write operations, including destination paths and associated endpoints, and alert on writes outside designated upload directories.
- Configure intrusion detection or host-based monitoring to alert on new or modified files in sensitive locations (e.g., application directories, configuration paths).
- Policy enforcement:
- Use CI/CD policies that require path-confinement wrappers or storage abstractions for any new file write capability.
- Integrate SAST/IAST tools into pipelines to automatically identify path traversal patterns in upload handlers and file-management code.

