Subject emailAddress isn't checked against rfc822Name constraints when the leaf has no subjectAltName
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
Research direction
Start with check_name_constraints in src/subject_name/mod.rs, which checks SAN entries and the subject directory name but never extracts the subject emailAddress when there is no subjectAltName. Run the linked gist repro (cargo run) to see forbidden_no_san accepted while forbidden_email_san is rejected, and compare with the openssl verify control. Done means the no-SAN case is rejected under a permitted rfc822Name constraint, with the RFC 5280 section 4.2.1.10 behaviour and related issues #445 and #70 taken into account.
Written by the indexing model from the issue text.
Description
Re-filing from GHSA-hc65-xjvf-77jj as asked.
rustls-webpki 0.103.16 (and main) accepts a certificate whose subject emailAddress is outside its issuer's permitted rfc822Name subtree when the leaf has no subjectAltName. If the same email is in a SAN, the constraint fails closed as expected.
As @ctz pointed out on the advisory, webpki has no API for asserting email identities and ignores names in the subject. So the impact is narrow: webpki accepts a constrained chain that isn't valid under its constraints. It only matters if something else extracts the subject email from a chain webpki has validated.
Details
RFC 5280 section 4.2.1.10 applies rfc822Name constraints to an email address in the subject DN when there's no subjectAltName. check_name_constraints checks the SAN entries plus the subject as a directory name. A directory name doesn't match an rfc822Name subtree, so it's skipped, and the subject emailAddress is never pulled out.
An email SAN under an email constraint hits the unsupported-name path and is rejected. The no-SAN subject email never reaches that path.
Related: #445 (email constraint support) and #70 (RFC 5280 deviations).
Repro
https://gist.github.com/DicksonWu654/7cb644c9485e48118a11899867fee090
cargo run builds against rustls-webpki = "=0.103.16" with the certs embedded. A root signs an intermediate with a critical permitted rfc822Name subtree for allowed.test, which signs three client-auth leaves:
allowed_no_san: accepted
forbidden_no_san: accepted
forbidden_email_san: rejected (NameConstraintViolation)
forbidden_no_san has emailAddress = [email protected] in the subject and no SAN. openssl verify on the same chain fails with error 47 (permitted subtree violation). The README has a one-liner for that.
Possible fix
When the leaf has no subjectAltName, treat subject emailAddress attributes like SAN emails for constraint purposes. With the current fail-closed handling, that means rejecting the chain when an email constraint is present.
I used AI tools (OpenAI Codex and Anthropic Claude) to find this, build the test and draft the report. The test and the OpenSSL control were re-run against 0.103.16 before the original report, and the cited code was checked against source.
- Dominant language
- Rust
- Stars
- 167
- Forks
- 112
- Avg merge
- 4h 28m
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rustls/webpki
-
Path building re-parses every intermediate on each budgeted call (unbudgeted CPU cost)Possibly taken @batmnnn claimed this 23 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Improve error message when denying subject name due to wildcard in public suffixMay be free again @ctz claimed this 79 days ago, and no pull request is open. Open
-
Consider all candidate CRLsMay be free again @cpu claimed this 85 days ago, and no pull request is open. Open
-
Add opt-in support for ignoring URI name constraintsPossibly taken @djc claimed this 135 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Eyevinn/open-live-ingest#36 · 1 comment ·
Maintainers usually reply within 1 day
-
app
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug bug jury peripheral:i2s
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
esp-rs/esp-hal#6828 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
ライブラリを追加Openpriority middle
Difficulty 1/5 Under an hour Newbie friendliness 62/100
KATO-Hiro/AtCoderClans#13015 ·
Maintainers usually reply within 1 day