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

V5909. OWASP. Possible XSS vulnerability. Potentially tainted data might be used to inject a malicious script.

Nov 26 2026

The analyzer has detected that data received by the server from an external source could be used as executable code on the client side. This could create an opportunity for an XSS attack.

XSS vulnerabilities fall under the following category in the OWASP Top 10 Application Security Risks 2025: A05:2025 Injection.

The example:

func ProcessRequest(w http.ResponseWriter, r *http.Request) {
  cookie, err := r.Cookie("userName")
  ....
  w.Header().Set("Content-Type", "text/html")

  w.Write([]byte("<html><body><p>Welcome, " + 
                 cookie.Value + 
                 "</p></body></html>"))
}

In the code, the username is retrieved from the request and then immediately inserted into the HTML markup. If, instead of a username, the cookie contains HTML markup such as <script>alert("XSS Injection")</script>, rendering this HTML will execute third-party, potentially malicious code.

To fix this potential vulnerability, escape all special HTML characters in data received from an external source before inserting it into HTML. You can do this using the html.EscapeString function:

func ProcessRequest(w http.ResponseWriter, r *http.Request) {
  cookie, err := r.Cookie("userName")
  ....
  w.Header().Set("Content-Type", "text/html")

  userName := html.EscapeString(cookie.Value)

  w.Write([]byte("<html><body><p>Welcome, " + 
                 userName + 
                 "</p></body></html>"))
}

For more information about XSS attacks and how to protect against them, visit the OWASP Cheat Sheet Series page.

This diagnostic rule is classified as: