Title: CVE-2024-7592: Denial of Service Vulnerability in `http.cookies._unquote()` · Issue #123067 · python/cpython · GitHub
Open Graph Title: CVE-2024-7592: Denial of Service Vulnerability in `http.cookies._unquote()` · Issue #123067 · python/cpython
X Title: CVE-2024-7592: Denial of Service Vulnerability in `http.cookies._unquote()` · Issue #123067 · python/cpython
Description: Bug report Bug description: Description A potential Denial of Service (DoS) vulnerability, identified as CVE-2024-7592, has been discovered in the _unquote() method of the http.cookies module in Python's standard library. This vulnerabil...
Open Graph Description: Bug report Bug description: Description A potential Denial of Service (DoS) vulnerability, identified as CVE-2024-7592, has been discovered in the _unquote() method of the http.cookies module in Py...
X Description: Bug report Bug description: Description A potential Denial of Service (DoS) vulnerability, identified as CVE-2024-7592, has been discovered in the _unquote() method of the http.cookies module in Py...
Opengraph URL: https://github.com/python/cpython/issues/123067
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CVE-2024-7592: Denial of Service Vulnerability in `http.cookies._unquote()`","articleBody":"# Bug report\n\n### Bug description:\n\n## Description\n\nA potential Denial of Service (DoS) vulnerability, identified as CVE-2024-7592, has been discovered in the `_unquote()` method of the `http.cookies` module in Python's standard library. This vulnerability is particularly concerning as it affects frameworks that utilize this method, including Django.\n\n### Vulnerable Code\n\nThe `_unquote()` function uses regular expressions `_OctalPatt` and `_QuotePatt` within a while loop to process input strings. The problematic patterns and their application can lead to exponential time complexity under certain conditions, akin to a Regular Expression Denial of Service (ReDoS) attack.\n\n```python\n# http/cookies.py\n_OctalPatt = re.compile(r\"\\\\[0-3][0-7][0-7]\")\n_QuotePatt = re.compile(r\"[\\\\].\")\ndef _unquote(str):\n # ... (code omitted for brevity)\n while 0 \u003c= i \u003c n:\n o_match = _OctalPatt.search(str, i)\n q_match = _QuotePatt.search(str, i)\n # ... (further processing)\n```\n\n## Impact\nThis vulnerability has also been verified in the Django framework, where the `parse_cookie()` function uses this method to process incoming cookie headers. This could potentially be exploited by sending specially crafted cookie values to trigger significant delays:\n\n- Cookie sizes of 8000+ bytes caused delays of approximately 0.15 seconds per HTTP request.\n- Cookie sizes of 20000+ bytes resulted in delays of about 1 second per request.\n\nWhile many environments limit HTTP request sizes, the specific limits vary, and in some cases, this vulnerability could be exploited.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-123066\n* gh-123075\n* gh-123103\n* gh-123104\n* gh-123105\n* gh-123106\n* gh-123107\n* gh-123108\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/ch4n3-yoon","@type":"Person","name":"ch4n3-yoon"},"datePublished":"2024-08-16T13:31:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/123067/cpython/issues/123067"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:962eafd7-faad-dfe3-fe29-e53db62912a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2AC:34A143:6C415F:90C735:6969868B |
| html-safe-nonce | ac7a9663964d0e7011126291deab2daf578c691044bcfd38fca9892d64717641 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkFDOjM0QTE0Mzo2QzQxNUY6OTBDNzM1OjY5Njk4NjhCIiwidmlzaXRvcl9pZCI6IjMxNTE3NDEwODQ4MzE5NDIyODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 75456f3ca1f7c00bca57d151087cf8ea2a233c5f5abdaa71743e6c2a383be8c9 |
| hovercard-subject-tag | issue:2470285353 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/123067/issue_layout |
| twitter:image | https://opengraph.githubassets.com/18bf9b20467a8450d536fcfd2752f8f2daaec5dfb1d5bd030b08da3722c3420e/python/cpython/issues/123067 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/18bf9b20467a8450d536fcfd2752f8f2daaec5dfb1d5bd030b08da3722c3420e/python/cpython/issues/123067 |
| og:image:alt | Bug report Bug description: Description A potential Denial of Service (DoS) vulnerability, identified as CVE-2024-7592, has been discovered in the _unquote() method of the http.cookies module in Py... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ch4n3-yoon |
| hostname | github.com |
| expected-hostname | github.com |
| None | 533e7cac596c452090972c1150d587fd0b36531b8dc4e8bbfe4ab694aca02408 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63d27af10eea2ccab520b162530cf6c7b739e767 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width