CVE-2021-39185 Default CORS config allows any origin with credentials

Critical 9.1 Published Updated

Default CORS configuration in Http4s allows origin reflection and null origin attacks, enabling cross-origin data access.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-39185?

CVE-2021-39185 is a critical vulnerability in http4s, published on 1 Sep 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Http4s is a minimal, idiomatic Scala interface for HTTP services. In http4s versions 0.21.26 and prior, 0.22.0 through 0.22.2, 0.23.0, 0.23.1, and 1.0.0-M1 through 1.0.0-M24, the default CORS configuration is vulnerable to an origin reflection attack. The middleware is also susceptible to a Null Origin Attack. The problem is fixed in 0.21.27, 0.22.3, 0.23.2, and 1.0.0-M25. The original `CORS` implementation and `CORSConfig` are deprecated. See the GitHub GHSA for more information, including code examples and workarounds.

Weakness: CWE-346

Which versions are affected by CVE-2021-39185?

22 open source packages ship an affected version, including org.http4s:http4s-server_2.12, org.http4s:http4s-server_2.10 and org.http4s:http4s-server_2.11. It affects 1 product.

PackageAffectedFixed in
org.http4s:http4s-server_2.12 MavenAll versions0.21.27
org.http4s:http4s-server_2.12 MavenAll versions0.21.27
org.http4s:http4s-server_2.12 MavenFrom 0.22.00.22.3
org.http4s:http4s-server_2.12 MavenFrom 0.22.00.22.3
org.http4s:http4s-server_2.12 MavenFrom 0.23.00.23.2
org.http4s:http4s-server_2.12 MavenFrom 0.23.00.23.2
16 more packages
org.http4s:http4s-server_2.10 MavenAll versionsNone
org.http4s:http4s-server_2.10 MavenAll versionsNone
org.http4s:http4s-server_2.11 MavenAll versionsNone
org.http4s:http4s-server_2.11 MavenAll versionsNone
org.http4s:http4s-server_2.13 MavenAll versions0.21.27
org.http4s:http4s-server_2.13 MavenAll versions0.21.27
org.http4s:http4s-server_2.13 MavenFrom 0.22.00.22.3
org.http4s:http4s-server_2.13 MavenFrom 0.22.00.22.3
org.http4s:http4s-server_2.13 MavenFrom 0.23.00.23.2
org.http4s:http4s-server_2.13 MavenFrom 0.23.00.23.2
org.http4s:http4s-server_2.13.0-M5 MavenAll versionsNone
org.http4s:http4s-server_2.13.0-M5 MavenAll versionsNone
org.http4s:http4s-server_3 MavenFrom 0.22.00.22.3
org.http4s:http4s-server_3 MavenFrom 0.22.00.22.3
org.http4s:http4s-server_3 MavenFrom 0.23.00.23.2
org.http4s:http4s-server_3 MavenFrom 0.23.00.23.2

Products include Typelevel Http4s.

How do I fix CVE-2021-39185?

Upgrade org.http4s:http4s-server_2.12 to a fixed version for your release line: 0.21.27, 0.22.3 or 0.23.2.

Is CVE-2021-39185 being exploited?

There is no known exploitation of CVE-2021-39185 in the wild and no public exploit code.

Sources

Also known as GHSA-52cf-226f-rhr6.

Is CVE-2021-39185 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free