Every CVE Search/ Get API key

CVE-2021-41084

Response Splitting from unsanitized headers in http4s

8.7 HighFix available

http4s is an open source scala interface for HTTP. In affected versions http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields: Header names (Header.nameå), Header values (Header.value), Status reason phrases (Status.reason), URI paths (Uri.Path), URI authority registered names (URI.RegName) (through 0.21). This issue has been resolved in versions 0.21.30, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following. As a matter of practice http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
None

Exploit likelihood

1.23%Up 0.2 points since Sep 22, 2021
90%50%10%1%

What each source reports

CVE List Score used 8.7

Response Splitting from unsanitized headers in http4s

http4s is an open source scala interface for HTTP. In affected versions http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields: Header names (Header.nameå), Header values (Header.value), Status reason phrases (Status.reason), URI paths (Uri.Path), URI authority registered names (URI.RegName) (through 0.21). This issue has been resolved in versions 0.21.30, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following. As a matter of practice http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Record
CVE-2021-41084
CVSS 3.1
8.7 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
Weakness
CWE-918
Updated
2026-11-02
EUVDEUVD-2021-1987 8.7

http4s is an open source scala interface for HTTP. In affected versions http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields: Header names (Header.nameå), Header values (Header.value), Status reason phrases (Status.reason), URI paths (Uri.Path), URI authority registered names (URI.RegName) (through 0.21). This issue has been resolved in versions 0.21.30, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following. As a matter of practice http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Record
EUVD-2021-1987
CVSS 3.1
8.7 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
Updated
2026-11-03
GitHub AdvisoriesGHSA-5vcm-3xc3-w7x3 8.7

Response Splitting from unsanitized headers

Impact

http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields:

  • Header names (Header.nameå
  • Header values (Header.value)
  • Status reason phrases (Status.reason)
  • URI paths (Uri.Path)
  • URI authority registered names (URI.RegName) (through 0.21)

The following backends render invalid carriage return, newline, or null characters in an unsafe fashion.

| | blaze-server | ember-server | blaze-client | ember-client | jetty-client | |:---------------|:-------------|:-------------|:-------------|--------------|--------------| | header names | ⚠ | ⚠ | ⚠ | ⚠ | ⚠ | | header values | ⚠ | ⚠ | ⚠ | ⚠ | | | status reasons | ⚠ | ⚠ | | | | | URI paths | | | ⚠ | ⚠ | | | URI regnames | | | ⚠ < 0.22 | ⚠ < 0.22 | |

For example, given the following service:

import cats.effect._
import org.http4s._
import org.http4s.dsl.io._
import org.http4s.server.blaze.BlazeServerBuilder
import scala.concurrent.ExecutionContext.global

object ResponseSplit extends IOApp {
  override def run(args: List[String]): IO[ExitCode] =
    BlazeServerBuilder[IO](global)
      .bindHttp(8080)
      .withHttpApp(httpApp)
      .resource
      .use(_ => IO.never)

  val httpApp: HttpApp[IO] =
    HttpApp[IO] { req =>
      req.params.get("author") match {
        case Some(author) =>
          Ok("The real content")
            .map(_.putHeaders(Header("Set-Cookie", s"author=${author}")))
        case None =>
          BadRequest("No author parameter")
      }
    }
}

A clean author parameter returns a clean response:

curl -i 'http://localhost:8080/?author=Ross'
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Set-Cookie: author=Ross
Date: Mon, 20 Sep 2021 04:12:10 GMT
Content-Length: 16

The real content

A malicious author parameter allows a user-agent to hijack the response from our server and return different content:

curl -i 'http://localhost:8080/?author=hax0r%0d%0aContent-Length:+13%0d%0a%0aI+hacked+you'
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Set-Cookie: author=hax0r
Content-Length: 13

I hacked you

Patches

Versions 0.21.29, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following:

  • If a status reasoon phrase is invalid, it is dropped. Rendering is optional per spec.
  • If a header name is invalid in a request or response, the header is dropped. There is no way to generically sanitize a header without potentially shadowing a correct one.
  • If a header value is invalid in a request or response, it is sanitized by replacing null (\u0000), carriage return (\r), and newline (\n) with space ( ) characters per spec.
  • If a URI path or registered name is invalid in a request line, the client raises an IllegalArgumentException.
  • If a URI registered name is invalid in a host header, the client raises an IllegalArgumentException.

Workarounds

http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Not all backends were affected: jetty-server, tomcat-server, armeria, and netty on the server; async-http-client, okhttp-client, armeria, and netty as clients.

References

For more information

If you have any questions or comments about this advisory:

  • Open an issue in…
Record
GHSA-5vcm-3xc3-w7x3
CVSS 3.1
8.7 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
Weakness
CWE-74, CWE-918
Updated
2026-11-02
NVD 8.7

http4s is an open source scala interface for HTTP. In affected versions http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields: Header names (Header.nameå), Header values (Header.value), Status reason phrases (Status.reason), URI paths (Uri.Path), URI authority registered names (URI.RegName) (through 0.21). This issue has been resolved in versions 0.21.30, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following. As a matter of practice http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Record
CVE-2021-41084
CVSS 3.1
8.7 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
CVSS 3.1
4.7 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N
CVSS 2.0
4.3 MediumAV:N/AC:M/Au:N/C:N/I:P/A:N
Weakness
CWE-918, CWE-74
Updated
2026-11-02
OSV 4.7

http4s is an open source scala interface for HTTP. In affected versions http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields: Header names (Header.nameå), Header values (Header.value), Status reason phrases (Status.reason), URI paths (Uri.Path), URI authority registered names (URI.RegName) (through 0.21). This issue has been resolved in versions 0.21.30, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following. As a matter of practice http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Record
CVE-2021-41084
CVSS 3.1
4.7 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N
Updated
2026-11-02
OSVGHSA-5vcm-3xc3-w7x3 8.7

Response Splitting from unsanitized headers

Impact

http4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields:

  • Header names (Header.nameå
  • Header values (Header.value)
  • Status reason phrases (Status.reason)
  • URI paths (Uri.Path)
  • URI authority registered names (URI.RegName) (through 0.21)

The following backends render invalid carriage return, newline, or null characters in an unsafe fashion.

| | blaze-server | ember-server | blaze-client | ember-client | jetty-client | |:---------------|:-------------|:-------------|:-------------|--------------|--------------| | header names | ⚠ | ⚠ | ⚠ | ⚠ | ⚠ | | header values | ⚠ | ⚠ | ⚠ | ⚠ | | | status reasons | ⚠ | ⚠ | | | | | URI paths | | | ⚠ | ⚠ | | | URI regnames | | | ⚠ < 0.22 | ⚠ < 0.22 | |

For example, given the following service:

import cats.effect._
import org.http4s._
import org.http4s.dsl.io._
import org.http4s.server.blaze.BlazeServerBuilder
import scala.concurrent.ExecutionContext.global

object ResponseSplit extends IOApp {
  override def run(args: List[String]): IO[ExitCode] =
    BlazeServerBuilder[IO](global)
      .bindHttp(8080)
      .withHttpApp(httpApp)
      .resource
      .use(_ => IO.never)

  val httpApp: HttpApp[IO] =
    HttpApp[IO] { req =>
      req.params.get("author") match {
        case Some(author) =>
          Ok("The real content")
            .map(_.putHeaders(Header("Set-Cookie", s"author=${author}")))
        case None =>
          BadRequest("No author parameter")
      }
    }
}

A clean author parameter returns a clean response:

curl -i 'http://localhost:8080/?author=Ross'
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Set-Cookie: author=Ross
Date: Mon, 20 Sep 2021 04:12:10 GMT
Content-Length: 16

The real content

A malicious author parameter allows a user-agent to hijack the response from our server and return different content:

curl -i 'http://localhost:8080/?author=hax0r%0d%0aContent-Length:+13%0d%0a%0aI+hacked+you'
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Set-Cookie: author=hax0r
Content-Length: 13

I hacked you

Patches

Versions 0.21.29, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following:

  • If a status reasoon phrase is invalid, it is dropped. Rendering is optional per spec.
  • If a header name is invalid in a request or response, the header is dropped. There is no way to generically sanitize a header without potentially shadowing a correct one.
  • If a header value is invalid in a request or response, it is sanitized by replacing null (\u0000), carriage return (\r), and newline (\n) with space ( ) characters per spec.
  • If a URI path or registered name is invalid in a request line, the client raises an IllegalArgumentException.
  • If a URI registered name is invalid in a host header, the client raises an IllegalArgumentException.

Workarounds

http4s services and client applications should sanitize any user input in the aforementioned fields before returning a request or response to the backend. The carriage return, newline, and null characters are the most threatening.

Not all backends were affected: jetty-server, tomcat-server, armeria, and netty on the server; async-http-client, okhttp-client, armeria, and netty as clients.

References

For more information

If you have any questions or comments about this advisory:

  • Open an issue in…
Record
GHSA-5vcm-3xc3-w7x3
CVSS 3.1
8.7 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N
Weakness
CWE-74, CWE-918
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
org.http4s:http4s-client_2.12
Maven
through 0.21.28
0.21.29
org.http4s:http4s-client_2.12
Maven
0.22.0 to 0.22.4
0.22.5
org.http4s:http4s-client_2.12
Maven
0.23.0 to 0.23.3
0.23.4
org.http4s:http4s-client_2.13
Maven
through 0.21.28
0.21.29
org.http4s:http4s-client_2.13
Maven
0.22.0 to 0.22.4
0.22.5
org.http4s:http4s-client_2.13
Maven
0.23.0 to 0.23.3
0.23.4
org.http4s:http4s-client_3
Maven
through 0.21.28
0.21.29
org.http4s:http4s-client_3
Maven
0.22.0 to 0.22.4
0.22.5
org.http4s:http4s-client_3
Maven
0.23.0 to 0.23.3
0.23.4
org.http4s:http4s-server_2.10
Maven
through 0.21.28 None known
Show 30 moreShow less
Affected packages
PackageAffectedFixed
org.http4s:http4s-server_2.11
Maven
through 0.21.28 None known
org.http4s:http4s-server_2.12
Maven
through 0.21.28
0.21.29
org.http4s:http4s-server_2.12
Maven
0.22.0 to 0.22.4
0.22.5
org.http4s:http4s-server_2.12
Maven
0.23.0 to 0.23.3
0.23.4
org.http4s:http4s-server_2.13
Maven
through 0.21.28
0.21.29
org.http4s:http4s-server_2.13
Maven
0.22.0 to 0.22.4
0.22.5
org.http4s:http4s-server_2.13
Maven
0.23.0 to 0.23.3
0.23.4
org.http4s:http4s-server_2.13.0-M5
Maven
through 0.21.28 None known
org.http4s:http4s-server_3
Maven
0.22.0 to 0.22.4
0.22.5
org.http4s:http4s-server_3
Maven
0.23.0 to 0.23.3
0.23.4
org.http4s:http4s-client_2.12
Maven
before 0.21.29, plus listed versions
0.10.0-M100.15.00.15.0a0.15.10.15.10
Show 45 moreShow less
0.15.10a0.15.110.15.11a0.15.120.15.12a0.15.130.15.13a0.15.140.15.14a0.15.150.15.15a0.15.160.15.16a0.15.1a0.15.20.15.2a0.15.30.15.3a0.15.40.15.4a0.15.50.15.5a0.15.60.15.6a0.15.70.15.7a0.15.80.15.8a0.15.90.15.9a0.16.00.16.0-M10.16.0-M20.16.0-M30.16.0-RC10.16.0-RC20.16.0-RC30.16.0a0.16.0a-M10.16.0a-M20.16.0a-M30.16.0a-RC10.16.0a-RC20.16.0a-RC30.16.1
0.21.29
org.http4s:http4s-client_2.12
Maven
0.22.0 up to 0.22.5, plus listed versions
0.22-129-24d065b0.22-143-49b5a8d0.22-53-01128f50.22-96-55d31840.22.10.22.20.22.30.22.4
0.22.5
org.http4s:http4s-client_2.12
Maven
0.23.0 up to 0.23.4, plus listed versions
0.23.10.23.20.23.3
0.23.4
org.http4s:http4s-client_2.13
Maven
before 0.21.29, plus listed versions
0.10.0-M100.21.00.21.0-M10.21.0-M20.21.0-M3
Show 35 moreShow less
0.21.0-M40.21.0-M50.21.0-M60.21.0-RC10.21.0-RC20.21.0-RC30.21.0-RC40.21.0-RC50.21.10.21.110.21.120.21.130.21.140.21.150.21.160.21.170.21.180.21.190.21.20.21.200.21.210.21.220.21.230.21.240.21.250.21.260.21.270.21.280.21.30.21.40.21.50.21.60.21.70.21.80.21.9
0.21.29
org.http4s:http4s-client_2.13
Maven
0.22.0 up to 0.22.5, plus listed versions
0.22-129-24d065b0.22-143-49b5a8d0.22-53-01128f50.22-96-55d31840.22.10.22.20.22.30.22.4
0.22.5
org.http4s:http4s-client_2.13
Maven
0.23.0 up to 0.23.4, plus listed versions
0.23.10.23.20.23.3
0.23.4
org.http4s:http4s-client_3
Maven
before 0.21.29
0.21.29
org.http4s:http4s-client_3
Maven
0.22.0 up to 0.22.5, plus listed versions
0.22.10.22.20.22.30.22.4
0.22.5
org.http4s:http4s-client_3
Maven
0.23.0 up to 0.23.4, plus listed versions
0.23.10.23.20.23.3
0.23.4
org.http4s:http4s-server_2.10
Maven
through 0.21.28, plus listed versions
0.10.00.10.10.11.00.11.10.11.2
Show 45 moreShow less
0.11.30.12.00.12.10.12.20.12.30.12.40.12.50.12.60.13.00.13.0a0.13.10.13.1a0.13.20.13.2a0.13.30.13.3a0.14.00.14.0a0.14.10.14.100.14.10a0.14.110.14.11a0.14.1a0.14.20.14.2a0.14.30.14.3a0.14.40.14.4a0.14.50.14.5a0.14.60.14.6a0.14.70.14.7a0.14.80.14.8a0.14.90.14.9a0.15.00.15.0a0.15.10.15.100.15.10a
None known
org.http4s:http4s-server_2.11
Maven
through 0.21.28, plus listed versions
0.10.00.10.10.11.00.11.10.11.2
Show 45 moreShow less
0.11.30.12.00.12.10.12.20.12.30.12.40.12.50.12.60.13.00.13.0a0.13.10.13.1a0.13.20.13.2a0.13.30.13.3a0.14.00.14.0a0.14.10.14.100.14.10a0.14.110.14.11a0.14.1a0.14.20.14.2a0.14.30.14.3a0.14.40.14.4a0.14.50.14.5a0.14.60.14.6a0.14.70.14.7a0.14.80.14.8a0.14.90.14.9a0.15.00.15.0a0.15.10.15.100.15.10a
None known
org.http4s:http4s-server_2.12
Maven
before 0.21.29, plus listed versions
0.10.0-M100.15.00.15.0a0.15.10.15.10
Show 45 moreShow less
0.15.10a0.15.110.15.11a0.15.120.15.12a0.15.130.15.13a0.15.140.15.14a0.15.150.15.15a0.15.160.15.16a0.15.1a0.15.20.15.2a0.15.30.15.3a0.15.40.15.4a0.15.50.15.5a0.15.60.15.6a0.15.70.15.7a0.15.80.15.8a0.15.90.15.9a0.16.00.16.0-M10.16.0-M20.16.0-M30.16.0-RC10.16.0-RC20.16.0-RC30.16.0a0.16.0a-M10.16.0a-M20.16.0a-M30.16.0a-RC10.16.0a-RC20.16.0a-RC30.16.1
0.21.29
org.http4s:http4s-server_2.12
Maven
0.22.0 up to 0.22.5, plus listed versions
0.22-129-24d065b0.22-143-49b5a8d0.22-53-01128f50.22-96-55d31840.22.10.22.20.22.30.22.4
0.22.5
org.http4s:http4s-server_2.12
Maven
0.23.0 up to 0.23.4, plus listed versions
0.23.10.23.20.23.3
0.23.4
org.http4s:http4s-server_2.13
Maven
before 0.21.29, plus listed versions
0.10.0-M100.21.00.21.0-M10.21.0-M20.21.0-M3
Show 35 moreShow less
0.21.0-M40.21.0-M50.21.0-M60.21.0-RC10.21.0-RC20.21.0-RC30.21.0-RC40.21.0-RC50.21.10.21.110.21.120.21.130.21.140.21.150.21.160.21.170.21.180.21.190.21.20.21.200.21.210.21.220.21.230.21.240.21.250.21.260.21.270.21.280.21.30.21.40.21.50.21.60.21.70.21.80.21.9
0.21.29
org.http4s:http4s-server_2.13
Maven
0.22.0 up to 0.22.5, plus listed versions
0.22-129-24d065b0.22-143-49b5a8d0.22-53-01128f50.22-96-55d31840.22.10.22.20.22.30.22.4
0.22.5
org.http4s:http4s-server_2.13
Maven
0.23.0 up to 0.23.4, plus listed versions
0.23.10.23.20.23.3
0.23.4
org.http4s:http4s-server_2.13.0-M5
Maven
through 0.21.28, plus listed versions
0.20.00.20.0-RC10.20.10.20.100.20.2
Show 7 moreShow less
0.20.30.20.40.20.50.20.60.20.70.20.80.20.9
None known
org.http4s:http4s-server_3
Maven
0.22.0 up to 0.22.5, plus listed versions
0.22.10.22.20.22.30.22.4
0.22.5
org.http4s:http4s-server_3
Maven
0.23.0 up to 0.23.4, plus listed versions
0.23.10.23.20.23.3
0.23.4

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-41084 is a high vulnerability (CVSS 8.7) in Http4s, published September 21, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.23%, the 69th percentile. Fixed in org.http4s:http4s-client_2.12 0.21.29.

References

This page doesn't list everything

Left out here: 523 versions and the rest of 2 source descriptions. The JSON record has them.

MoveEnter Open