CVE-2026-40097
Description
Step CA is an online certificate authority for secure, automated certificate management for DevOps. From 0.24.0 to before 0.30.0-rc3, an attacker can trigger an index out-of-bounds panic in Step CA by sending a crafted attestation key (AK) certificate with an empty Extended Key Usage (EKU) extension during TPM device attestation. When processing a device-attest-01 ACME challenge using TPM attestation, Step CA validates that the AK certificate contains the tcg-kp-AIKCertificate Extended Key Usage OID. During this validation, the EKU extension value is decoded from its ASN.1 representation and the first element is checked. A crafted certificate could include an EKU extension that decodes to an empty sequence, causing the code to panic when accessing the first element of the empty slice. This vulnerability is only reachable when a device-attest-01 ACME challenge with TPM attestation is configured. Deployments not using TPM device attestation are not affected. This vulnerability is fixed in 0.30.0-rc3.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
github.com/smallstep/certificatesGo | >= 0.24.0, < 0.30.0 | 0.30.0 |
Affected products
3Patches
1ffd31ac0a87eMerge pull request #2569 from smallstep/mariano/check-eku-size
2 files changed · +11 −1
acme/challenge.go+1 −1 modified@@ -1250,7 +1250,7 @@ func validateAKCertificateExtendedKeyUsage(c *x509.Certificate) error { ) for _, ext := range c.Extensions { if ext.Id.Equal(oidExtensionExtendedKeyUsage) { - if _, err := asn1.Unmarshal(ext.Value, &ekus); err != nil || !ekus[0].Equal(oidTCGKpAIKCertificate) { + if _, err := asn1.Unmarshal(ext.Value, &ekus); err != nil || len(ekus) == 0 || !ekus[0].Equal(oidTCGKpAIKCertificate) { return errors.New("AK certificate is missing Extended Key Usage value tcg-kp-AIKCertificate (2.23.133.8.3)") } valid = true
acme/challenge_test.go+10 −0 modified@@ -5115,13 +5115,23 @@ func Test_validateAKCertificateExtendedKeyUsage(t *testing.T) { require.NoError(t, err) wrongEKU, err := ca.Sign(template) require.NoError(t, err) + emptyEKU, err := ca.Sign(&x509.Certificate{ + PublicKey: signer.Public(), + ExtraExtensions: []pkix.Extension{{ + Id: oidExtensionExtendedKeyUsage, + Value: []byte{0x30, 0x00}, // DER: empty SEQUENCE + }}, + }) + require.NoError(t, err) + tests := []struct { name string c *x509.Certificate expErr error }{ {"ok", ok, nil}, {"fail/wrong-eku", wrongEKU, errors.New("AK certificate is missing Extended Key Usage value tcg-kp-AIKCertificate (2.23.133.8.3)")}, + {"fail/empty-eku", emptyEKU, errors.New("AK certificate is missing Extended Key Usage value tcg-kp-AIKCertificate (2.23.133.8.3)")}, {"fail/missing-eku", missingEKU, errors.New("AK certificate is missing Extended Key Usage extension")}, } for _, tt := range tests {
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/smallstep/certificates/commit/ffd31ac0a87e03b0224cb8363094bfe602242888nvdPatchWEB
- github.com/smallstep/certificates/pull/2569nvdIssue TrackingPatchWEB
- github.com/advisories/GHSA-9qq8-cgcv-qmc9ghsaADVISORY
- github.com/smallstep/certificates/security/advisories/GHSA-9qq8-cgcv-qmc9nvdMitigationVendor AdvisoryWEB
- nvd.nist.gov/vuln/detail/CVE-2026-40097ghsaADVISORY
- github.com/smallstep/certificates/releases/tag/v0.30.0nvdProductRelease NotesWEB
News mentions
0No linked articles in our index yet.