René's URL Explorer Experiment


Title: Embedded null characters can lead to bugs or even security vulnerabilities · Issue #111656 · python/cpython · GitHub

Open Graph Title: Embedded null characters can lead to bugs or even security vulnerabilities · Issue #111656 · python/cpython

X Title: Embedded null characters can lead to bugs or even security vulnerabilities · Issue #111656 · python/cpython

Description: I just modified PyUnicode_AsUTF8() of the C API to raise an exception if a string contains an embedded null character to reduce the risk of security vulnerabilities. PyUnicode_AsUTF8() caller expects a string terminated by a null byte. I...

Open Graph Description: I just modified PyUnicode_AsUTF8() of the C API to raise an exception if a string contains an embedded null character to reduce the risk of security vulnerabilities. PyUnicode_AsUTF8() caller expec...

X Description: I just modified PyUnicode_AsUTF8() of the C API to raise an exception if a string contains an embedded null character to reduce the risk of security vulnerabilities. PyUnicode_AsUTF8() caller expec...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Embedded null characters can lead to bugs or even security vulnerabilities","articleBody":"I just modified PyUnicode_AsUTF8() of the C API to raise an exception if a string contains an embedded null character to reduce the risk of security vulnerabilities. PyUnicode_AsUTF8() caller expects a string terminated by a null byte. If the UTF-8 encoded string contains embedded null byte, the caller is likely to truncate the string without knowing that there are more bytes after \"the first\" null byte.\r\n\r\nSee: https://owasp.org/www-community/attacks/Embedding_Null_Code\r\n\r\nIt's not only about security issue, it  can also just be seen as a bug: unwanted behavior.\r\n\r\nPrevious issues:\r\n\r\n* #111089\r\n* #106844\r\n* #106242 -- CVE-2023-41105\r\n* #103223\r\n* #84335\r\n* #73228\r\n* #66411\r\n* #65346\r\n* #57826\r\n\r\nDiscussions:\r\n\r\n* 2014: https://mail.python.org/archives/list/python-dev@python.org/thread/MZDL7FZZMRSW5MTIHLSA6ANNMCV7EEZN/\r\n\r\n---\r\n\r\nExample with Python 3.12:\r\n\r\n```py\r\nimport ctypes\r\n\r\nlibc = ctypes.cdll.LoadLibrary('libc.so.6')\r\nprintf = libc.printf\r\nPyUnicode_AsUTF8 = ctypes.pythonapi.PyUnicode_AsUTF8\r\nPyUnicode_AsUTF8.argtypes = (ctypes.py_object,)\r\nPyUnicode_AsUTF8.restype = ctypes.c_char_p\r\n\r\nmy_string = \"World\\0truncated string\"\r\nprintf(b\"Hello %s\\n\", PyUnicode_AsUTF8(my_string))\r\n```\r\n\r\nOutput:\r\n\r\n```\r\nHello World\r\n```\r\n\r\nThe ``truncated string`` part is silently ignored!\r\n\r\n---\r\n\r\nMultiple functions were modified in the past to prevent this problem. Examples:\r\n\r\n* _dbm.open(): check *filename*\r\n* _gdbm.open(): check *filename*\r\n* `PyBytes_AsStringAndSize(str, NULL)`\r\n* grp.getgrnam(): check *name*\r\n* pwd.getpwnam(): check *name*\r\n* _locale.strxfrm(): check argument\r\n* path_converter() of the os module: basically any filename and path\r\n* PyUnicode_AsWideCharString()\r\n* os.putenv()\r\n* _posixsubprocess.fork_exec(): executable_list\r\n* _struct.Struct: check *format*\r\n* _tkinter SetVar() and varname_converter()\r\n* _winapi.CreateProcess() getenvironment()\r\n* PyUnicode_EncodeLocale()\r\n* PyUnicode_EncodeFSDefault()\r\n* unicode_decode_locale()\r\n* PyUnicode_FSConverter()\r\n* PyUnicode_DecodeLocale()\r\n* PyUnicode_DecodeLocaleAndSize()\r\n* PyUnicode_FSDecoder()\r\n* PyUnicode_AsUTF8() -- recently modified\r\n* _Py_stat(): check *path*\r\n* getargs.c: 's', 'y' and 'z' formats\r\n\r\nThere are exceptions which accept embedded null bytes/characters:\r\n\r\n* socket: AF_UNIX socket name","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-11-02T17:10:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/111656/cpython/issues/111656"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e0e7710c-3619-1cc5-67b0-6ca67ae701f3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD1DE:3366E4:4BD31B:642ABE:6A5BD0AD
html-safe-nonce884b3236293f71accb507e0e014817b1fd5eeb7938a31d2770b2ae2b4a0e4551
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMURFOjMzNjZFNDo0QkQzMUI6NjQyQUJFOjZBNUJEMEFEIiwidmlzaXRvcl9pZCI6Ijg2OTQ3Mzc0NzgwNDg1MzQ3MDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac388570d7d8d88156b393e08d005cd570e62405b7faf1a5bc0b97332ef95fda7a
hovercard-subject-tagissue:1974695604
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/111656/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3f621371cbbe51dae383f74aefc5f5d4cb7d3c6bf8999b25aa536d7a785ca706/python/cpython/issues/111656
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3f621371cbbe51dae383f74aefc5f5d4cb7d3c6bf8999b25aa536d7a785ca706/python/cpython/issues/111656
og:image:altI just modified PyUnicode_AsUTF8() of the C API to raise an exception if a string contains an embedded null character to reduce the risk of security vulnerabilities. PyUnicode_AsUTF8() caller expec...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevstinner
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
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
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/111656#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F111656
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F111656
Sign up https://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/111656
Reloadhttps://github.com/python/cpython/issues/111656
Reloadhttps://github.com/python/cpython/issues/111656
Please reload this pagehttps://github.com/python/cpython/issues/111656
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/111656
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.4k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Embedded null characters can lead to bugs or even security vulnerabilitieshttps://github.com/python/cpython/issues/111656#top
type-securityA security issuehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-security%22
https://github.com/vstinner
vstinnerhttps://github.com/vstinner
on Nov 2, 2023https://github.com/python/cpython/issues/111656#issue-1974695604
https://owasp.org/www-community/attacks/Embedding_Null_Codehttps://owasp.org/www-community/attacks/Embedding_Null_Code
[C API] Change PyUnicode_AsUTF8() to return NULL on embedded null characters #111089https://github.com/python/cpython/issues/111089
_winapi.LCMapStringEx fails when encountering a string containing null characters #106844https://github.com/python/cpython/issues/106844
os.path.normpath truncates input on null bytes in 3.11, but not 3.10 #106242https://github.com/python/cpython/issues/106242
CVE-2023-41105https://github.com/advisories/GHSA-65fx-pmw6-rcfm
Uncaught exception in http.server request handling (<=3.10) #103223https://github.com/python/cpython/issues/103223
embedded null byte when connecting to sqlite database using a bytes object #84335https://github.com/python/cpython/issues/84335
os.path.exists should not throw "Embedded NUL character" exception #73228https://github.com/python/cpython/issues/73228
"embedded NUL character" exceptions #66411https://github.com/python/cpython/issues/66411
sqlite3 doesn't complain if the request contains a null character #65346https://github.com/python/cpython/issues/65346
Reject embedded null characters in wchar* strings #57826https://github.com/python/cpython/issues/57826
https://mail.python.org/archives/list/python-dev@python.org/thread/MZDL7FZZMRSW5MTIHLSA6ANNMCV7EEZN/https://mail.python.org/archives/list/python-dev@python.org/thread/MZDL7FZZMRSW5MTIHLSA6ANNMCV7EEZN/
type-securityA security issuehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-security%22
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.