CVE Vulnerabilities

CVE-2022-31109

Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling')

Published: Aug 01, 2022 | Modified: Aug 06, 2022
CVSS 3.x
6.1
MEDIUM
Source:
NVD
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CVSS 2.x
RedHat/V2
RedHat/V3
Ubuntu

laminas-diactoros is a PHP package containing implementations of the PSR-7 HTTP message interfaces and PSR-17 HTTP message factory interfaces. Applications that use Diactoros, and are either not behind a proxy, or can be accessed via untrusted proxies, can potentially have the host, protocol, and/or port of a LaminasDiactorosUri instance associated with the incoming server request modified to reflect values from X-Forwarded-* headers. Such changes can potentially lead to XSS attacks (if a fully-qualified URL is used in links) and/or URL poisoning. Since the X-Forwarded-* headers do have valid use cases, particularly in clustered environments using a load balancer, the library offers mitigation measures only in the v2 releases, as doing otherwise would break these use cases immediately. Users of v2 releases from 2.11.1 can provide an additional argument to LaminasDiactorosServerRequestFactory::fromGlobals() in the form of a LaminasDiactorosRequestFilterRequestFilterInterface instance, including the shipped LaminasDiactorosRequestFilterNoOpRequestFilter implementation which ignores the X-Forwarded-* headers. Starting in version 3.0, the library will reverse behavior to use the NoOpRequestFilter by default, and require users to opt-in to X-Forwarded-* header usage via a configured LaminasDiactorosRequestFilterLegacyXForwardedHeaderFilter instance. Users are advised to upgrade to version 2.11.1 or later to resolve this issue. Users unable to upgrade may configure web servers to reject X-Forwarded-* headers at the web server level.

Weakness

The product acts as an intermediary HTTP agent (such as a proxy or firewall) in the data flow between two entities such as a client and server, but it does not interpret malformed HTTP requests or responses in ways that are consistent with how the messages will be processed by those entities that are at the ultimate destination.

Affected Software

Name Vendor Start Version End Version
Laminas-diactoros Getlaminas * 2.11.1 (excluding)

Extended Description

HTTP requests or responses (“messages”) can be malformed or unexpected in ways that cause web servers or clients to interpret the messages in different ways than intermediary HTTP agents such as load balancers, reverse proxies, web caching proxies, application firewalls, etc. For example, an adversary may be able to add duplicate or different header fields that a client or server might interpret as one set of messages, whereas the intermediary might interpret the same sequence of bytes as a different set of messages. For example, discrepancies can arise in how to handle duplicate headers like two Transfer-encoding (TE) or two Content-length (CL), or the malicious HTTP message will have different headers for TE and CL. The inconsistent parsing and interpretation of messages can allow the adversary to “smuggle” a message to the client/server without the intermediary being aware of it. This weakness is usually the result of the usage of outdated or incompatible HTTP protocol versions in the HTTP agents.

Potential Mitigations

References