ADVISORIES

GitHub Advisory Database

GHSA-54w6-vxfh-fw7f

Http4s improperly parses User-Agent and Server headers

Details

Impact

The User-Agent and Server header parsers are susceptible to a fatal error on certain inputs. In http4s, modeled headers are lazily parsed, so this only applies to services that explicitly request these typed headers.

v0.21.x

val unsafe: Option[`User-Agent`] = req.headers.get(`User-Agent`)

v0.22.x, v0.23.x, v1.x

val unsafe: Option[`User-Agent`] = req.headers.get[`User-Agent`]
val alsoUnsafe: Option[`Server`] = req.headers.get[Server]

Patches

Fixes are released in 0.21.34, 0.22.15, 0.23.17, and 1.0.0-M38.

Workarounds

Use the weakly typed header interface

v0.21.x

val safe: Option[Header] = req.headers.get("User-Agent".ci)
// but don't do this
val unsafe = header.map(_.parsed) 

v0.22.x, v0.23.x, v1.x

val safe: Option[Header] = req.headers.get(ci"User-Agent")

Affected packages

EcosystemPackageAffected versions
Mavenorg.http4s:http4s-core_2.13
From 0.1.0 before 0.21.34 (fixed in 0.21.34)
Mavenorg.http4s:http4s-core_2.13
From 0.22.0 before 0.22.15 (fixed in 0.22.15)
Mavenorg.http4s:http4s-core_2.13
From 0.23.0 before 0.23.17 (fixed in 0.23.17)
Mavenorg.http4s:http4s-core_2.13
From 1.0.0-M1 before 1.0.0-M38 (fixed in 1.0.0-M38)
Mavenorg.http4s:http4s-core_2.10
From 0.1.0 up to and including 0.9.3
Mavenorg.http4s:http4s-core_2.11
From 0.1.0 up to and including 0.21.0-M1
Mavenorg.http4s:http4s-core_2.12
From 0.1.0 before 0.21.34 (fixed in 0.21.34)
Mavenorg.http4s:http4s-core_2.12
From 0.22.0 before 0.22.15 (fixed in 0.22.15)
Mavenorg.http4s:http4s-core_2.12
From 0.23.0 before 0.23.17 (fixed in 0.23.17)
Mavenorg.http4s:http4s-core
From 1.0.0-M1 up to and including 1.0.0-M30

References