Skip to content

fix: prevent CSR extensions from overriding CA-managed key usage in c…#1436

Merged
mitch292 merged 1 commit into
cloudflare:masterfrom
mitch292:fix-copy-extensions-security-bypass
Apr 17, 2026
Merged

fix: prevent CSR extensions from overriding CA-managed key usage in c…#1436
mitch292 merged 1 commit into
cloudflare:masterfrom
mitch292:fix-copy-extensions-security-bypass

Conversation

@mitch292

Copy link
Copy Markdown
Contributor

…opy_extensions

When copy_extensions is enabled, CSR-provided X.509v3 extensions are copied into the certificate template's ExtraExtensions. Go's x509.CreateCertificate gives ExtraExtensions precedence over struct fields for the same OID, which means an attacker-crafted CSR could inject KeyUsage, ExtKeyUsage, and other security-critical extensions that silently override the signing profile's intended restrictions.

Add a blocklist of CA-managed extension OIDs (KeyUsage, ExtKeyUsage, BasicConstraints, SKI, AKI, SAN, Name Constraints, CRL Distribution Points, Authority Info Access, Certificate Policies, Issuer Alt Name) that are never copied from CSR extensions. These extensions are authoritatively set by the CA's signing profile via FillTemplate and must not be overridable by a CSR submitter.

Non-standard/private-use extensions continue to be copied through when copy_extensions is enabled.

…opy_extensions

When copy_extensions is enabled, CSR-provided X.509v3 extensions are
copied into the certificate template's ExtraExtensions. Go's
x509.CreateCertificate gives ExtraExtensions precedence over struct
fields for the same OID, which means an attacker-crafted CSR could
inject KeyUsage, ExtKeyUsage, and other security-critical extensions
that silently override the signing profile's intended restrictions.

Add a blocklist of CA-managed extension OIDs (KeyUsage, ExtKeyUsage,
BasicConstraints, SKI, AKI, SAN, Name Constraints, CRL Distribution
Points, Authority Info Access, Certificate Policies, Issuer Alt Name)
that are never copied from CSR extensions. These extensions are
authoritatively set by the CA's signing profile via FillTemplate and
must not be overridable by a CSR submitter.

Non-standard/private-use extensions continue to be copied through
when copy_extensions is enabled.
@mitch292 mitch292 merged commit e429e72 into cloudflare:master Apr 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants