BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback
Rules / Go

Server-Side Request Forgery (SSRF)

Description

Detects user input flowing to HTTP client requests, enabling Server-Side Request Forgery attacks.

What Shoulder detects

Untrusted input from {source} reaches HTTP request at {sink}. This allows an attacker to make the server perform requests to arbitrary URLs, potentially accessing internal services or performing port scanning.

How to fix

Validate URLs against an allowlist of permitted domains.

```go
allowed := map[string]bool{"api.example.com": true}
parsed, _ := url.Parse(targetURL)
if !allowed[parsed.Host] {
    return errors.New("domain not allowed")
}
```

Learn more: https://shoulder.dev/learn/go/cwe-918/ssrf

Applies to

Languages

Frameworks

stdlib gin echo fiber chi gorilla

References

Scan for this issue

Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=go-ssrf .

Real-world examples

Known CVEs in the Server-Side Request Forgery vulnerability class that this rule helps detect.

Related rules