reject non-zero version in pkcs7 enveloped data decryption#15262
Open
dxbjavid wants to merge 1 commit into
Open
reject non-zero version in pkcs7 enveloped data decryption#15262dxbjavid wants to merge 1 commit into
dxbjavid wants to merge 1 commit into
Conversation
alex
reviewed
Jul 16, 2026
| positions = [] | ||
| start = 0 | ||
| while True: | ||
| i = enveloped.find(b"\x02\x01\x00", start) |
Member
There was a problem hiding this comment.
Please add a proper vector for this, not this weird style.
You've gotten this feedback before, which strongly makes me think this is just an LLM. That's fine, we use LLMs to. But if you don't put actual human effort into this, you're wasting our time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When decrypting a PKCS7 EnvelopedData we read the EnvelopedData and RecipientInfo version fields but never check them, so a message whose version is not zero is accepted and decrypted even though it is malformed. For the shape we accept here, with no originatorInfo or unprotected attributes and a recipient identified by issuer and serial number, RFC 5652 6.1 and 6.2.1 fix both versions at zero, so any other value is out of spec. This rejects it in both places, matching the version validation the certificate, CSR, CRL and OCSP loaders already do.