Skip to content

x509: disallow mismatching signature algorithm identifiers #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2025

Conversation

rolandshoemaker
Copy link
Contributor

This prevents an easy method for spamming a log by modifying one of the
malleable fields in the certificate structure.

Fixes #699

@rolandshoemaker
Copy link
Contributor Author

Oh bleh, I forgot x509.ParseCertificate is also used for parsing precert tbsCertificates... I think this can probably be made to work together with that, but it's going to be a bit more complicated.

@codecov
Copy link

codecov bot commented Jul 13, 2020

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.22%. Comparing base (9d40ef1) to head (b150747).
Report is 773 commits behind head on master.

Files with missing lines Patch % Lines
x509/x509.go 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #702      +/-   ##
==========================================
+ Coverage   71.75%   74.22%   +2.46%     
==========================================
  Files          90       81       -9     
  Lines        9879     8946     -933     
==========================================
- Hits         7089     6640     -449     
+ Misses       2295     1870     -425     
+ Partials      495      436      -59     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rolandshoemaker
Copy link
Contributor Author

@Martin2112 @AlCutter do you folks have a strong opinion on this? It's a bit of a spam opportunity hole I'd like to close, but I don't think it's super urgent.

@AlCutter
Copy link
Member

Hey @rolandshoemaker thanks for sending - looks ok to me in principle.
RFC5280 says This field [TBSCertificate.signature] MUST contain the same algorithm identifier as the signatureAlgorithm field in the sequence Certificate (Section 4.1.1.2).

@FiloSottile wdyt? Is this something that could/should be fixed upstream? I know you folks have historically been very keen to make the golang x509 library err on the side of correctness.

@rolandshoemaker
Copy link
Contributor Author

Heh, I actually have a similar upstream change https://go-review.googlesource.com/c/go/+/235118.

@AlCutter
Copy link
Member

Hehe, excellent :)

@FiloSottile
Copy link
Contributor

FiloSottile commented Jul 22, 2020 via email

@AlCutter AlCutter closed this Oct 1, 2021
@phbnf phbnf reopened this May 19, 2025
@phbnf phbnf requested a review from a team as a code owner May 19, 2025 16:55
@phbnf phbnf requested review from mhutchinson and removed request for a team May 19, 2025 16:55
@phbnf
Copy link
Contributor

phbnf commented May 19, 2025

This was recently surfaced in https://groups.google.com/a/mozilla.org/g/dev-security-policy/c/p1JoBkfRhOQ/m/pF8ZdjRzCQAJ, let's merge this in.

This prevents an easy method for spamming a log by modifying one of the
malleable fields in the certificate structure.

Fixes google#699
@phbnf phbnf force-pushed the sig-alg-mismatch branch from b150747 to 95f9514 Compare May 19, 2025 16:57
@phbnf
Copy link
Contributor

phbnf commented May 19, 2025

/gcbrun

@phbnf phbnf self-requested a review May 20, 2025 09:46
@phbnf phbnf self-assigned this May 20, 2025
@phbnf phbnf merged commit 56b77cf into google:master May 20, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certificate verifier doesn't reject mismatched signature algorithm
5 participants