Summary
Scirius contains an arbitrary file write vulnerability in the PCAP filestore upload endpoint, where an uploaded document's _id value can influence the destination path. A user with the default User role may exploit path traversal sequences to write attacker-controlled JSON files outside the intended directory, potentially with root-level filesystem impact.
Affected context
The vulnerability occurs in Scirius deployments that expose the PCAP filestore upload functionality and permit default User role accounts to submit uploaded documents. Risk increases when the _id field is used to construct filesystem paths without canonicalization and strict containment checks, particularly when the service runs with root privileges.
Exploit preconditions
- Attack surface: PCAP filestore upload endpoint
- Required access: An authenticated account with the default User role, subject to deployment-specific access controls
- Trigger point: Processing an uploaded document whose
_idvalue is incorporated into the destination filename - Why exploitation is possible: Path traversal sequences can escape the intended storage directory, while insufficient path validation allows attacker-controlled JSON content to be written to filesystem locations that the service account can modify
Why this happens
The underlying bug is improper limitation of a user-controlled path component. The application uses the uploaded document's _id value when determining where to store a file, but does not reliably normalize the resulting path and verify that it remains within the designated filestore directory.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The insecure pattern occurs when external input influences filesystem paths without strict filename handling, canonical-path validation, and enforcement of an allowed destination root.
Potential impact
- Attackers may write malicious or misleading JSON files outside the intended filestore directory
- The service may overwrite existing files if filesystem permissions and filename handling allow it
- Written content could alter application behavior or other locally consumed configuration data
- Attackers could establish persistence or facilitate further compromise
- Root-level service privileges could increase the scope of filesystem impact
General mitigation guidance
Mitigation generally focuses on removing user control over filesystem paths and enforcing a narrow storage boundary.
Common defensive patterns include:
- Deriving storage filenames from server-generated identifiers rather than user-supplied path components
- Treating
_idas data, not as a filesystem path or filename - Rejecting path separators, traversal markers, absolute paths, and encoded equivalents
- Canonicalizing candidate paths and verifying they remain beneath an approved storage directory
- Restricting writes to a dedicated directory with carefully controlled permissions
- Running the service as a non-root account with only the filesystem privileges it requires
- Applying strict JSON schema and content validation before persistence
- Preventing overwrites and using atomic, controlled file creation where appropriate
How teams detect issues like this
Detection approaches can include:
- Static analysis rules for filesystem APIs that concatenate request fields into paths
- Code review checks for missing canonicalization, containment validation, or filename allowlisting
- Automated tests covering encoded traversal markers, absolute paths, nested separators, and unusual Unicode representations
- Runtime monitoring for writes outside the expected PCAP filestore directory
- File integrity monitoring for unexpected
.jsonfiles or modifications performed by the Scirius service account - Policy enforcement that prevents application services from running with unnecessary root privileges

