Summary
Terrascan server mode exposes a Server-Side Request Forgery (SSRF) issue in the file scan endpoint's webhook_url parameter, allowing attackers to direct outbound HTTP requests to arbitrary URLs.
An unauthenticated remote attacker can cause Terrascan to POST full scan results, including a bearer token, to attacker-controlled or internal network endpoints, and the retry logic can amplify the impact of misdirected requests.
Affected context
This vulnerability exists when Terrascan is deployed in server mode (terrascan server), which by default binds to 0.0.0.0 and exposes HTTP APIs without authentication.
The affected endpoint is the file scan API:
POST /v1/{iac}/{iacVersion}/{cloud}/local/file/scan
In this mode, clients upload files for scanning and may optionally provide:
webhook_url: a URL to which Terrascan will POST scan resultswebhook_token: a token that Terrascan adds as a Bearer token in theAuthorizationheader
The vulnerability manifests when the server unconditionally trusts the webhook_url provided by the client and uses it as an HTTP target without restriction.
Exploit preconditions
- Attack surface: Publicly exposed Terrascan server HTTP API.
- Required access: None; the endpoint is unauthenticated, so any remote client who can reach the server can issue requests.
- Trigger point: Sending a
POSTrequest to/v1/{iac}/{iacVersion}/{cloud}/local/file/scanwith: - A file to scan, and
- A controlled
webhook_urlin the multipart form data. - Why exploitation is possible: The server:
- Accepts arbitrary user-supplied URLs as
webhook_urlwithout validation, filtering, or allowlisting. - Uses a retrying HTTP client that will attempt to POST up to 10 times on failure, amplifying any unwanted outbound interactions.
- Forwards the attacker-supplied
webhook_tokenas a Bearer token in theAuthorizationheader, effectively letting the attacker define the credential used in the outbound request.
Why this happens
The core issue is unvalidated, user-controlled URL usage in server-side HTTP requests, aligning with CWE-918: Server-Side Request Forgery (SSRF).
The Terrascan server trusts the webhook_url parameter from the request and uses it directly as the destination for an HTTP POST containing scan results, without:
- Restricting the scheme or host, or
- Enforcing network boundary policies (e.g., blocking access to internal metadata endpoints or internal services).
This pattern turns the server into an HTTP proxy that attackers can steer toward arbitrary destinations. The automatic retry behavior further intensifies the effect of each malicious webhook_url.
Potential impact
- Exfiltration of Terrascan scan results to attacker-controlled endpoints.
- Use of the server as an SSRF pivot to reach internal HTTP services that are not otherwise exposed externally.
- Interaction with cloud provider metadata services or management APIs if reachable from the Terrascan host, potentially accessing sensitive instance data or temporary credentials.
- Increased load and noisy traffic against internal or external targets due to up to 10 automatic retry attempts.
- Abuse of the bearer token mechanism to simulate authorized requests against targets that treat the header as a credential.
General mitigation guidance
Because the project is archived and will not receive patches, mitigation should focus on deployment hardening and reducing trust in user-controlled URLs:
- Restrict network exposure: Avoid binding Terrascan server directly to the public internet. Limit access using firewalls, reverse proxies, or API gateways, and require authentication and authorization before allowing file scan requests.
- Network egress controls: Apply outbound firewall rules or cloud egress policies so the Terrascan host can only reach approved domains or IP ranges. Deny access to internal metadata endpoints and sensitive internal services where possible.
- Application-layer controls: At the deployment wrapper or proxy layer, enforce URL validation/allowlisting on
webhook_urlparameters, permitting only trusted domains or preconfigured callback endpoints. - Token handling hygiene: Treat
webhook_tokenas untrusted; avoid reusing it for any sensitive APIs and consider stripping or overriding it at an upstream gateway. - Operational alternatives: Where possible, avoid using remote webhooks for scan results; instead, retrieve results from Terrascan directly over a controlled, authenticated channel.
How teams detect issues like this
Detection can focus on both configuration and runtime behavior:
- Configuration and code review:
- Flag any services that accept user-controlled callback URLs and subsequently perform server-side HTTP requests without validation.
- Look for HTTP client usage that directly consumes request parameters as URLs, especially in webhook or callback features.
- Static analysis and policy enforcement:
- Use static analysis rules to detect flows from HTTP request parameters to HTTP client destinations without sanitization or allowlisting.
- Enforce infrastructure-as-code policies that prevent exposing Terrascan server directly to the internet or without authentication.
- Network and runtime monitoring:
- Inspect outbound HTTP traffic from Terrascan hosts for unusual destinations or spikes in retrying requests.
- Configure IDS/IPS or egress proxies to alert when internal-only endpoints (e.g., metadata services, admin APIs) are accessed from the Terrascan environment.
- Correlate file scan API calls with subsequent unexpected outbound requests to detect active SSRF attempts.

