Skip to content

Unvalidated Redirect

Description

Unvalidated redirects occur when an application redirects a user to a destination URL specified by a user-supplied parameter that is not validated. Such vulnerabilities can be used to facilitate phishing attacks.

Examples

Insecure Code

scala
response.sendRedirect(request.getParameter("url"))

Secure Code

scala
response.sendRedirect(validateAndEncodeUrl(request.getParameter("url")))

Remediation

Validate user-supplied parameters before using them in redirects. Use a whitelist of allowed URLs or ensure that the URL is properly encoded.

Rule Details

FieldValue
IDCODE-0034
CategoryWeb
SeverityHIGH
CWECWE-601
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagsredirect, phishing
OWASPN/A