Skip to content

HTTP Response Splitting Vulnerability

Description

This code constructs an HTTP Cookie using an untrusted HTTP parameter. If this cookie is added to an HTTP response, it will allow a HTTP response splitting vulnerability.

Examples

Insecure Code

scala
new javax.servlet.http.Cookie("session", request.getParameter("session"));

Secure Code

scala
new javax.servlet.http.Cookie("session", org.owasp.encoder.Encode.forUriComponent(request.getParameter("session")));

Remediation

Validate and sanitize user input before using it to construct HTTP headers or cookies. Use a library like OWASP ESAPI to encode user input for HTTP headers.

Rule Details

FieldValue
IDCODE-0012
CategoryInjection
SeverityHIGH
CWECWE-113
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagshttp, response splitting, crlf
OWASPN/A