Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow support for a*, *, and a* in certificate wildcard handling. #67222

dstufft opened this issue Dec 11, 2014 · 10 comments
3.7 (EOL) end of life topic-SSL type-security A security issue


Copy link

dstufft commented Dec 11, 2014

BPO 23033
Nosy @rhettinger, @pitrou, @tiran, @benjaminp, @ned-deily, @alex, @dstufft, @Mariatta
  • bpo-23033: consider wildcard in left most segment only for domain names #937
  • 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 = ''
    closed_at = <Date 2017-11-26.22:33:13.727>
    created_at = <Date 2014-12-11.21:03:43.418>
    labels = ['type-security', 'expert-SSL', '3.7']
    title = 'Disallow support for a*, *, and a* in certificate wildcard handling.'
    updated_at = <Date 2017-11-26.22:33:13.726>
    user = '' fields:

    activity = <Date 2017-11-26.22:33:13.726>
    actor = 'Mariatta'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2017-11-26.22:33:13.727>
    closer = 'Mariatta'
    components = ['SSL']
    creation = <Date 2014-12-11.21:03:43.418>
    creator = 'dstufft'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 23033
    keywords = []
    message_count = 10.0
    messages = ['232493', '232494', '232503', '275039', '290994', '291040', '295742', '295756', '307025', '307026']
    nosy_count = 8.0
    nosy_names = ['rhettinger', 'pitrou', 'christian.heimes', 'benjamin.peterson', 'ned.deily', 'alex', 'dstufft', 'Mariatta']
    pr_nums = ['937']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'security'
    url = ''
    versions = ['Python 3.7']

    Copy link
    Member Author

    dstufft commented Dec 11, 2014

    Various browsers[1][2] are dropping support for wild card certificates which are anything but a single "*" alone in the left most position. The other style wildcards were deprecated previously and they should not appear in any public certificate and in the words of the Chrome project are "dang weird for internal certificates".

    I believe we should follow suite and just only allow a single "*" alone in the left most segment for the SSL handling code.


    Copy link

    pitrou commented Dec 11, 2014

    Sounds fine for me in 3.5.

    Copy link

    alex commented Dec 11, 2014

    As a part of this, we might want to consider changing the implementation to not compile the SANs into a regular expression. Constantly compiling new regexs can cause churn in the re cache, which can degrade performance -- also, it's probably much worse on PyPy :-)

    Copy link

    tiran commented Sep 8, 2016

    Sounds good to me!

    For 3.7 I'm planning to use OpenSSL's hostname verification system and deprecate match_hostname(). It does support partial matching by default.

    @tiran tiran added 3.7 (EOL) end of life type-security A security issue topic-SSL labels Sep 8, 2016
    @tiran tiran self-assigned this Sep 15, 2016
    Copy link


    Copy link

    tiran commented Apr 2, 2017

    Ned, Benjamin,

    are you ok with a backport to 2.7 and 3.6? Substring (aka partial) matching of wildcards is a MAY feature according to RFC 6125 . They are a violation of CA/B Form's baseline requirements, so no publicaly trusted cert may contain a CN or SAN entry with a partial wildcard. Several libraries and languages do not implement the feature either. Improper wildcard matching caused a bunch of security issues and CVEs in Python.

    Copy link

    Can this go to 3.6.2?

    Copy link

    tiran commented Jun 12, 2017

    It's probably not a good idea to port it to 3.6. It's a backwards incompatible change.

    Copy link

    New changeset ede2ac9 by Mariatta (Mandeep Singh) in branch 'master':
    bpo-23033: Improve SSL Certificate handling (GH-937)

    Copy link

    I merged the PR, this is now in 3.7.
    Thanks all!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    3.7 (EOL) end of life topic-SSL type-security A security issue
    None yet

    No branches or pull requests

    6 participants