Auditing HTTP message validation across application components
Web services need consistent message handling and permission boundaries across their supported protocols and entry points. Understanding HTTP message validation across application components helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Input validation defines the structures, sizes and meanings an application expects to receive. It must happen before information influences a sensitive operation. Validation does not replace safe interpreter APIs, output encoding or permission checks, because those controls address different boundaries.
This section explains how the structure and header fields of an HTTP message should be validated to prevent attacks such as request smuggling, response splitting, header injection, and denial of service via overly long HTTP messages.
Why it matters
Consider a realistic failure: an alternate API representation or real-time channel reaches a protected operation with weaker checks.
Untrusted input can change application behaviour, consume excessive resources or reach data and execution paths outside the intended feature. The practical result depends on where the value is used and which privileges are available there.
A code audit connects a stated requirement to the implementation responsible for enforcing it. Source review and targeted behavioural checks should explain the same boundary and any relevant exceptions.
How penetration testers check for it
Review the specific control expectations below against the code, deployment and observable application behaviour.
- Confirm that all application components (including load balancers, firewalls, and application servers) determine boundaries of incoming HTTP messages using the appropriate mechanism for the HTTP version to prevent HTTP request smuggling. In HTTP/1.x, if a Transfer-Encoding header field is present, the Content-Length header must be ignored per RFC 2616. When using HTTP/2 or HTTP/3, if a Content-Length header field is present, the receiver must ensure that it is consistent with the length of the DATA frames.
- Confirm that when generating HTTP messages, the Content-Length header field does not conflict with the length of the content as determined by the framing of the HTTP protocol, in order to prevent request smuggling attacks.
- Confirm that the application does not send nor accept HTTP/2 or HTTP/3 messages with connection-specific header fields such as Transfer-Encoding to prevent response splitting and header injection attacks.
- Confirm that the application only accepts HTTP/2 and HTTP/3 requests where the header fields and values do not contain any CR (\r), LF (\n), or CRLF (\r\n) sequences, to prevent header injection attacks.
- Verify that, if the application (backend or frontend) builds and sends requests, it uses validation, sanitization, or other mechanisms to avoid creating URIs or HTTP request header fields, which are too long to be accepted by the receiving component. This could cause a denial of service, such as when sending an overly long request, which results in the server always responding with an error status.
- Compare parsing across components and alternate request formats.
- Use controlled invalid inputs to establish effects rather than assumptions.
How to fix it
Implement the required boundary in the component that actually performs the sensitive operation and retain focused regression coverage.
- Use explicit schemas and canonical representations.
- Prefer safe parsers and parameterised interpreter interfaces.
- Reject unexpected structures before sensitive processing.
- Apply resource bounds and predictable failure handling.
Blocking a few known attack strings is not a complete validation strategy. The intended data model and downstream interpretation determine which protections are needed.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- HTTP request smuggling across API proxies
- Auditing application input validation and canonicalisation
- Reviewing OpenID Connect client login validation
Read about our methodology or contact pentested.com to discuss the security of your application code.