CVE-2024-29896: @kindspells/astro shield Content-Security-Policy Header Generation Vulnerability
HIGHCVE-2024-29896 is a HIGH (CVSS 7.5) content-security-policy header generation vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting @kindspells/astro shield libraries in the npm ecosystem. The issue involves content-security-policy header generation in middleware could be compromised by malicious injections. Remediation is available by upgrading affected packages to version 1.3.0.
CVE-2024-29896 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2024-29896
To remediate this vulnerability, upgrade all affected @kindspells/astro shield dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @kindspells/astro-shield@1.3.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @kindspells/astro-shield
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-29896, inspect your project dependencies using npm:
npm ls @kindspells/astro-shield
Analyze the terminal output to locate any version of @kindspells/astro shield in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.0), your application is affected.
Note: The npm ls @kindspells/astro-shield command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In @kindspells/astro shield, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-29896 Affected @kindspells/astro shield Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@kindspells/astro-shield
|
npm |
≥ 1.2.0
< 1.3.0
All 1 versions
1.2.0
|
1.3.0
|
References
Frequently Asked Questions
What is CVE-2024-29896?
Which @kindspells/astro shield versions are affected?
What version fixes CVE-2024-29896?
Is @kindspells/astro-shield affected?
What is the CVSS score of CVE-2024-29896?
What CWE is associated with CVE-2024-29896?
How can I check npm dependencies for CVE-2024-29896?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w387-5qqw-7g8m",
"modified" : "2024-09-12T13:52:22Z",
"published" : "2024-03-29T19:03:59Z",
"aliases" : [ "CVE-2024-29896" ],
"summary" : "Content-Security-Policy header generation in middleware could be compromised by malicious injections",
"details" : "### Impact\n\nWhen the following conditions are met:\n- Automated CSP headers generation for SSR content is enabled\n- The web application serves content that can be partially controlled by external users\n\nThen it is possible that the CSP headers generation feature might be \"allow-listing\" malicious injected resources like inlined JS, or references to external malicious scripts.\n\n### Patches\nAvailable in version 1.3.0 .\n\n### Workarounds\n- Do not enable CSP headers generation.\n- Use it only for dynamically generated content that cannot be controlled by external users in any way.\n\n### References\n_Are there any links users can visit to find out more?_\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@kindspells/astro-shield"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.2.0"
}, {
"fixed" : "1.3.0"
} ]
} ],
"versions" : [ "1.2.0" ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/KindSpells/astro-shield/security/advisories/GHSA-w387-5qqw-7g8m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-29896"
}, {
"type" : "WEB",
"url" : "https://github.com/KindSpells/astro-shield/commit/41b84576d37fa486a57005ea297658d0bc38566d"
}, {
"type" : "WEB",
"url" : "https://github.com/KindSpells/astro-shield/commit/ad3abf5577bae9be420b7ddf376337a5b8817869"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/KindSpells/astro-shield"
}, {
"type" : "WEB",
"url" : "https://github.com/KindSpells/astro-shield/compare/1.2.0...1.3.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-03-29T19:03:59Z",
"nvd_published_at" : "2024-03-28T13:15:47Z"
}
}