Summary
A path traversal vulnerability in DCMTK clients using bit-preserving C-GET storage mode allows a malicious or compromised server to cause file writes outside the intended output directory.
By supplying crafted relative or absolute paths, an attacker can redirect stored files to arbitrary locations on the client system, becoming risky wherever server-controlled filenames are not strictly validated.
Affected context
This issue occurs in DCMTK-based DICOM clients that:
- Use the bit-preserving C-GET storage mode to receive files from DICOM servers
- Accept server-provided file names or paths when writing received objects
- Do not normalize or constrain target paths to a designated output directory
In such deployments, any server the client connects to can influence where files are written if path handling is not defensive.
Exploit preconditions
- Attack surface: Network-facing DICOM C-GET interaction between client and server
- Required access: Ability to act as, control, or compromise the DICOM server that the DCMTK client connects to
- Trigger point: Server responses during bit-preserving C-GET operations that embed relative (
../) or absolute file paths - Why exploitation is possible: The client trusts server-supplied paths and writes files directly without enforcing confinement to the chosen output directory, enabling traversal to arbitrary locations.
Why this happens
The vulnerability stems from insufficient validation and normalization of file paths derived from external input in the DCMTK C-GET storage workflow.
When a client accepts paths containing directory traversal sequences or absolute paths from a server and uses them directly for file creation, it violates the expectation that all output is constrained to a specific directory.
This maps to CWE-22: Path Traversal, where untrusted path components are used in filesystem operations without enforcing a safe root or rejecting traversal patterns.
Potential impact
- Files may be written outside the intended output directory on the client system
- Attackers could overwrite or replace existing files that are writable by the client
- Configuration or log files can be tampered with, potentially altering application behavior
- Sensitive locations may be populated with malicious data, aiding persistence or further compromise
- Regulatory or privacy violations may occur if medical imaging data is stored in unintended, less protected locations
General mitigation guidance
Effective mitigation focuses on constraining filesystem operations to trusted directories and rejecting unsafe paths before writing.
Useful patterns include:
- Normalizing and resolving server-provided paths against a fixed root, then verifying they remain within the designated output directory
- Ignoring or sanitizing any directory components from server input and using locally generated file names instead
- Implementing an allowlist of permitted characters and patterns for file names, excluding traversal sequences or absolute paths
- Running DICOM clients with least-privilege filesystem permissions so that even misdirected writes have limited impact
- Treating all server-controlled metadata, including file paths, as untrusted and validating it at the boundary of the storage subsystem
How teams detect issues like this
Detection commonly relies on a combination of code and runtime analysis:
- Static analysis rules that flag use of untrusted input in file path construction or file system APIs without prior normalization or confinement checks
- Code review practices that examine how DICOM C-GET responses are transformed into local file paths, looking for direct use of remote-provided strings
- Logging and monitoring of unexpected file creations outside designated storage directories, coupled with alerts on suspicious path patterns (e.g.,
../segments) - Security testing and fuzzing of DICOM interactions to observe whether crafted paths can escape the intended output directory
Automated review tools and CI policies can help enforce path-handling guidelines across client implementations.

