Repository navigation
Fix: Fenrir F-10621 - #11905
Draft
ohki-saito wants to merge 1 commit into
Draft
Fix: Fenrir F-10621#11905ohki-saito wants to merge 1 commit into
ohki-saito wants to merge 1 commit into
Conversation
|
Can one of the admins verify this patch? |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression test covers only a different-length OID collision, so it would still pass if the byte comparison were removed and same-length collisions were accepted.
1 open issue
What changed in this PR
This PR addresses Fenrir F-10621 in wolfSSL’s OpenSSL-compatible object lookup functions by checking encoded OID bytes, rather than relying solely on OID sums, when a reference encoding is available.
Changes:
- Add shared OID length-and-byte validation to
OBJ_txt2nid()andOBJ_obj2nid(). - Preserve the sum-only
oid2nid()wrapper and document its intended use. - Add regression tests for basic constraints and a colliding longer OID.
| File | Description |
|---|---|
tests/api/test_ossl_obj.c |
Adds valid-OID and collision regression tests for both OBJ lookup functions. |
src/ssl_asn1.c |
Adds encoding-aware lookup while preserving existing sum-only callers. |
Review effort: Balanced
Comment on lines
+304
to
+305
| ExpectIntEQ(OBJ_txt2nid("2.5.29.19"), NID_basic_constraints); | ||
| ExpectIntEQ(OBJ_txt2nid("2.5.29.19.1.1.1.1.1.1.1.1"), NID_undef); |
Contributor
|
Okay to test. |
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.

Description
Fenrir Finding F-10621
wolfSSL_OBJ_txt2nid()andwolfSSL_OBJ_obj2nid()identified an OID only by its 32-bitwc_oid_sum()value, without comparing the encoded OID bytes. OID sums are not unique:2.5.29.19.1.1.1.1.1.1.1.1has the same sum as2.5.29.19, because the eight added bytes cancel out in the XOR lanes. Both functions therefore returnedNID_basic_constraintsfor the longer OID.Certificate parsing already checks the OID bytes in
GetOID(), so this PR only changes the two OBJ functions, which match by sum alone.Changes:
wolfssl_object_info_oid_match(), which compares the length and bytes of an OID with the encoding fromOidFromId()for a candidate table entry.oid2nid()intooid2nid_ex(oid, grp, der, derSz), which also checks the encoding when it is given, and keepoid2nid(oid, grp)as a sum-only wrapper. The existing callers ofoid2nid()are unchanged; its comment now states that it is for OIDs whose encoding was already checked when parsed.wolfSSL_OBJ_obj2nid(), get the OID content bytes from the object and calloid2nid_ex().wolfSSL_OBJ_txt2nid(), check the encoding before returning a NID.Remaining limitations
These are not addressed in this PR, and I would appreciate guidance on whether to handle them separately:
OidFromId()(38 of 143 with--enable-all, e.g.CN,O, some curves) are still matched by sum only, so OIDs colliding with them can still be misidentified.oid2nid()is still sum-only. Its fallback search across all groups could map an unknown OID to an entry of another typeTesting
Added tests for
OBJ_txt2nid()andOBJ_obj2nid():2.5.29.19is still identified asNID_basic_constraints.2.5.29.19.1.1.1.1.1.1.1.1is no longer identified asNID_basic_constraints.Checklist