Summary
Goploy versions before 1.18.0 contain a path traversal vulnerability in the backend /deploy/fileDiff API, which processes client-supplied file paths without sufficient restriction.
An attacker who can reach the affected endpoint may access files outside the intended comparison directory, potentially exposing sensitive application or host data.
Affected context
The vulnerability occurs in Goploy deployments using the backend File Compare API. It becomes risky when client-controlled path values are accepted by /deploy/fileDiff and resolved without reliably constraining them to an approved base directory. The practical exposure depends on endpoint reachability, authentication controls, filesystem permissions, and the sensitivity of accessible files.
Exploit preconditions
- Attack surface: The backend
/deploy/fileDiffAPI endpoint - Required access: Network access to the endpoint and any authentication or authorization required by the deployment
- Trigger point: Processing and resolving a client-provided file path during a file comparison request
- Why exploitation is possible: Insufficient path validation may allow a supplied path to escape the intended directory and reference other readable filesystem locations
Why this happens
The underlying flaw is improper limitation of a user-controlled pathname before filesystem access. When an application concatenates, normalizes, or resolves client input without enforcing a trusted directory boundary, traversal sequences or equivalent path representations may direct access outside the intended location.
This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'). The resulting exposure of unintended files may also relate to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Potential impact
- An attacker may read files outside the intended comparison directory
- Sensitive configuration, credentials, source code, or operational data could be disclosed
- Exposed files could support further compromise of the deployment environment
- Security monitoring and incident response could be hindered if sensitive system information is revealed
General mitigation guidance
Mitigation generally focuses on reducing trust in client-supplied paths and enforcing a strict filesystem boundary.
Common defensive patterns include:
- Resolving paths against a fixed trusted base directory and verifying the final canonical path remains within that directory
- Preferencing server-side file identifiers or approved relative paths over arbitrary client-provided paths
- Applying allowlists for permitted files, directories, and filename formats
- Rejecting traversal indicators, absolute paths, ambiguous encodings, and platform-specific alternate path forms
- Restricting the service account's filesystem permissions to only the directories required for deployment operations
- Returning minimal file comparison data and avoiding unnecessary disclosure of filesystem details
- Enforcing authentication, authorization, and network segmentation around deployment APIs
How teams detect issues like this
Detection approaches may include:
- Static analysis rules for filesystem APIs that consume request parameters without canonicalization and boundary checks
- Code review checks for path concatenation, direct use of query or body values, and missing base-directory validation
- Dynamic testing with traversal variants, encoded path representations, absolute paths, and platform-specific separators in controlled environments
- Web application firewall or API gateway policies that flag suspicious path patterns
- Audit logging for file comparison requests, resolved paths, authorization decisions, and unusual access outside expected deployment directories
- Automated security review tools that identify path-handling flows from request input to filesystem operations

