CVE-2024-56140 Bypass of CSRF Middleware in Astro

Medium 5.9 Published Updated

Attackers can bypass CSRF protections in Astro when origin checks are enabled, allowing unauthorized state-changing requests.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-56140?

CVE-2024-56140 is a medium-severity vulnerability in withastro astro, published on 18 Dec 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Astro is a web framework for content-driven websites. In affected versions a bug in Astro’s CSRF-protection middleware allows requests to bypass CSRF checks. When the `security.checkOrigin` configuration option is set to `true`, Astro middleware will perform a CSRF check. However, a vulnerability exists that can bypass this security. A semicolon-delimited parameter is allowed after the type in `Content-Type`. Web browsers will treat a `Content-Type` such as `application/x-www-form-urlencoded; abc` as a `simple request` and will not perform preflight validation. In this case, CSRF is not blocked as expected. Additionally, the `Content-Type` header is not required for a request. This issue has been addressed in version 4.16.17 and all users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-352

Which versions are affected by CVE-2024-56140?

2 open source packages ship an affected version, including astro. It affects 1 product.

PackageAffectedFixed in
astro npmAll versions4.16.17
astro npmAll versions4.16.17

Products include Astro Astro.

How do I fix CVE-2024-56140?

Upgrade astro to 4.16.17 or later.

Is CVE-2024-56140 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-56140 exists.

Sources

Also known as GHSA-c4pw-33h3-35xw.

Is CVE-2024-56140 in your software?

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

Check your SBOMs for free