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
crypto/x509: quadratic work in policy validation with large PolicyMappings (CVE-2026-32281) #78281
Confirmed on Go 1.26.1 that x509.Certificate.Verify can become pathologically slow during certificate policy validation in the Go verifier.
The expensive path is reached after a candidate chain has already been built to a trusted root. If an intermediate contains a large PolicyMappings extension and policy mapping has already been inhibited by an earlier certificate (InhibitPolicyMapping=0), verification does much more work than expected.
Representative local measurement on Apple M2 with GOMAXPROCS=1: about 79 ms in a baseline case versus about 3715 ms with roughly 1 MB of certificate data.
What did you see happen?
In crypto/x509/verify.go, Verify builds candidate chains first and then calls policiesValid on them.
Inside policiesValid, when policyMapping > 0, mappings are collected and applied. But when policyMapping == 0, the current code deletes one mapped policy and then calls pg.prune() for each entry in cert.PolicyMappings.
Because pg.prune() rescans the policy graph that has already been built, doing that inside the loop repeats the same work many times. With large PolicyMappings inputs, verification time appears to grow roughly quadratically with the number of mappings.
This seems most relevant to applications that verify peer-supplied certificate chains against a configured root pool, such as mTLS/private PKI services or APIs that accept certificate chains as input.
What did you expect to see?
Once policy mapping has been inhibited, policy validation should not rescan the policy graph once per mapping entry. Verification time should remain reasonable for large PolicyMappings inputs.
Additional reproduction details were shared with the security team.
changed the title [-]crypto/x509: DoS via quadratic policy validation with PolicyMappings when inhibitPolicyMapping=0[/-][+]crypto/x509: quadratic work in policy validation with large PolicyMappings[/+]on Mar 22, 2026
changed the title [-]crypto/x509: quadratic work in policy validation with large PolicyMappings[/-][+]crypto/x509: quadratic work in policy validation with large PolicyMappings (CVE-2026-32281)[/+]on Mar 27, 2026
Activity
[-]crypto/x509: DoS via quadratic policy validation with PolicyMappings when inhibitPolicyMapping=0[/-][+]crypto/x509: quadratic work in policy validation with large PolicyMappings[/+]gabyhelp commentedon Mar 22, 2026
Related Issues
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
dmitshur commentedon Mar 23, 2026
CC @rolandshoemaker.
gopherbot commentedon Mar 23, 2026
Change https://go.dev/cl/758061 mentions this issue:
crypto/x509: hoist policy pruning out of looprolandshoemaker commentedon Mar 25, 2026
@gopherbot please open backport issues.
gopherbot commentedon Mar 25, 2026
Backport issue(s) opened: #78359 (for 1.25), #78360 (for 1.26).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
gopherbot commentedon Mar 25, 2026
Change https://go.dev/cl/759220 mentions this issue:
[release-branch.go1.26] crypto/x509: hoist policy pruning out of loopgopherbot commentedon Mar 25, 2026
Change https://go.dev/cl/759200 mentions this issue:
[release-branch.go1.25] crypto/x509: hoist policy pruning out of loop[release-branch.go1.26] crypto/x509: hoist policy pruning out of loop
[release-branch.go1.25] crypto/x509: hoist policy pruning out of loop
[-]crypto/x509: quadratic work in policy validation with large PolicyMappings[/-][+]crypto/x509: quadratic work in policy validation with large PolicyMappings (CVE-2026-32281)[/+]