René's URL Explorer Experiment


Title: `SimpleCookie` regex can make parsing extremely slow for adversarial payloads · Issue #149028 · python/cpython · GitHub

Open Graph Title: `SimpleCookie` regex can make parsing extremely slow for adversarial payloads · Issue #149028 · python/cpython

X Title: `SimpleCookie` regex can make parsing extremely slow for adversarial payloads · Issue #149028 · python/cpython

Description: Bug report Bug description: The current version of http.cookies has a potential performance/security regression (seemingly introduced by #113663) and detected through fuzzing, where a bad cookie payload could significantly slow down requ...

Open Graph Description: Bug report Bug description: The current version of http.cookies has a potential performance/security regression (seemingly introduced by #113663) and detected through fuzzing, where a bad cookie pa...

X Description: Bug report Bug description: The current version of http.cookies has a potential performance/security regression (seemingly introduced by #113663) and detected through fuzzing, where a bad cookie pa...

Opengraph URL: https://github.com/python/cpython/issues/149028

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`SimpleCookie` regex can make parsing extremely slow for adversarial payloads","articleBody":"# Bug report\n\n### Bug description:\n\nThe current version of `http.cookies` has a potential performance/security regression (seemingly introduced by #113663) and detected through fuzzing, where a bad cookie payload could significantly slow down request processing on a server relying on `SimpleCookie` (such as `bottle` [here](https://github.com/bottlepy/bottle/blob/2a743a3/bottle.py#L1175) or `tornado` [there](https://github.com/tornadoweb/tornado/blob/3251ead/tornado/httputil.py#L551)). Such a cookie could be easily be crafted by a bad actor, leading to potential denial of service. \n\n[This branch](https://github.com/python/cpython/compare/main...KowalskiThomas:cpython:kowalski/fix-avoid-slow-regex-in-cookie-parsing) on my fork proposes ~an alternative regular expression that does not seem to have the problem~ (removed this to make it clear that my intention was _not_ to get that merged 😅) as well as a reproducer. When run (without the regex change), it clearly shows the problem:\n\n```\n$ ./python reproducer_cookie_redos.py\nTiming SimpleCookie().load() with increasing payload size\n  units   bytes        time\n      1      18      0.0001s\n      2      36      0.0001s\n      3      54      0.0003s\n      4      72      0.0010s\n      5      90      0.0042s\n      6     108      0.0163s\n      7     126      0.0648s\n      8     144      0.2560s\n      9     162      1.0294s\n     10     180      4.1919s\n     11     198     16.6055s\n```\n\nFor reference, the reproducer is \n\n```py\nimport sys\nimport time\nimport http.cookies\n\n_UNIT = 'x=\"qu\\\\\"qu\\\\\\\\\"quot\u003c'   # raw: x=\"qu\\\"qu\\\\\"quot\u003c\n\ndef make_payload(units: int = 11) -> str:\n    \"\"\"Return a Cookie header value that causes ~4^units backtrack steps.\"\"\"\n    return (\" \" + _UNIT) * units\n\nprint(\"Timing SimpleCookie.load with increasing payload size\")\nprint(f\"  {'units':>5}  {'bytes':>6}  {'time':>10}\")\nfor n in range(1, 14):\n    payload = make_payload(n)\n    start = time.perf_counter()\n    http.cookies.SimpleCookie().load(payload)\n    elapsed = time.perf_counter() - start\n    print(f\"  {n:>5}  {len(payload):>6}  {elapsed:>10.4f}s\")\n    if elapsed > 10:\n        print(\"  (stopping)\")\n        break\n```\n\n**Note**  I did not report this as a security issue because the original PR went out in August 2025; 3.14 was already in beta and so only the unreleased version of Python is affected. I downloaded and built 3.14 manually to make sure, and 3.14 is _not_ affected by this regression.\n\n> The PSRT does not accept reports that only affect pre-release versions of software, as these features are considered \"in-development\", please open public issues. ([source](https://www.python.org/dev/security/))\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-149145\n* gh-149182\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/KowalskiThomas","@type":"Person","name":"KowalskiThomas"},"datePublished":"2026-04-26T20:16:57Z","url":"https://github.com/python/cpython/issues/149028"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8be103b4-948f-558e-eddf-3c310143f8eb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD246:38E318:32D9B88:4063F0F:6B020950
html-safe-nonce768bdaf709757bc3516fab2bb0c459fce1affc5dfde023a5b9b34d9028e10f4f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjQ2OjM4RTMxODozMkQ5Qjg4OjQwNjNGMEY6NkIwMjA5NTAiLCJ2aXNpdG9yX2lkIjoiODY1MDQxODM4OTEzNjgzNjk0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac85993d2efe816d93b5e8a24e8af1e4960638fbebf69de96a16d33dff460141ed
hovercard-subject-tagissue:4331878791
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/149028/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0c4d8da5e4a5e838f0dbaee351e51b69dedd6d9e9f27ea6b4f4346b2b7fe2490/python/cpython/issues/149028
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0c4d8da5e4a5e838f0dbaee351e51b69dedd6d9e9f27ea6b4f4346b2b7fe2490/python/cpython/issues/149028
og:image:altBug report Bug description: The current version of http.cookies has a potential performance/security regression (seemingly introduced by #113663) and detected through fuzzing, where a bad cookie pa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameKowalskiThomas
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/149028#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F149028
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F149028
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/149028
Reloadhttps://github.com/python/cpython/issues/149028
Reloadhttps://github.com/python/cpython/issues/149028
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/149028
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/149028
SimpleCookie regex can make parsing extremely slow for adversarial payloadshttps://github.com/python/cpython/issues/149028#top
3.15bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.15%22
release-blockerhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22release-blocker%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/KowalskiThomas
KowalskiThomashttps://github.com/KowalskiThomas
on Apr 26, 2026https://github.com/python/cpython/issues/149028#issue-4331878791
#113663https://github.com/python/cpython/pull/113663
herehttps://github.com/bottlepy/bottle/blob/2a743a3/bottle.py#L1175
therehttps://github.com/tornadoweb/tornado/blob/3251ead/tornado/httputil.py#L551
This branchhttps://github.com/python/cpython/compare/main...KowalskiThomas:cpython:kowalski/fix-avoid-slow-regex-in-cookie-parsing
sourcehttps://www.python.org/dev/security/
gh-149028: Make cookies parsing more lenient #149145https://github.com/python/cpython/pull/149145
gh-149028: Revert gh-92936 changes #149182https://github.com/python/cpython/pull/149182
Nexthttps://github.com/python/cpython/issues/149028?timeline_page=1
KowalskiThomashttps://github.com/KowalskiThomas
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Apr 26, 2026https://github.com/python/cpython/issues/149028#event-24884206237
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4323381838
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4324296906
https://github.com/KowalskiThomas
KowalskiThomashttps://github.com/KowalskiThomas
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4324811065
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4324846111
https://github.com/StanFromIreland
StanFromIrelandhttps://github.com/StanFromIreland
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4324903916
d7dbde8https://github.com/python/cpython/commit/d7dbde895884d58e3da7ed4107fd33171afad7cb
StanFromIrelandhttps://github.com/StanFromIreland
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Apr 27, 2026https://github.com/python/cpython/issues/149028#event-24894063618
StanFromIrelandhttps://github.com/StanFromIreland
Cookies issues 🍪https://github.com/orgs/python/projects/13
on Apr 27, 2026https://github.com/python/cpython/issues/149028#event-24894068598
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4325076942
@StanFromIrelandhttps://github.com/StanFromIreland
https://github.com/picnixz
picnixzhttps://github.com/picnixz
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4325235151
https://www.rfc-editor.org/rfc/rfc6265.html#section-4.1.1https://www.rfc-editor.org/rfc/rfc6265.html#section-4.1.1
#92936 (comment)https://github.com/python/cpython/issues/92936#issuecomment-3825455694
@Dreamsorcererhttps://github.com/Dreamsorcerer
@collinandersonhttps://github.com/collinanderson
@orsenthilhttps://github.com/orsenthil
picnixzhttps://github.com/picnixz
3.15bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.15%22
on Apr 27, 2026https://github.com/python/cpython/issues/149028#event-24895989779
https://github.com/KowalskiThomas
KowalskiThomashttps://github.com/KowalskiThomas
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4325592562
#92936https://github.com/python/cpython/issues/92936
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4329578559
@collinandersonhttps://github.com/collinanderson
https://github.com/collinanderson
collinandersonhttps://github.com/collinanderson
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4329663839
https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2https://www.rfc-editor.org/rfc/rfc6265.html#section-5.2
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 27, 2026https://github.com/python/cpython/issues/149028#issuecomment-4330057322
@collinandersonhttps://github.com/collinanderson
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4341889096
#92936https://github.com/python/cpython/issues/92936
#71861https://github.com/python/cpython/issues/71861
https://github.com/Dreamsorcerer
Dreamsorcererhttps://github.com/Dreamsorcerer
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4343671230
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4346247857
@serhiy-storchakahttps://github.com/serhiy-storchaka
@Dreamsorcererhttps://github.com/Dreamsorcerer
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4346726764
#149145https://github.com/python/cpython/pull/149145
https://github.com/collinanderson
collinandersonhttps://github.com/collinanderson
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4346823999
https://github.com/web-platform-tests/wpt/blob/master/cookies/name/name-ctl.htmlhttps://github.com/web-platform-tests/wpt/blob/master/cookies/name/name-ctl.html
https://github.com/web-platform-tests/wpt/blob/master/cookies/value/value-ctl.htmlhttps://github.com/web-platform-tests/wpt/blob/master/cookies/value/value-ctl.html
https://github.com/web-platform-tests/wpt/blob/master/cookies/name/name.htmlhttps://github.com/web-platform-tests/wpt/blob/master/cookies/name/name.html
https://github.com/web-platform-tests/wpt/blob/master/cookies/value/value.htmlhttps://github.com/web-platform-tests/wpt/blob/master/cookies/value/value.html
https://github.com/web-platform-tests/wpt/blob/master/cookies/size/name-and-value.htmlhttps://github.com/web-platform-tests/wpt/blob/master/cookies/size/name-and-value.html
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4346906626
#149145https://github.com/python/cpython/pull/149145
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 29, 2026https://github.com/python/cpython/issues/149028#issuecomment-4347798215
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 30, 2026https://github.com/python/cpython/issues/149028#issuecomment-4348807099
https://github.com/serhiy-storchaka
serhiy-storchakahttps://github.com/serhiy-storchaka
on Apr 30, 2026https://github.com/python/cpython/issues/149028#issuecomment-4351814880
gh-149028: Revert gh-92936 changes #149182https://github.com/python/cpython/pull/149182
https://github.com/orsenthil
orsenthilhttps://github.com/orsenthil
on Apr 30, 2026https://github.com/python/cpython/issues/149028#issuecomment-4353567168
serhiy-storchakahttps://github.com/serhiy-storchaka
on Apr 30, 2026https://github.com/python/cpython/issues/149028#event-25049182352
gh-149028: Revert gh-92936 changes (GH-149182)https://github.com/python/cpython/commit/c80e446e6b91fb64e1cbfed8986869accd1fafb6
gh-149028https://github.com/python/cpython/issues/149028
gh-92936https://github.com/python/cpython/issues/92936
GH-149182https://github.com/python/cpython/pull/149182
c80e446https://github.com/python/cpython/commit/c80e446e6b91fb64e1cbfed8986869accd1fafb6
https://github.com/tim-one
tim-onehttps://github.com/tim-one
on Apr 30, 2026https://github.com/python/cpython/issues/149028#issuecomment-4356553002
#149182https://github.com/python/cpython/pull/149182
tim-onehttps://github.com/tim-one
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Apr 30, 2026https://github.com/python/cpython/issues/149028#event-25054956517
github-project-automationhttps://github.com/apps/github-project-automation
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
on Apr 30, 2026https://github.com/python/cpython/issues/149028
github-project-automationhttps://github.com/apps/github-project-automation
Cookies issues 🍪https://github.com/orgs/python/projects/13
on Apr 30, 2026https://github.com/python/cpython/issues/149028
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/149028
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/149028
3.15bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.15%22
release-blockerhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22release-blocker%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Release and Deferred blockers 🚫https://github.com/orgs/python/projects/2
Cookies issues 🍪https://github.com/orgs/python/projects/13
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.