CVE-2024-47764: Cookie Cookie Accepts Cookie Name, Path, Vulnerability
LOWCVE-2024-47764 is a LOW cookie accepts cookie name, path, vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Cookie libraries in the npm ecosystem. The issue involves cookie accepts cookie name, path, and domain with out of bounds characters. Remediation is available by upgrading affected packages to version 0.7.0.
CVE-2024-47764 at a Glance
How to Fix CVE-2024-47764
To remediate this vulnerability, upgrade all affected Cookie 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 cookie@0.7.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls cookie
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-47764, inspect your project dependencies using npm:
npm ls cookie
Analyze the terminal output to locate any version of Cookie in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.0), your application is affected.
Note: The npm ls cookie 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 Cookie, 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-47764 Affected Cookie Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cookie
|
npm |
< 0.7.0
|
0.7.0
|
References
Frequently Asked Questions
What is CVE-2024-47764?
Which Cookie versions are affected?
What version fixes CVE-2024-47764?
Is cookie affected?
What CWE is associated with CVE-2024-47764?
How can I check npm dependencies for CVE-2024-47764?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pxg6-pf52-xh8x",
"modified" : "2024-10-04T20:31:00Z",
"published" : "2024-10-04T20:31:00Z",
"aliases" : [ "CVE-2024-47764" ],
"summary" : "cookie accepts cookie name, path, and domain with out of bounds characters",
"details" : "### Impact\n\nThe cookie name could be used to set other fields of the cookie, resulting in an unexpected cookie value. For example, `serialize(\"userName=<script>alert('XSS3')</script>; Max-Age=2592000; a\", value)` would result in `\"userName=<script>alert('XSS3')</script>; Max-Age=2592000; a=test\"`, setting `userName` cookie to `<script>` and ignoring `value`.\n\nA similar escape can be used for `path` and `domain`, which could be abused to alter other fields of the cookie.\n\n### Patches\n\nUpgrade to 0.7.0, which updates the validation for `name`, `path`, and `domain`.\n\n### Workarounds\n\nAvoid passing untrusted or arbitrary values for these fields, ensure they are set by the application instead of user input.\n\n### References\n\n* https://github.com/jshttp/cookie/pull/167",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "cookie"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.7.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/jshttp/cookie/security/advisories/GHSA-pxg6-pf52-xh8x"
}, {
"type" : "WEB",
"url" : "https://github.com/jshttp/cookie/pull/167"
}, {
"type" : "WEB",
"url" : "https://github.com/jshttp/cookie/commit/e10042845354fea83bd8f34af72475eed1dadf5c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/jshttp/cookie"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-04T20:31:00Z",
"nvd_published_at" : null
}
}