You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SSL BIO is broken for internationalized domains #76053
bpo-28414: SSL match_hostname fails for internationalized domain names
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/tiran'closed_at=<Date2017-11-02.08:50:30.893>created_at=<Date2017-10-26.10:09:19.604>labels= ['expert-SSL', 'type-bug', '3.7']
title='SSL BIO is broken for internationalized domains'updated_at=<Date2017-11-02.08:50:30.891>user='https://github.com/asvetlov'
SSLContext.wrap_bio creates a new SSLObject instance with passed server_hostname.
The name becomes IDNA-decoded: 'xn--2qq421aovb6v1e3pu.xn--j6w193g' is converted to '雜草工作室.香港' by SSLObject constructor.
Than on SSL handshake ssl.match_hostname() is called with sslobject.server_hostname parameter ('雜草工作室.香港' in my example).
But certificate for the site is contains IDNA-encoded DNS names:
Match '雜草工作室.香港' to ('DNS', 'xn--2qq421aovb6v1e3pu.xn--j6w193g') obviously fails.
I see two possible solutions:
Always do IDNA encoding for server_hostname stored in ssl object.
Do two checks for both IDNA and original server hostname values. I don't sure if certificates always use IDNA-encoded DNS names only.
The fix is trivial, I'll make a Pull Request after choosing what option we want to support. Personally I'm inclined to second one.
P.S. requests library is not affected because it uses ssl.wrap_socket.
The bug is reproducible for asyncio only (and maybe Tornado with asyncioIOLoop).
Activity
asvetlov commentedon Oct 26, 2017
SSLContext.wrap_biocreates a newSSLObjectinstance with passedserver_hostname.The name becomes IDNA-decoded:
'xn--2qq421aovb6v1e3pu.xn--j6w193g'is converted to'雜草工作室.香港'bySSLObjectconstructor.Than on SSL handshake
ssl.match_hostname()is called withsslobject.server_hostnameparameter ('雜草工作室.香港'in my example).But certificate for the site is contains IDNA-encoded DNS names:
Match
'雜草工作室.香港'to('DNS', 'xn--2qq421aovb6v1e3pu.xn--j6w193g')obviously fails.I see two possible solutions:
server_hostnamestored in ssl object.The fix is trivial, I'll make a Pull Request after choosing what option we want to support. Personally I'm inclined to second one.
P.S.
requestslibrary is not affected because it usesssl.wrap_socket.The bug is reproducible for
asyncioonly (and maybe Tornado withasyncioIOLoop).njsmith commentedon Nov 2, 2017
I believe #3010 is the fix you're looking for.
asvetlov commentedon Nov 2, 2017
Duplicate of bpo-28414
Nathaniel thanks for Pull Request!