{"id":"CVE-2021-41084","aliases":["CVE-2021-41084","GHSA-5vcm-3xc3-w7x3"],"related":[],"kind":"vulnerability","state":"published","title":"Response Splitting from unsanitized headers in http4s","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nhttp4s is vulnerable to response-splitting or request-splitting attacks when untrusted user input is used to create any of the following fields:\n\n* Header names (`Header.name`å\n* Header values (`Header.value`)\n* Status reason phrases (`Status.reason`)\n* URI paths (`Uri.Path`)\n* URI authority registered names (`URI.RegName`) (through 0.21)\n\nThe following backends render invalid carriage return, newline, or null characters in an unsafe fashion.\n\n|                | blaze-server | ember-server | blaze-client | ember-client | jetty-client |\n|:---------------|:-------------|:-------------|:-------------|--------------|--------------|\n| header names   | ⚠            | ⚠            | ⚠            | ⚠            |   ⚠            | \n| header values  | ⚠            | ⚠            | ⚠            | ⚠            |              |\n| status reasons | ⚠            | ⚠            |              |              |              |\n| URI paths      |              |              |  ⚠             |  ⚠             |              |\n| URI regnames   |              |              |  ⚠ < 0.22           |  ⚠ < 0.22            |              |\n\nFor example, given the following service:\n\n```scala\nimport cats.effect._\nimport org.http4s._\nimport org.http4s.dsl.io._\nimport org.http4s.server.blaze.BlazeServerBuilder\nimport scala.concurrent.ExecutionContext.global\n\nobject ResponseSplit extends IOApp {\n  override def run(args: List[String]): IO[ExitCode] =\n    BlazeServerBuilder[IO](global)\n      .bindHttp(8080)\n      .withHttpApp(httpApp)\n      .resource\n      .use(_ => IO.never)\n\n  val httpApp: HttpApp[IO] =\n    HttpApp[IO] { req =>\n      req.params.get(\"author\") match {\n        case Some(author) =>\n          Ok(\"The real content\")\n            .map(_.putHeaders(Header(\"Set-Cookie\", s\"author=${author}\")))\n        case None =>\n          BadRequest(\"No author parameter\")\n      }\n    }\n}\n```\n\nA clean `author` parameter returns a clean response:\n\n```sh\ncurl -i 'http://localhost:8080/?author=Ross'\n```\n\n```http\nHTTP/1.1 200 OK\nContent-Type: text/plain; charset=UTF-8\nSet-Cookie: author=Ross\nDate: Mon, 20 Sep 2021 04:12:10 GMT\nContent-Length: 16\n\nThe real content\n```\n\nA malicious `author` parameter allows a user-agent to hijack the response from our server and return different content:\n\n```sh\ncurl -i 'http://localhost:8080/?author=hax0r%0d%0aContent-Length:+13%0d%0a%0aI+hacked+you'\n```\n\n```http\nHTTP/1.1 200 OK\nContent-Type: text/plain; charset=UTF-8\nSet-Cookie: author=hax0r\nContent-Length: 13\n\nI hacked you\n```\n\n### Patches\n\nVersions 0.21.29, 0.22.5, 0.23.4, and 1.0.0-M27 perform the following:\n\n* If a status reasoon phrase is invalid, it is dropped. Rendering is optional per spec.\n* 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.\n* 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.\n* If a URI path or registered name is invalid in a request line, the client raises an `IllegalArgumentException`.\n* If a URI registered name is invalid in a host header, the client raises an `IllegalArgumentException`. \n\n### Workarounds\n\nhttp4s 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.\n\nNot all backends were affected: jetty-server, tomcat-server, armeria, and netty on the server; async-http-client, okhttp-client, armeria, and netty as clients.\n\n### References\n* https://owasp.org/www-community/attacks/HTTP_Response_Splitting\n* https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#fields.values\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [GitHub](http://github.com/http4s/http4s)\n* Contact us via the [http4s security policy](https://github.com/http4s/http4s/security/policy)","format":"markdown","source":"ghsa"},{"lang":"es","text":"http4s es una interfaz scala de código abierto para HTTP. En las versiones afectadas, http4s es vulnerable a ataques de división de respuestas o de peticiones cuando entradas de usuario no confiables son usadas para crear cualquiera de los siguientes campos: Header names (\"Header.name\"), Header values (\"Header.value\"), Status reason phrases (\"Status.reason\"), URI paths (\"Uri.Path\"), URI authority registered names (\"URI.RegName\") (versiones hasta 0.21). Este problema ha sido resuelto en versiones 0.21.30, 0.22.5, 0.23.4 y 1.0.0-M27 llevan a cabo lo siguiente. Como cuestión de práctica, los servicios http4s y las aplicaciones cliente deberían sanear cualquier entrada del usuario en los campos mencionados antes de devolver una petición o respuesta al backend. Los caracteres carriage return, newline y null son los más amenazantes","source":"nvd"}],"published":"2021-09-21T17:20:14.000Z","modified":"2026-07-08T06:27:29.641Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:N","score":8.7,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:L/A:N","score":4.7,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-74","CWE-918"],"affected":[{"ranges":[{"version":"<= 0.21.28","status":"affected"},{"version":">= 0.22.0, < 0.22.5","status":"affected"},{"version":">= 0.23.0, < 0.23.4","status":"affected"},{"version":">= 1.0.0-M1, < 1.0.0-M27","status":"affected"}],"vendor":"http4s","product":"http4s","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.29"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_2.12","purl":"pkg:maven/org.http4s/http4s-client_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.22.0","status":"affected","fixed":"0.22.5"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_2.12","purl":"pkg:maven/org.http4s/http4s-client_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.23.0","status":"affected","fixed":"0.23.4"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_2.12","purl":"pkg:maven/org.http4s/http4s-client_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.29"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_2.13","purl":"pkg:maven/org.http4s/http4s-client_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.22.0","status":"affected","fixed":"0.22.5"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_2.13","purl":"pkg:maven/org.http4s/http4s-client_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.23.0","status":"affected","fixed":"0.23.4"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_2.13","purl":"pkg:maven/org.http4s/http4s-client_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.29"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_3","purl":"pkg:maven/org.http4s/http4s-client_3","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.22.0","status":"affected","fixed":"0.22.5"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_3","purl":"pkg:maven/org.http4s/http4s-client_3","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.23.0","status":"affected","fixed":"0.23.4"}],"ecosystem":"Maven","package":"org.http4s:http4s-client_3","purl":"pkg:maven/org.http4s/http4s-client_3","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"0.21.28"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.10","purl":"pkg:maven/org.http4s/http4s-server_2.10","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"0.21.28"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.11","purl":"pkg:maven/org.http4s/http4s-server_2.11","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.29"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.12","purl":"pkg:maven/org.http4s/http4s-server_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.22.0","status":"affected","fixed":"0.22.5"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.12","purl":"pkg:maven/org.http4s/http4s-server_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.23.0","status":"affected","fixed":"0.23.4"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.12","purl":"pkg:maven/org.http4s/http4s-server_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.21.29"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.13","purl":"pkg:maven/org.http4s/http4s-server_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.22.0","status":"affected","fixed":"0.22.5"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.13","purl":"pkg:maven/org.http4s/http4s-server_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.23.0","status":"affected","fixed":"0.23.4"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.13","purl":"pkg:maven/org.http4s/http4s-server_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"0.21.28"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_2.13.0-M5","purl":"pkg:maven/org.http4s/http4s-server_2.13.0-M5","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.22.0","status":"affected","fixed":"0.22.5"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_3","purl":"pkg:maven/org.http4s/http4s-server_3","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0.23.0","status":"affected","fixed":"0.23.4"}],"ecosystem":"Maven","package":"org.http4s:http4s-server_3","purl":"pkg:maven/org.http4s/http4s-server_3","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.21.29"},{"status":"affected","introduced":"0.22.0","fixed":"0.22.5"},{"status":"affected","introduced":"0.23.0","fixed":"0.23.4"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"}],"vendor":"typelevel","product":"http4s","cpe":"cpe:2.3:a:typelevel:http4s:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/http4s/http4s/security/advisories/GHSA-5vcm-3xc3-w7x3","tags":["exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/http4s/http4s/commit/d02007db1da4f8f3df2dbf11f1db9ac7afc3f9d8","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#fields.values","tags":["vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://owasp.org/www-community/attacks/HTTP_Response_Splitting","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41084","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/http4s/http4s","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-41084","url":"https://www.cve.org/CVERecord?id=CVE-2021-41084","licence":"CVE Terms of Use","modified":"2024-08-04T02:59:31.504Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5vcm-3xc3-w7x3","url":"https://github.com/advisories/GHSA-5vcm-3xc3-w7x3","licence":"CC-BY-4.0","modified":"2026-07-08T06:27:29.641Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-41084","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-41084","licence":"Public domain","modified":"2026-06-17T04:07:50.633Z"}],"updatedAt":"2026-11-25T22:58:04.091Z","epss":{"score":0.01235,"percentile":0.69879,"date":"2026-12-01T12:00:22.000Z"}}