Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting')ID: 113 | Date: (C)2012-05-14 (M)2022-10-10 |
Type: weakness | Status: INCOMPLETE |
Abstraction Type: Base |
Description
The software receives data from an upstream component, but does
not neutralize or incorrectly neutralizes CR and LF characters before the data
is included in outgoing HTTP headers.
Extended DescriptionIncluding unvalidated data in an HTTP header allows an attacker to specify
the entirety of the HTTP response rendered by the browser. When an HTTP
request contains unexpected CR (carriage return, also given by %0d or \r)
and LF (line feed, also given by %0a or \n) characters the server may
respond with an output stream that is interpreted as two different HTTP
responses (instead of one). An attacker can control the second response and
mount attacks such as cross-site scripting and cache poisoning
attacks.HTTP response splitting weaknesses may be present when:Data enters a web application through an untrusted source, most
frequently an HTTP request.The data is included in an HTTP response header sent to a web user
without being validated for malicious characters.
Applicable PlatformsLanguage Class: All
Time Of Introduction
Related Attack Patterns
Common Consequences
Scope | Technical Impact | Notes |
---|
IntegrityAccess_Control | Modify application
dataGain privileges / assume
identity | CR and LF characters in an HTTP header may give attackers control of
the remaining headers and body of the response the application intends
to send, as well as allowing them to create additional responses
entirely under their control. |
Detection MethodsNone
Potential Mitigations
Phase | Strategy | Description | Effectiveness | Notes |
---|
Implementation | Input Validation | Construct HTTP headers very carefully, avoiding the use of
non-validated input data. | | |
Implementation | Input Validation | Assume all input is malicious. Use an "accept known good" input
validation strategy, i.e., use a whitelist of acceptable inputs that
strictly conform to specifications. Reject any input that does not
strictly conform to specifications, or transform it into something that
does.When performing input validation, consider all potentially relevant
properties, including length, type of input, the full range of
acceptable values, missing or extra inputs, syntax, consistency across
related fields, and conformance to business rules. As an example of
business rule logic, "boat" may be syntactically valid because it only
contains alphanumeric characters, but it is not valid if the input is
only expected to contain colors such as "red" or "blue."Do not rely exclusively on looking for malicious or malformed inputs
(i.e., do not rely on a blacklist). A blacklist is likely to miss at
least one undesirable input, especially if the code's environment
changes. This can give attackers enough room to bypass the intended
validation. However, blacklists can be useful for detecting potential
attacks or determining which inputs are so malformed that they should be
rejected outright. | | |
Implementation | Output Encoding | Use and specify an output encoding that can be handled by the
downstream component that is reading the output. Common encodings
include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified,
a downstream component may choose a different encoding, either by
assuming a default encoding or automatically inferring which encoding is
being used, which can be erroneous. When the encodings are inconsistent,
the downstream component might treat some character or byte sequences as
special, even if they are not special in the original encoding.
Attackers might then be able to exploit this discrepancy and conduct
injection attacks; they even might be able to bypass protection
mechanisms that assume the original encoding is also being used by the
downstream component. | | |
Implementation | Input Validation | Inputs should be decoded and canonicalized to the application's
current internal representation before being validated (CWE-180). Make
sure that the application does not decode the same input twice
(CWE-174). Such errors could be used to bypass whitelist validation
schemes by introducing dangerous inputs after they have been
checked. | | |
Relationships
Related CWE | Type | View | Chain |
---|
CWE-113 ChildOf CWE-896 | Category | CWE-888 | |
Demonstrative Examples (Details)
- The following code segment reads the name of the author of a weblog
entry, author, from an HTTP request and sets it in a cookie header of an
HTTP response.
Observed Examples
- CVE-2004-2146 : Application accepts CRLF in an object ID, allowing HTTP response splitting.
- CVE-2004-1620 : HTTP response splitting via CRLF in parameter related to URL.
- CVE-2004-1656 : HTTP response splitting via CRLF in parameter related to URL.
- CVE-2005-2060 : Bulletin board allows response splitting via CRLF in parameter.
- CVE-2005-2065 : Bulletin board allows response splitting via CRLF in parameter.
- CVE-2004-2512 : Response splitting via CRLF in PHPSESSID.
- CVE-2005-1951 : Chain: Application accepts CRLF in an object ID, allowing HTTP response splitting.
- CVE-2004-1687 : Chain: HTTP response splitting via CRLF in parameter related to URL.
For more examples, refer to CVE relations in the bottom box.
White Box Definitions None
Black Box Definitions None
Taxynomy Mappings
Taxynomy | Id | Name | Fit |
---|
PLOVER | | HTTP response splitting | |
7 Pernicious Kingdoms | | HTTP Response Splitting | |
WASC | 25 | HTTP Response Splitting | |
References:
- OWASP .OWASP TOP 10.
- Michael Howard David LeBlanc John Viega .24 Deadly Sins of Software Security. McGraw-Hill. Section:'"Sin 2: Web-Server Related Vulnerabilities (XSS, XSRF, and
Response Splitting)." Page 31'. Published on 2010.