Title: python 3.11 http.server internal path disclosure · Issue #104049 · python/cpython · GitHub
Open Graph Title: python 3.11 http.server internal path disclosure · Issue #104049 · python/cpython
X Title: python 3.11 http.server internal path disclosure · Issue #104049 · python/cpython
Description: Bug report Description Python http.server will disclose the full path where the http server is running when certains URL encoded values are sent as parameters. This was tested on a linux and windows machine. This was initially reported t...
Open Graph Description: Bug report Description Python http.server will disclose the full path where the http server is running when certains URL encoded values are sent as parameters. This was tested on a linux and window...
X Description: Bug report Description Python http.server will disclose the full path where the http server is running when certains URL encoded values are sent as parameters. This was tested on a linux and window...
Opengraph URL: https://github.com/python/cpython/issues/104049
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"python 3.11 http.server internal path disclosure","articleBody":"# Bug report\r\n\r\nDescription\r\n---\r\nPython http.server will disclose the full path where the http server is running when certains URL encoded values are sent as parameters. This was tested on a linux and windows machine. This was initially reported to security@ but I was asked to create an issue here. I am including the analysis that Gregory P Smith did.\r\n\r\nSteps to reproduce\r\n---\r\nRun \r\n```\r\npython -m http.server 9000\r\n```\r\n\r\nFrom another terminal:\r\n```\r\nC:\\Users\\fmunozs\u003ecurl http://localhost:9000/?x=123\r\n\u003c!DOCTYPE HTML\u003e\r\n\u003chtml lang=\"en\"\u003e\r\n\u003chead\u003e\r\n\u003cmeta charset=\"utf-8\"\u003e\r\n\u003ctitle\u003eDirectory listing for /?x=123\u003c/title\u003e\r\n\u003c/head\u003e\r\n\u003cbody\u003e\r\n\u003ch1\u003eDirectory listing for /?x=123\u003c/h1\u003e\r\n\u003chr\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003ca href=\"x.txt\"\u003ex.txt\u003c/a\u003e\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003chr\u003e\r\n\u003c/body\u003e\r\n\u003c/html\u003e\r\n\r\ncurl http://localhost:9000/?x=%bb\r\n\u003c!DOCTYPE HTML\u003e\r\n\u003chtml lang=\"en\"\u003e\r\n\u003chead\u003e\r\n\u003cmeta charset=\"utf-8\"\u003e\r\n\u003ctitle\u003eDirectory listing for C:\\Users\\fmunozs\\Desktop\\test/\u003c/title\u003e\r\n\u003c/head\u003e\r\n\u003cbody\u003e\r\n\u003ch1\u003eDirectory listing for C:\\Users\\fmunozs\\Desktop\\test/\u003c/h1\u003e\r\n\u003chr\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003ca href=\"x.txt\"\u003ex.txt\u003c/a\u003e\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003chr\u003e\r\n\u003c/body\u003e\r\n\u003c/html\u003e\r\n```\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: 3.11.3\r\n- Operating system and architecture: Windows 11 and Linux\r\n\r\n# Analysis by Gregory P Smith\r\n\r\nThis comes from https://github.com/python/cpython/blob/v3.11.3/Lib/http/server.py#L789-L793 and has been that way probably forever in Python.\r\n```\r\n urllib.parse.unquote('/?x=%bb', errors='surrogatepass')\r\n UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 4: invalid start byte\r\n```\r\nThus `self.path` isn't used for displaypath and it falls back to displaying `path` which is the local filesystem path we don't want a server to expose, per that try:..except:..\r\n\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104067\n* gh-104119\n* gh-104120\n* gh-104121\n* gh-104122\n* gh-104123\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/fmunozs","@type":"Person","name":"fmunozs"},"datePublished":"2023-05-01T17:22:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/104049/cpython/issues/104049"}
| 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:56fd79c7-ea7e-0910-82a9-f39445e43778 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8540:3E9801:1D2EB0:2724FD:6969BEBC |
| html-safe-nonce | 515355884d5c2e9f0fd2f03938f726b6ab49e97f0128653b70dcd9e2894b9d72 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTQwOjNFOTgwMToxRDJFQjA6MjcyNEZEOjY5NjlCRUJDIiwidmlzaXRvcl9pZCI6IjI4MTU3NzcyMjM4MzY1NDg3OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8372a7e7ec5e1a02bfb6e0159dfa5e1378193c94b54675da3f43ffb702e854f6 |
| hovercard-subject-tag | issue:1691090938 |
| 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/104049/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a0b8f6e47c675dfbce509904bacb466bdeb865cc3916beaa32aea6806338c8da/python/cpython/issues/104049 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a0b8f6e47c675dfbce509904bacb466bdeb865cc3916beaa32aea6806338c8da/python/cpython/issues/104049 |
| og:image:alt | Bug report Description Python http.server will disclose the full path where the http server is running when certains URL encoded values are sent as parameters. This was tested on a linux and window... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fmunozs |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width