Summary
AWS diagram-as-code contains a relative path traversal vulnerability in its ZIP extraction functionality. A third party who can supply or influence a crafted diagram bundle may cause arbitrary files to be written to the local filesystem, potentially altering files used by the application or surrounding environment.
Affected context
The issue affects aws diagram-as-code deployments that use the vulnerable ZIP extraction functionality in versions 0.10 through 0.23. Risk is present when an attacker can provide, replace, or otherwise influence a diagram bundle that the application extracts, and when the extraction process does not constrain archive entries to the intended destination directory.
Exploit preconditions
- Attack surface: ZIP or diagram-bundle extraction functionality
- Required access: Ability to supply or influence an archive processed by aws diagram-as-code
- Trigger point: Extraction of archive entries to the local filesystem
- Why exploitation is possible: Archive entry names are not sufficiently restricted to the target extraction directory, allowing relative path traversal to redirect writes outside the intended location
Why this happens
The vulnerability results from extracting archive entries without canonicalizing and validating their resolved paths against the designated destination directory. When archive-controlled names containing relative traversal sequences are trusted, the extraction routine may write files outside the intended directory. This behavior maps to CWE-23: Relative Path Traversal, because attacker-influenced path components can alter the effective filesystem location of a write operation.
Potential impact
- Arbitrary files may be created or overwritten on the local filesystem
- Application configuration or other operational files could be altered
- Local data could be corrupted or replaced
- Subsequent application behavior may be influenced by attacker-controlled files
- The host or process may be exposed to additional compromise depending on file permissions and execution context
General mitigation guidance
Mitigation generally focuses on treating archive contents as untrusted and enforcing destination confinement during extraction.
Common defensive patterns include:
- Canonicalizing each extracted path before writing it
- Ensuring the resolved path remains beneath the intended extraction directory
- Rejecting absolute paths, traversal components, and ambiguous path representations
- Using archive extraction APIs that provide safe path handling by default
- Extracting with least-privilege filesystem permissions and into isolated temporary directories
- Limiting which files and file types a diagram bundle may contain
- Using a maintained release that includes a correction for the extraction logic
How teams detect issues like this
Organizations can identify related risks through:
- Static analysis for archive extraction APIs that concatenate entry names with filesystem paths
- Code review checks for missing canonicalization and destination-boundary validation
- Tests covering traversal sequences, absolute paths, symbolic links, and platform-specific path forms
- Dependency and release policy checks for vulnerable aws diagram-as-code versions
- Runtime monitoring for unexpected writes outside approved bundle directories
- Automated security review tools that flag archive extraction without path confinement

