Every CVE Search/ Get API key

CVE-2024-56140

Bypass of CSRF Middleware in Astro

5.9 MediumFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
High
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
Low
Integrity
High
Availability
None

Exploit likelihood

0.22%Up 0.2 points since Dec 19, 2024
90%50%10%1%

What each source reports

CVE List Score used 5.9

Bypass of CSRF Middleware in Astro

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.

Record
CVE-2024-56140
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N
Weakness
CWE-352
Updated
2026-11-02
EUVDEUVD-2024-3575 5.9

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.

Record
EUVD-2024-3575
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N
Updated
2026-11-03
GitHub AdvisoriesGHSA-c4pw-33h3-35xw 5.9

Atro CSRF Middleware Bypass (security.checkOrigin)

Summary

A bug in Astro’s CSRF-protection middleware allows requests to bypass CSRF checks.

Details

When the security.checkOrigin configuration option is set to true, Astro middleware will perform a CSRF check. (Source code: https://github.com/withastro/astro/blob/6031962ab5f56457de986eb82bd24807e926ba1b/packages/astro/src/core/app/middlewares.ts)

For example, with the following Astro configuration:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
	output: 'server',
	security: { checkOrigin: true },
	adapter: node({ mode: 'standalone' }),
});

A request like the following would be blocked if made from a different origin:

// fetch API or <form action="https://test.example.com/" method="POST">
fetch('https://test.example.com/', {
	method: 'POST',
	credentials: 'include',
	body: 'a=b',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
});
// => Cross-site POST form submissions are forbidden

However, a vulnerability exists that can bypass this security.

Pattern 1: Requests with a semicolon after the Content-Type

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.

fetch('https://test.example.com', {
	method: 'POST',
	credentials: 'include',
	body: 'test',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded; abc' },
});
// => Server-side functions are executed (Response Code 200).

Pattern 2: Request without Content-Type header

The Content-Type header is not required for a request. The following examples are sent without a Content-Type header, resulting in CSRF.

// Pattern 2.1 Request without body
fetch('http://test.example.com', { method: 'POST', credentials: 'include' });

// Pattern 2.2 Blob object without type
fetch('https://test.example.com', {
	method: 'POST',
	credentials: 'include',
	body: new Blob(['a=b'], {}),
});

Impact

Bypass CSRF protection implemented with CSRF middleware.

[!Note] Even with credentials: 'include', browsers may not send cookies due to third-party cookie blocking. This feature depends on the browser version and settings, and is for privacy protection, not as a CSRF measure.

Record
GHSA-c4pw-33h3-35xw
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N
Weakness
CWE-352
Updated
2026-11-02
NVD 5.9

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.

Record
CVE-2024-56140
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N
CVSS 3.1
6.5 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Weakness
CWE-352
Updated
2026-11-02
OSV 5.9

Bypass of CSRF Middleware in Astro

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.

Record
CVE-2024-56140
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N
Weakness
CWE-352
Updated
2026-11-02
OSVGHSA-c4pw-33h3-35xw 5.9

Atro CSRF Middleware Bypass (security.checkOrigin)

Summary

A bug in Astro’s CSRF-protection middleware allows requests to bypass CSRF checks.

Details

When the security.checkOrigin configuration option is set to true, Astro middleware will perform a CSRF check. (Source code: https://github.com/withastro/astro/blob/6031962ab5f56457de986eb82bd24807e926ba1b/packages/astro/src/core/app/middlewares.ts)

For example, with the following Astro configuration:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import node from '@astrojs/node';

export default defineConfig({
	output: 'server',
	security: { checkOrigin: true },
	adapter: node({ mode: 'standalone' }),
});

A request like the following would be blocked if made from a different origin:

// fetch API or <form action="https://test.example.com/" method="POST">
fetch('https://test.example.com/', {
	method: 'POST',
	credentials: 'include',
	body: 'a=b',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
});
// => Cross-site POST form submissions are forbidden

However, a vulnerability exists that can bypass this security.

Pattern 1: Requests with a semicolon after the Content-Type

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.

fetch('https://test.example.com', {
	method: 'POST',
	credentials: 'include',
	body: 'test',
	headers: { 'Content-Type': 'application/x-www-form-urlencoded; abc' },
});
// => Server-side functions are executed (Response Code 200).

Pattern 2: Request without Content-Type header

The Content-Type header is not required for a request. The following examples are sent without a Content-Type header, resulting in CSRF.

// Pattern 2.1 Request without body
fetch('http://test.example.com', { method: 'POST', credentials: 'include' });

// Pattern 2.2 Blob object without type
fetch('https://test.example.com', {
	method: 'POST',
	credentials: 'include',
	body: new Blob(['a=b'], {}),
});

Impact

Bypass CSRF protection implemented with CSRF middleware.

[!Note] Even with credentials: 'include', browsers may not send cookies due to third-party cookie blocking. This feature depends on the browser version and settings, and is for privacy protection, not as a CSRF measure.

Record
GHSA-c4pw-33h3-35xw
CVSS 3.1
5.9 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:H/A:N
Weakness
CWE-352
Updated
2026-11-02
Show 13 moreShow less
OSVCLSA-2026-1777855417 No score

TuxCare security update for astro (10 CVEs)

TuxCare rebuilt astro to address 10 CVEs. Fixed in 1.9.2-tuxcare.1.

Record
CLSA-2026-1777855417
Updated
2026-11-02
OSVCLSA-2026-1777855422 No score

TuxCare security update for astro (10 CVEs)

TuxCare rebuilt astro to address 10 CVEs. Fixed in 0.26.1-tuxcare.1.

Record
CLSA-2026-1777855422
Updated
2026-11-02
OSVCLSA-2026-1777941830 No score

TuxCare security update for astro (10 CVEs)

TuxCare rebuilt astro to address 10 CVEs. Fixed in 2.10.15-tuxcare.1.

Record
CLSA-2026-1777941830
Updated
2026-11-02
OSVCLSA-2026-1778633121 No score

TuxCare security update for astro (11 CVEs)

TuxCare rebuilt astro to address 11 CVEs. Fixed in 3.6.5-tuxcare.1.

Record
CLSA-2026-1778633121
Updated
2026-11-02
OSVCLSA-2026-1792161544 No score

TuxCare security update for @astrojs/internal-helpers (11 CVEs)

TuxCare rebuilt @astrojs/internal-helpers to address 11 CVEs. Fixed in 2.10.15-tuxcare.1.

Record
CLSA-2026-1792161544
Updated
2026-11-02
OSVCLSA-2026-1792161546 No score

TuxCare security update for @astrojs/internal-helpers (13 CVEs)

TuxCare rebuilt @astrojs/internal-helpers to address 13 CVEs. Fixed in 3.6.5-tuxcare.1.

Record
CLSA-2026-1792161546
Updated
2026-11-02
OSVCLSA-2026-1792161681 No score

TuxCare security update for @astrojs/prism (10 CVEs)

TuxCare rebuilt @astrojs/prism to address 10 CVEs. Fixed in 1.9.2-tuxcare.1.

Record
CLSA-2026-1792161681
Updated
2026-11-02
OSVCLSA-2026-1792161682 No score

TuxCare security update for @astrojs/prism (10 CVEs)

TuxCare rebuilt @astrojs/prism to address 10 CVEs. Fixed in 0.26.1-tuxcare.1.

Record
CLSA-2026-1792161682
Updated
2026-11-02
OSVCLSA-2026-1792161683 No score

TuxCare security update for @astrojs/prism (11 CVEs)

TuxCare rebuilt @astrojs/prism to address 11 CVEs. Fixed in 2.10.15-tuxcare.1.

Record
CLSA-2026-1792161683
Updated
2026-11-02
OSVCLSA-2026-1792161686 No score

TuxCare security update for @astrojs/prism (13 CVEs)

TuxCare rebuilt @astrojs/prism to address 13 CVEs. Fixed in 3.6.5-tuxcare.1.

Record
CLSA-2026-1792161686
Updated
2026-11-02
OSVCLSA-2026-1792161775 No score

TuxCare security update for @astrojs/underscore-redirects (11 CVEs)

TuxCare rebuilt @astrojs/underscore-redirects to address 11 CVEs. Fixed in 2.10.15-tuxcare.1.

Record
CLSA-2026-1792161775
Updated
2026-11-02
OSVCLSA-2026-1792161777 No score

TuxCare security update for @astrojs/underscore-redirects (13 CVEs)

TuxCare rebuilt @astrojs/underscore-redirects to address 13 CVEs. Fixed in 3.6.5-tuxcare.1.

Record
CLSA-2026-1792161777
Updated
2026-11-02
OSVCLSA-2026-1792161848 No score

TuxCare security update for @astrojs/upgrade (13 CVEs)

TuxCare rebuilt @astrojs/upgrade to address 13 CVEs. Fixed in 3.6.5-tuxcare.1.

Record
CLSA-2026-1792161848
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
astro
npm
before 4.16.17
4.16.17
astro
TuxCare:npm
From an advisory covering 10 CVEs
1.9.2-tuxcare.0 up to 1.9.2-tuxcare.1, plus listed versions
1.9.2
1.9.2-tuxcare.1
astro
TuxCare:npm
From an advisory covering 10 CVEs
0.26.1-tuxcare.0 up to 0.26.1-tuxcare.1, plus listed versions
0.26.1
0.26.1-tuxcare.1
astro
TuxCare:npm
From an advisory covering 10 CVEs
2.10.15-tuxcare.0 up to 2.10.15-tuxcare.1, plus listed versions
2.10.15
2.10.15-tuxcare.1
astro
TuxCare:npm
From an advisory covering 11 CVEs
3.6.5-tuxcare.0 up to 3.6.5-tuxcare.1, plus listed versions
3.6.5
3.6.5-tuxcare.1
@astrojs/internal-helpers
TuxCare:npm
From an advisory covering 11 CVEs
2.10.15-tuxcare.0 up to 2.10.15-tuxcare.1, plus listed versions
2.10.15
2.10.15-tuxcare.1
@astrojs/internal-helpers
TuxCare:npm
From an advisory covering 13 CVEs
3.6.5-tuxcare.0 up to 3.6.5-tuxcare.1, plus listed versions
3.6.5
3.6.5-tuxcare.1
@astrojs/prism
TuxCare:npm
From an advisory covering 10 CVEs
1.9.2-tuxcare.0 up to 1.9.2-tuxcare.1, plus listed versions
1.9.2
1.9.2-tuxcare.1
@astrojs/prism
TuxCare:npm
From an advisory covering 10 CVEs
0.26.1-tuxcare.0 up to 0.26.1-tuxcare.1, plus listed versions
0.26.1
0.26.1-tuxcare.1
@astrojs/prism
TuxCare:npm
From an advisory covering 11 CVEs
2.10.15-tuxcare.0 up to 2.10.15-tuxcare.1, plus listed versions
2.10.15
2.10.15-tuxcare.1
Show 4 moreShow less
Affected packages
PackageAffectedFixed
@astrojs/prism
TuxCare:npm
From an advisory covering 13 CVEs
3.6.5-tuxcare.0 up to 3.6.5-tuxcare.1, plus listed versions
3.6.5
3.6.5-tuxcare.1
@astrojs/underscore-redirects
TuxCare:npm
From an advisory covering 11 CVEs
2.10.15-tuxcare.0 up to 2.10.15-tuxcare.1, plus listed versions
2.10.15
2.10.15-tuxcare.1
@astrojs/underscore-redirects
TuxCare:npm
From an advisory covering 13 CVEs
3.6.5-tuxcare.0 up to 3.6.5-tuxcare.1, plus listed versions
3.6.5
3.6.5-tuxcare.1
@astrojs/upgrade
TuxCare:npm
From an advisory covering 13 CVEs
3.6.5-tuxcare.0 up to 3.6.5-tuxcare.1, plus listed versions
3.6.5
3.6.5-tuxcare.1

History

History
RecordedChangedSources
affected, facts
aliasesEUVD
first indexedCVE List, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2024-56140 is a medium vulnerability (CVSS 5.9) in Astro, published December 18, 2024. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.22%, the 12th percentile. Fixed in astro 4.16.17.

References

MoveEnter Open