Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
>
V5912. OWASP. Possible server-side...
menu mobile close menu
Analyzing projects
Additional information
toggle menu Contents

V5912. OWASP. Possible server-side request forgery. Potentially tainted data in the URL is used to access a remote resource.

Nov 26 2026

The analyzer has detected a request to a remote resource without validation of the user-provided URL. Using unvalidated external data to construct a URL can lead to Server-Side Request Forgery (SSRF).

Server-Side Request Forgery vulnerabilities can be categorized under the OWASP Top 10 Application Security Risks 2025: A01:2025 Broken Access Control.

The example:

func fetchHandler(w http.ResponseWriter, r *http.Request) {
  target := r.URL.Query().Get("url")

  resp, err := http.Get(target)
  if err != nil {
    http.Error(w, "request failed", http.StatusBadGateway)
    return
  }

  defer resp.Body.Close()
  io.Copy(w, resp.Body)
}

In this example, target may contain tainted data, as it comes from an external source. The server uses this address to form a request and executes it on its own behalf. The request can be sent to any web resource or to the server itself.

As a result, an attacker can send requests to resources they cannot access directly and receive the responses.

Tainted data example:

http://169.254.169.254/latest/meta-data/

This address returns metadata of the cloud infrastructure the server runs in.

Also, avoid using a blocklist or regular expressions to protect against SSRF. An attacker can easily bypass these restrictions in the following ways:

  • Redirection: an attacker can create an external resource that responds with a redirect to another URL.
  • Alternative representations:
http://2130706433/ = http://127.0.0.1
http://0x7f000001/ = http://127.0.0.1

The fixed example that checks hosts against an allowlist:

func fetchHandler(w http.ResponseWriter, r *http.Request) {
  u, err := url.Parse(r.URL.Query().Get("url"))
  if err != nil {
    http.Error(w, "invalid url", http.StatusBadRequest)
    return
  }

  if _, ok := allowedHosts[u.Hostname()]; !ok {
    http.Error(w, "host is not allowed", http.StatusForbidden)
    return
  }

  resp, err := http.Get(u.String())
  if err != nil {
    http.Error(w, "request failed", http.StatusBadGateway)
    return
  }

  defer resp.Body.Close()
  io.Copy(w, resp.Body)
}

This diagnostic rule is classified as: