Summary
A certificate validation flaw in AWS-LC's PKCS7_verify() function can cause incomplete or incorrect certificate chain verification when handling PKCS7 objects with multiple signers.
An unauthenticated attacker who can supply or influence PKCS7 data may be able to bypass certificate chain verification for all but the final signer, potentially causing applications to trust signatures that should be rejected.
Affected context
This issue affects applications that:
- Use the AWS-LC cryptographic library
- Invoke PKCS7_verify() to validate signed PKCS7/CMS objects
- Accept or process PKCS7 objects containing multiple signers
- Rely on PKCS7_verify()'s built-in certificate chain validation to enforce trust
The vulnerability is relevant when applications use PKCS7 signatures for authenticity or integrity checks and do not perform independent certificate validation outside of PKCS7_verify().
Exploit preconditions
- Attack surface: PKCS7 or CMS signature processing endpoints (e.g., file upload handlers, secure messaging interfaces, signature verification APIs).
- Required access: Ability to submit or influence PKCS7-signed data consumed by the vulnerable application; no prior authentication may be required if the endpoint is public.
- Trigger point: Verification of a PKCS7 object that includes multiple signers, where the application relies on PKCS7_verify() to enforce certificate chain validation.
- Why exploitation is possible: PKCS7_verify() does not correctly enforce chain validation for all signers when multiple signers are present, allowing some signers' certificates to bypass full trust-path checks.
Why this happens
The underlying bug falls under CWE-295: Improper Certificate Validation.
In the affected code path, AWS-LC's PKCS7_verify() implementation does not consistently or correctly validate the certificate chain for each signer in a multi-signer PKCS7 object.
Instead of applying the expected trust-anchor validation and revocation / policy checks uniformly, the function effectively relaxes or omits verification for all but the final signer.
This creates a gap between the application's trust assumptions ("PKCS7_verify() has validated all signers") and the library's actual behavior, leading to acceptance of signatures that should fail validation.
Potential impact
- Applications may accept signatures from untrusted or improperly validated certificates for non-final signers.
- Attackers could bypass signature-based authentication that relies on PKCS7_verify() for trust decisions.
- Integrity checks based on PKCS7/CMS signatures may be weakened, allowing malicious or altered data to appear valid.
- Security controls that distinguish trusted vs. untrusted content or actors based on PKCS7 signatures may make incorrect trust decisions.
General mitigation guidance
Effective mitigation focuses on strengthening certificate validation paths and reducing trust in library defaults:
- Ensure that every signer's certificate chain is explicitly validated against a well-defined trust store, especially when processing PKCS7 objects with multiple signers.
- Use strict verification policies: require a complete, valid chain to a trusted root CA, with appropriate key usage and extended key usage checks.
- Where feasible, decouple signature verification from certificate validation: treat PKCS7_verify() as a cryptographic primitive and perform certificate and identity validation in higher-level application code.
- Minimize acceptance of complex multi-signer PKCS7 structures unless there is a clear business need and a defined validation policy for each signer.
- Apply least-privilege and defense-in-depth: even when signatures validate, gate sensitive actions behind additional authentication or authorization checks so that a single validation flaw does not grant full access.
How teams detect issues like this
Detection typically combines code-level review with behavioral testing:
- Static analysis / code search: Identify all code paths that call PKCS7_verify() or equivalent APIs in AWS-LC, particularly those that:
- Accept PKCS7 data from external or untrusted sources
- Rely solely on the library's default certificate checking without additional validation
- Code review signals:
- Logic that assumes "PKCS7_verify() success == signer is fully trusted," with no subsequent certificate checks
- Handling of multi-signer PKCS7 objects where only the result of a single aggregate verification is used for authorization
- Dynamic and integration testing:
- Construct or use test data containing PKCS7 objects with multiple signers, some with intentionally invalid or untrusted certificates, and observe whether the application incorrectly accepts them.
- Policy enforcement:
- Introduce secure coding guidelines requiring explicit certificate-chain validation for all signers, and enforce them via CI checks or manual security reviews.

