Skip to content

Conversation

@LukasStordeur
Copy link
Collaborator

Description

closes security alert #80

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

jshttp/cookie#167

@LukasStordeur LukasStordeur self-assigned this Oct 9, 2024
@LukasStordeur LukasStordeur added the merge-tool-ready This ticket is ready to be merged in label Oct 9, 2024
@inmantaci
Copy link
Contributor

Processing this pull request

@inmantaci
Copy link
Contributor

Merged into branches master in 7bd13fb

inmantaci pushed a commit that referenced this pull request Oct 9, 2024
…h, and domain with out of bounds characters until version 0.6.0 (PR #5976)

# Description

closes security alert #80

## 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
jshttp/cookie#167
@inmantaci inmantaci closed this Oct 9, 2024
@inmantaci inmantaci deleted the security/80-cookie branch October 9, 2024 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-tool-ready This ticket is ready to be merged in

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants