Summary
Atlantis does not consistently validate user-controlled Terraform workspace values before using them to construct local filesystem paths. An attacker who can influence an accepted repository-level configuration or authenticated planning input may cause filesystem operations outside the intended pull-request workspace, potentially leading to data integrity loss or denial of service.
Affected context
The vulnerability affects Atlantis deployments where workspace values from accepted atlantis.yaml repository configuration or authenticated /api/plan requests are joined into local workspace paths before comprehensive validation. The risk is present when traversal segments can escape the intended per-pull workspace directory and the Atlantis process has write or deletion permissions on the resulting paths.
Exploit preconditions
- Attack surface: Repository-level Atlantis configuration or the authenticated
/api/planAPI - Required access: Ability to submit or influence an accepted workspace value; API authentication may be required for API-based input
- Trigger point: Clone preparation and other working-directory operations that create, remove, or reuse workspace paths
- Why exploitation is possible: User-controlled path components are used in filesystem operations before Terraform or later validation rejects an invalid workspace name
- Privilege boundary: Filesystem changes occur with the permissions of the Atlantis process
Why this happens
The underlying bug is insufficient validation and canonicalization of user-controlled path components before they are joined with trusted base directories. Traversal segments can alter the resolved location, allowing operations such as directory creation or recursive removal to target paths outside the intended workspace. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with a related CWE-73: External Control of File Name or Path condition.
Potential impact
- An attacker may create writable directories outside the intended workspace
- An attacker could delete or alter files and directories accessible to the Atlantis process
- Repository operations may be disrupted, causing denial of service
- Workspace data may be overwritten, reused, or exposed across operations
- Terraform automation integrity could be compromised
General mitigation guidance
Mitigation generally focuses on treating workspace names as constrained identifiers rather than filesystem paths.
Common defensive patterns include:
- Allowlisting workspace names using a strict character set and bounded length
- Rejecting traversal segments, absolute paths, separators, and other path-control syntax before path construction
- Canonicalizing and verifying that the resolved path remains beneath the intended workspace root
- Keeping validation before any directory creation, deletion, cloning, or reuse operation
- Using dedicated per-operation directories with safe ownership and restrictive permissions
- Running Atlantis with the least filesystem privileges necessary and isolating its working area
- Avoiding recursive deletion of paths unless the target has been independently verified as an expected workspace
How teams detect issues like this
Detection can combine static analysis, review controls, and runtime monitoring:
- Search for user-controlled values passed to path-joining, directory creation, recursive deletion, or file-removal APIs
- Flag filesystem paths built from repository configuration or request parameters without allowlist validation and containment checks
- Review whether validation occurs before clone preparation and all working-directory operations
- Add tests for traversal segments, absolute paths, encoded separators, empty values, and normalization edge cases
- Enforce repository policies that restrict workspace naming conventions
- Monitor Atlantis processes for filesystem changes outside approved workspace roots
- Automated security review tools may help identify externally controlled path construction patterns

