/

CVE-2026-47357

Severity:

HIGH RISK

(7.5)

SSRF in Terrascan Server Remote Scan API

CVE-2026-47357

Analyzed

Vulnerability type

Category:

Server-Side Request Forgery (SSRF)

CWE:

CWE-73, CWE-610, CWE-918

Impact:

Local File Disclosure and Credential Exfiltration via SSRF

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Terrascan server mode exposes a Server-Side Request Forgery (SSRF) vulnerability in its remote directory scan endpoint, allowing attacker-controlled URLs to be fetched by the server without proper validation.

By abusing go-getter's HTTP fetching and redirection behavior, an unauthenticated attacker can coerce Terrascan into reading local files and leaking credentials from the server's environment.

Affected context

This issue affects Terrascan instances run in server mode (terrascan server) that:

  • Bind the API to a network-accessible interface (default 0.0.0.0)
  • Do not sit behind an authenticating reverse proxy or gateway
  • Expose the remote directory scan endpoint:
  • POST /v1/{iac}/{iacVersion}/{cloud}/remote/dir/scan
  • Allow clients to supply remote_url with remote_type set to "http"

In this context, Terrascan delegates fetching of the remote URL to the hashicorp/go-getter library, inheriting its support for redirects and .netrc credential usage.

Exploit preconditions

  • Attack surface: Network-accessible Terrascan server endpoint at /v1/{iac}/{iacVersion}/{cloud}/remote/dir/scan.
  • Required access: None; the endpoint is unauthenticated by default when Terrascan is run in server mode.
  • Input control: Attacker can freely set:
  • remote_type to "http"
  • remote_url to an HTTP URL under their control.
  • Trigger point: When the remote directory scan is invoked, Terrascan passes remote_url directly to hashicorp/go-getter's HttpGetter.
  • Why exploitation is possible:
  • The URL is not validated, sanitized, or restricted to trusted locations.
  • HttpGetter honors the X-Terraform-Get response header, enabling redirects to file:// URLs and other schemes.
  • HttpGetter has Netrc set to true, causing it to read ~/.netrc and automatically send stored credentials to attacker-controlled hostnames.

Why this happens

The root cause combines unvalidated remote resource fetching with implicit trust in helper library behavior:

  • Terrascan's remote scan API accepts a user-supplied remote_url and forwards it directly to hashicorp/go-getter without constraining the scheme, host, or response headers.
  • go-getter's HttpGetter supports the X-Terraform-Get response header, which can instruct the client to follow redirects to arbitrary URIs, including file:// paths on the local filesystem (CWE-73: External Control of File Name or Path).
  • With Netrc enabled, HttpGetter automatically loads and uses credentials from ~/.netrc, sending them to remote hosts specified in attacker-controlled URLs (CWE-610: Use of Insufficiently Random Values in security context is related to credential management concerns; more broadly, it reflects insufficient control over credential usage).
  • This pattern maps primarily to CWE-918: Server-Side Request Forgery (SSRF), where a server acts as a proxy for attacker-controlled outbound requests, exposing internal resources and sensitive data.

Conceptually, the bug arises from treating a user-provided URL as fully trusted input for a powerful network/file retrieval client, without imposing scheme restrictions, host allowlists, or safeguards around credential usage and local file access.

Potential impact

  • May allow reading of arbitrary files accessible to the Terrascan process via file:// redirection (e.g., configuration files, SSH keys, cloud credentials).
  • Could lead to exfiltration of credentials stored in ~/.netrc, potentially including tokens or passwords for internal services.
  • Can be used to perform SSRF against internal HTTP services reachable from the Terrascan server, such as metadata endpoints or private APIs.
  • May facilitate lateral movement or privilege escalation if sensitive configuration or secrets are exposed.
  • Could enable reconnaissance of internal network topology through controlled request/response behavior.

General mitigation guidance

Since Terrascan has been archived and no patch will be released, mitigation revolves around deployment hardening and input constraints:

  • Restrict exposure of server mode:
  • Avoid running terrascan server on untrusted networks.
  • Place Terrascan behind an authenticating reverse proxy or API gateway that enforces authentication and network-level access controls.
  • Constrain outbound access:
  • Use network policies or egress filters to limit which hosts and protocols the Terrascan server can contact.
  • Block or strictly control access to internal metadata services and sensitive infrastructure endpoints.
  • Reduce local data exposure:
  • Run Terrascan under a dedicated, least-privileged account with minimal sensitive files and no critical entries in ~/.netrc.
  • Limit filesystem permissions so the process cannot read secrets or sensitive configuration files not strictly required for operation.
  • Harden URL handling at integration boundaries:
  • If Terrascan is wrapped or proxied by custom tooling, introduce validation to:
  • Allow only specific schemes (e.g., https) and approved hosts.
  • Reject or normalize values that could influence scheme redirects or file access.
  • Segregate environments:
  • Operate Terrascan in isolated environments (e.g., dedicated containers or VMs) where compromise yields minimal access to broader infrastructure.

How teams detect issues like this

Detection should focus both on code-level patterns and operational signals:

  • Code and configuration review:
  • Identify any internal tooling or wrappers that expose Terrascan's server API without proper authentication or network restrictions.
  • Look for patterns where user-controlled URLs are passed to generic fetch libraries (like go-getter) without scheme or host validation.
  • Static and dynamic analysis:
  • Use static analysis to flag:
  • Unvalidated input used in network request constructors or HTTP clients.
  • Calls into libraries known to support multiple schemes (http, file, etc.) without explicit filtering.
  • Apply dynamic application security testing (DAST) to Terrascan deployments to probe SSRF-like behavior on the remote scan endpoint.
  • Logging and monitoring:
  • Enable detailed HTTP access logs for the Terrascan server and any reverse proxies, focusing on:
  • Repeated or unusual use of the remote directory scan endpoint.
  • Suspicious remote_url values pointing to unexpected hosts.
  • Monitor outbound traffic from Terrascan hosts for connections to unknown or unapproved destinations.
  • Track anomalous filesystem access patterns if OS-level auditing is available (reads of sensitive files when running scans).
  • Policy enforcement:
  • Enforce infrastructure policies that disallow direct exposure of analysis tools like Terrascan to the internet.
  • Integrate security checks into CI/CD pipelines to verify that Terrascan is only used in offline or tightly controlled modes.

Sources

SourceLink
github.comgithub.com/tenable/terrascan

Frequently asked

questions

Yes, if Terrascan is run in server mode bound to 0.0.0.0 and exposed directly or indirectly to the internet, an unauthenticated remote attacker can exploit the remote directory scan endpoint to trigger SSRF and local file access.

No. In the default server mode configuration, the affected endpoint is unauthenticated. The main requirement is network-level access to the Terrascan server's HTTP interface.

The safest pattern is to avoid exposing server mode entirely; instead, run Terrascan as a local or CI-only tool. If server mode is unavoidable, place it behind a strongly authenticated reverse proxy, restrict who can call the remote scan endpoint, and tightly control outbound network access and filesystem permissions.

When designing APIs that accept URLs or remote locations, enforce strict allowlists for schemes and hosts, disallow ambiguous or multi-scheme libraries unless heavily constrained, and ensure that helpers do not implicitly read or send credentials (e.g., via .netrc). Additionally, run services with least privilege, limit local file visibility, and apply network egress controls so that even if SSRF paths exist, their reach and impact are minimized.

Find out what's already
exploitable in your codebase.