Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-123067: Denial of Service Vulnerability inhttp.cookies._unquote()#123066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
ch4n3-yoon wants to merge1 commit intopython:mainfromch4n3-yoon:main

Conversation

@ch4n3-yoon
Copy link

@ch4n3-yoonch4n3-yoon commentedAug 16, 2024
edited by bedevere-appbot
Loading

Summary

Refactor and improve the_unquote() method inhttp.cookies to address the performance issues identified inCVE-2024-7592, enhancing the handling of escape sequences to prevent potential DoS vulnerabilities.

Changes

  • Updated regex patterns to optimize matching and substitution.
  • Removed inefficient loop constructs, replacing them with a streamlined regex substitution process.

Context

This update comes after the Django team acknowledged the potential for a DoS vulnerability within their use of thehttp.cookies module. The vulnerability has been formally reservedCVE-2024-7592.


Please review these changes and provide your feedback.

@ghost
Copy link

ghost commentedAug 16, 2024
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@ch4n3-yoon
Copy link
Author

Oh, I'm sorry for missing to create an issue.

@ch4n3-yoonch4n3-yoon changed the titleCVE-2024-7592: Denial of Service Vulnerability inhttp.cookies._unquote()gh-123067: Denial of Service Vulnerability inhttp.cookies._unquote()Aug 16, 2024
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@sethmlarsonsethmlarson added the type-securityA security issue labelAug 16, 2024
@picnixzpicnixz added needs backport to 3.8 needs backport to 3.10only security fixes needs backport to 3.11only security fixes needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes labelsAug 16, 2024
@sethmlarson
Copy link
Contributor

@ch4n3-yoon Can you create a news entry for this change with blurb?

j=o_match.start(0)
ifq_match:
k=q_match.start(0)
ifq_matchand (noto_matchork<j):# QuotePatt matched
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This appears to be removing all backslashes from the cookie, where the new behavior is only removing backslashes in front of quotes. Is that what we're expecting to change with this PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

From reading the RFC, I think we should preserve the original behavior of unquoting all single-character preceded by a backslash. If you agree, can we add a test case that ensures this behavior is preserved.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

_quate() can produce not only\", but also\\.

Both octal encoding and simple backslash-escaping should be handled at the same pass. Your code produces incorrect value for\134\042.

I created an alternative PR#123075 which handles such cases correctly and has some tests.

@picnixz
Copy link
Member

Closing since#123075 was considered instead.

@picnixzpicnixz removed type-securityA security issue needs backport to 3.8 needs backport to 3.10only security fixes needs backport to 3.11only security fixes needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes labelsAug 17, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@sethmlarsonsethmlarsonsethmlarson left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ch4n3-yoon@sethmlarson@picnixz@serhiy-storchaka

[8]ページ先頭

©2009-2025 Movatter.jp