Title: Exponential IDNA codec decoding potential denial of service · Issue #99083 · python/cpython · GitHub
Open Graph Title: Exponential IDNA codec decoding potential denial of service · Issue #99083 · python/cpython
X Title: Exponential IDNA codec decoding potential denial of service · Issue #99083 · python/cpython
Description: ('xn--016cpos'+'a'*5000).encode('utf-8').decode('idna') This takes over 1 minute to run. Tested on the latest cpython repo checkout and on Ubuntu's python3 on a relatively modern Linux pc. Clear exponential complexity: 10 chars = 0.016 s...
Open Graph Description: ('xn--016cpos'+'a'*5000).encode('utf-8').decode('idna') This takes over 1 minute to run. Tested on the latest cpython repo checkout and on Ubuntu's python3 on a relatively modern Linux pc. Clear ex...
X Description: ('xn--016cpos'+'a'*5000).encode('utf-8').decode('idna') This takes over 1 minute to run. Tested on the latest cpython repo checkout and on Ubuntu's python3 on a ...
Opengraph URL: https://github.com/python/cpython/issues/99083
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exponential IDNA codec decoding potential denial of service","articleBody":"```python\r\n('xn--016cpos'+'a'*5000).encode('utf-8').decode('idna')\r\n```\r\n\r\nThis takes over 1 minute to run.\r\n\r\nTested on the latest cpython repo checkout and on Ubuntu's python3 on a relatively modern Linux pc.\r\n\r\nClear exponential complexity:\r\n\r\n10 chars = 0.016 seconds\r\n100 chars = 0.047 seconds\r\n1000 chars = 2.883 seconds\r\n2500 chars = 17.724 seconds\r\n5000 chars = 1 min 10 seconds\r\n\r\n-- _As reported by @guidovranken via our Python security response team mailing list on 2022-09-09._\r\n\r\n---\r\n\r\nI can reproduce the issue. This should be an easy fix. According to spec https://unicode.org/reports/tr46/ an IDNA label must not be longer than 63 characters. Python's idna module enforces the restriction, but too late.\r\n-- @tiran \r\n\r\n---\r\n\r\nThis is probably in `ToUnicode` and `ToASCII` of https://github.com/python/cpython/blob/main/Lib/encodings/idna.py and/or in https://github.com/python/cpython/blob/main/Lib/encodings/punycode.py itself, where we could presumably just do an up front length check and reject inputs that are obviously too long to possibly decode into a label length that DNS standards will accept.\r\n\r\nIt doesn't currently feel urgent enough to treat specially. If filing a public issue about this attracts other attention to identify specific reasons why this is a security DoS issue and should be more of a priority, expect more people to become interested in actually working on a proper fix.\r\n\r\nIt might be interesting to add the idna codec to oss-fuzz tests in Modules/_xxtestfuzz?\r\n\r\n-- @gpshead\r\n\r\n@vstinner asked that I go ahead and file a public issue for this as nobody else had replied or done so yet. Done! 😁 ","author":{"url":"https://github.com/gpshead","@type":"Person","name":"gpshead"},"datePublished":"2022-11-04T00:08:18Z","url":"https://github.com/python/cpython/issues/99083"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a23ffd4e-ccfe-248e-a40a-63a8a4970ad9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 842E:1F82:19893D:219B3E:6B0231A8 |
| html-safe-nonce | 8650faf5115b303938830ce37e30fae2bad05dc65ef4864bc3c3781aa8c787b1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDJFOjFGODI6MTk4OTNEOjIxOUIzRTo2QjAyMzFBOCIsInZpc2l0b3JfaWQiOiI3NTQ2OTQ2MDA2OTQ0OTg1NTEzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | feb3eef6c9a009c09cd71eed39beb421860415b5da32b380ddc0820d602ad4c7 |
| hovercard-subject-tag | issue:1435389660 |
| 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/99083/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f912eeba79b399f13d778bdb24c58397814f3832449f08e2b0ff824404b4275a/python/cpython/issues/99083 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f912eeba79b399f13d778bdb24c58397814f3832449f08e2b0ff824404b4275a/python/cpython/issues/99083 |
| og:image:alt | ('xn--016cpos'+'a'*5000).encode('utf-8').decode('idna') This takes over 1 minute to run. Tested on the latest cpython repo checkout and on Ubuntu's python3 on a relatively modern Linux pc. Clear ex... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gpshead |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width