Lucene search

K
laminasLaminas Project SecurityLP-2023-01
HistoryApr 17, 2023 - 5:00 p.m.

HTTP Multiline Header Termination Vulnerability

2023-04-1717:00:00
Laminas Project Security
getlaminas.org
16
laminas-diactoros
psr-7
psr-17
http message
http client
psr-18
denial of service
patch
validation
mitigation
php
vulnerability
update
library
trim

7.5 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

0.001 Low

EPSS

Percentile

30.9%

The package laminas/laminas-diactoros (Diactoros) is a PSR-7 HTTP Message and PSR-17 HTTP Message Factory implementation, providing HTTP request and response message representations both for making HTTP client requests and responding to HTTP requests server-side. Affected versions of Diactoros accepted a single line feed (LF / \n ) character at the end of a header name. When serializing such a header name containing a line-feed into the on-the-wire representation of a HTTP/1.x message, the resulting message would be syntactically invalid, due to the header line being terminated too early. An attacker that is able to control the header names that are passed to Diactoros would be able to intentionally craft invalid messages, possibly causing application errors or invalid HTTP requests being sent out with an PSR-18 HTTP client. The latter might present a denial of service vector if a remote service’s web application firewall bans the application due to the receipt of malformed requests.

Affected versions

The following versions of Diactoros were affected:

  • <=2.18.0
  • 2.19.0
  • 2.20.0
  • 2.21.0
  • 2.22.0
  • 2.23.0
  • 2.24.0-2.24.1
  • 2.25.0-2.25.1

Action Taken

We have provided a patch that modifies the validations of header names and values such that they now identify line feeds at the start and end of these strings, invalidating the values. The following new releases were made with this patch:

  • 2.18.1
  • 2.19.1
  • 2.20.1
  • 2.21.1
  • 2.22.1
  • 2.23.1
  • 2.24.2
  • 2.25.2

Mitigations

To mitigate this vulnerability without updating your libraries, you can pass header names and values accepted from user input to trim() prior to passing them to HTTP messages:

$response = $response-&gt;withHeader(trim($headerName), trim($headerValue));

Affected configurations

Vulners
Node
laminaslaminas-diactorosRange≀2.18.0
OR
laminaslaminas-diactorosMatch2.19.0
OR
laminaslaminas-diactorosMatch2.20.0
OR
laminaslaminas-diactorosMatch2.21.0
OR
laminaslaminas-diactorosMatch2.22.0
OR
laminaslaminas-diactorosMatch2.23.0
OR
laminaslaminas-diactorosMatch2.24.0
OR
laminaslaminas-diactorosMatch2.24.1
OR
laminaslaminas-diactorosMatch2.25.0
OR
laminaslaminas-diactorosMatch2.25.1

7.5 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

NONE

Integrity Impact

NONE

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

0.001 Low

EPSS

Percentile

30.9%