Summary
Terrascan v1.18.3 and earlier contain a Server-Side Request Forgery (SSRF) vulnerability in the server mode API that resolves external URLs from uploaded ARM and CloudFormation templates using hashicorp/go-getter with permissive defaults.
An unauthenticated remote attacker can submit a crafted template that causes the server to fetch arbitrary URLs, including file:// paths, potentially exposing local files or accessing internal network services from the Terrascan host.
Affected context
The vulnerability affects environments running Terrascan in server mode (terrascan server) where:
- The service binds to
0.0.0.0and is accessible to untrusted clients (e.g., exposed on a network or the internet). - Users submit Infrastructure-as-Code (IaC) templates (ARM or AWS CloudFormation) to be scanned via the HTTP API.
- The Terrascan server is allowed to initiate outbound network connections and has access to local filesystem paths that should not be exposed.
In these conditions, external URL resolution within uploaded templates becomes a conduit for SSRF and local file disclosure.
Exploit preconditions
- Attack surface: Terrascan HTTP server endpoint ingesting IaC templates (ARM or CloudFormation) when run with
terrascan server. - Required access: Network reachability to the Terrascan server; no authentication required by default.
- Trigger point: Submission of a crafted template containing:
- For ARM:
templateLink.uriorparametersLink.uri - For CloudFormation:
AWS::CloudFormation::StackwithTemplateURL - Why exploitation is possible:
- Terrascan resolves referenced URLs server-side using hashicorp/go-getter with all default detectors enabled, including
FileDetector. - No allowlist, denylist, or scheme restrictions are applied to template-provided URLs.
file://URLs are processed directly, allowing reads from the local filesystem.- HTTP(S) or other reachable schemes can target internal network resources, enabling SSRF against services only accessible from the Terrascan host.
Why this happens
This issue stems from trusting user-supplied URLs inside IaC templates and passing them directly to a powerful resource-fetching library.
Terrascan, when operating in server mode, parses uploaded ARM and CloudFormation templates and automatically dereferences fields like templateLink.uri, parametersLink.uri, and TemplateURL using hashicorp/go-getter with its default detector set.
Those defaults include FileDetector, which interprets file:// schemes and certain bare paths as local filesystem locations, and network-aware detectors that follow URLs to internal or external services.
Because there is no validation, scheme restriction, or contextual check on these URLs, the behavior maps to:
- CWE-918 (Server-Side Request Forgery): untrusted input driving server-initiated requests.
- CWE-73 (External Control of File Name or Path): untrusted URLs influencing which local files are accessed.
- CWE-610 (Externally Controlled Reference to a Resource in Another Sphere): user-controlled references reaching resources beyond the intended security boundary.
The bug class is therefore "insecure remote resource resolution from untrusted template metadata without sanitization or policy enforcement."
Potential impact
- The server may fetch attacker-controlled HTTP(S) endpoints, exposing:
- Internal IPs and hostnames via timing or response content
- Metadata or sensitive responses from internal-only services
- The attacker could induce local file reads via
file://URLs, potentially revealing: - Configuration files, credentials, API keys, and tokens
- SSH keys, environment-specific secrets, or system configuration
- SSRF can be used to interact with cloud metadata services (where accessible), which can lead to:
- Credential theft for the hosting environment
- Privilege escalation into cloud accounts
- Abuse of internal service endpoints reachable only from the Terrascan host, enabling:
- Lateral movement within the network
- Interaction with internal APIs that were never meant to be internet-exposed
- Loss of confidentiality for both local host data and internal network resources.
General mitigation guidance
Because Terrascan has been archived and no patch is available, mitigation relies on deployment hardening and input trust reduction rather than version upgrades.
Defensive patterns include:
- Network exposure reduction:
- Avoid running
terrascan serverin shared or internet-exposed environments. - Place the service behind an authenticated API gateway, VPN, or other access control layer.
- Restrict inbound network access to trusted internal addresses only.
- Disable or isolate server mode where possible:
- Prefer local CLI usage over long-lived server deployments, especially in multi-tenant settings.
- If server mode is required, run it in isolated environments (e.g., dedicated containers or VMs) with minimal privileges.
- Outbound request and filesystem restrictions:
- Restrict outbound network access from the Terrascan runtime using firewall rules, egress controls, or service policies so it cannot freely call internal services or the internet.
- Use OS-level or container-level controls (e.g., read-only file systems, bind mounts, and restrictive ACLs) to limit which local files the process can read.
- Scheme and domain-level policy enforcement (architectural):
- Introduce a validating proxy or wrapper that enforces an allowlist for permissible URL schemes and hostnames (e.g., only HTTPS to approved artifact repositories).
- Reject or strip
file://URLs and other sensitive schemes at the API boundary before templates reach Terrascan. - Principle of least privilege:
- Run Terrascan under a dedicated low-privilege account with minimal file and network permissions.
- Avoid giving the runtime direct access to host-level secrets stores or sensitive configuration directories.
How teams detect issues like this
High-level detection and assurance strategies may include:
- Static and configuration analysis:
- Review infrastructure and deployment manifests for any use of
terrascan serverexposed beyond a trusted internal network. - Use configuration scanning to flag services that can initiate unrestricted outbound connections and have broad filesystem access.
- Code and architecture review:
- Examine any integration code or wrappers around Terrascan that accept template uploads; ensure that they validate or sanitize URL-bearing fields before forwarding to Terrascan.
- During security reviews, treat any automatic URL resolution or templated remote includes as high-risk and subject to explicit approval.
- Runtime monitoring:
- Monitor Terrascan hosts for unusual outbound network traffic patterns, especially requests to unexpected internal IP ranges, metadata endpoints, or
file://access attempts in logs. - Enable HTTP request logging on internal services to detect anomalous traffic originating from Terrascan nodes.
- Policy enforcement and automated checks:
- Incorporate SSRF-focused checks into CI/CD security gates, ensuring that IaC scanning tools are not exposed as multi-tenant services without compensating controls.
- Consider using automated security tooling to detect use of broad fetchers (like go-getter with default detectors) wired directly to user-controlled input.

