Details
-
Type:
Vulnerability Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:"xxx" is taken from the request parameters and not sanitized before use.
-
Default Severity:Blocker
-
Impact:High
-
Likelihood:High
-
Default Quality Profiles:Sonar way, MISRA C++ 2008 recommended
-
Targeted languages:ABAP, C#, C++, Cobol, Java, JavaScript, Objective-C, PHP, Python, VB.Net
-
Remediation Function:Constant/Issue
-
Constant Cost:20min
-
Analysis Scope:Main Sources
-
Implementation details:
-
Common Rule:Yes
-
CWE:CWE-601
-
OWASP:A7
-
SANS Top 25:Insecure Interaction Between Components
-
FindBugs:HRS_REQUEST_PARAMETER_TO_COOKIE, HRS_REQUEST_PARAMETER_TO_HTTP_HEADER
-
FindSecBugs:UNVALIDATED_REDIRECT
Description
Web applicaitons that send redirects should neutralize any values taken from a request before using them in redirects. Failing to do so could make it easier for attackers to launch phishing attacks from your site.
This rule checks that values extracted from a request are not unconditionally used directly in a redirect or other header fields.
Noncompliant Code Example
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // ... String url = request.getParameter("url"); response.sendRedirect(url); // Noncompliant; request value used directly in redirect
Compliant Solution
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // ... String url = request.getParameter("url"); if (url.matches(OKAY_URL_REGEX)) { response.sendRedirect(url); // Compliant; value used conditionally }
or
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // ... String url = request.getParameter("url"); response.sendRedirect(scrubRedirect(url)); // Compliant; method presumed to sanitize input
See
- OWASP Top 10 2017 Category A7 - Cross-Site Scripting (XSS)
- MITRE, CWE-601 - URL Redirection to Untrusted Site
- SANS Top 25 - Insecure Interaction Between Components
- Derived from FindSecBugs rule Unvalidated Redirect
Attachments
Issue Links
- is related to
-
SUPPORT-11050 Loading...