ghsa-pxg6-pf52-xh8x
Vulnerability from github
Impact
The 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
.
A similar escape can be used for path
and domain
, which could be abused to alter other fields of the cookie.
Patches
Upgrade to 0.7.0, which updates the validation for name
, path
, and domain
.
Workarounds
Avoid passing untrusted or arbitrary values for these fields, ensure they are set by the application instead of user input.
References
- https://github.com/jshttp/cookie/pull/167
{ affected: [ { package: { ecosystem: "npm", name: "cookie", }, ranges: [ { events: [ { introduced: "0", }, { fixed: "0.7.0", }, ], type: "ECOSYSTEM", }, ], }, ], aliases: [ "CVE-2024-47764", ], database_specific: { cwe_ids: [ "CWE-74", ], github_reviewed: true, github_reviewed_at: "2024-10-04T20:31:00Z", nvd_published_at: null, severity: "LOW", }, 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", id: "GHSA-pxg6-pf52-xh8x", modified: "2024-10-04T20:31:00Z", published: "2024-10-04T20:31:00Z", 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", }, ], schema_version: "1.4.0", severity: [], summary: "cookie accepts cookie name, path, and domain with out of bounds characters", }
Log in or create an account to share your comment.
This schema specifies the format of a comment related to a security advisory.
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.