Skip to content
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

Check tbsCertificate signature algorithm matches certificate #436

Merged
merged 4 commits into from
Jun 1, 2020

Conversation

rolandshoemaker
Copy link
Contributor

@rolandshoemaker rolandshoemaker commented May 24, 2020

Per RFC 5280 section 4.1.1.2, couldn't find an existing lint.

Resolves #419

Per RFC 5280 section 4.1.1.2, couldn't find an existing lint.
@rolandshoemaker
Copy link
Contributor Author

Just to add a little context after some discussions elsewhere, this lint is probably of value to a CA that is using zlint, since it may catch creating a certificate that is somewhat... dubious post signature, but is likely of significantly less value as a lint for larger corpora, like CT, since the certificate signatureAlgorithm field is not covered by the signature and is as such malleable. This means anyone can submit a bunch of doppelgänger certificates with an altered algorithmIdentifier sequence which would trigger this lint (an example being the 10 certs caught using the corpus integration tests, which all appear to be altered versions of their original certificates.

I'd probably be find abandoning this change given this...

@cpu
Copy link
Member

cpu commented May 26, 2020

Hey @rolandshoemaker! Thanks for the PR.

I haven't had a chance to review it yet but wanted to leave a comment.

I'd probably be find abandoning this change given this...

I think it's worth keeping if the tradeoffs you mention are documented (in code comments or elsewhere). We actually have an outstanding issue for this lint that @sleevi filed: #419 I think we were favouring an approach that would put more of the ASN.1 work into ZCrypto (zmap/zcrypto#213) WDYT?

@rolandshoemaker
Copy link
Contributor Author

Ah interesting, I completely missed that issue.

In terms of exposing the signature that seems viable, but I'm not sure it's what you'd entirely want for this particular lint. Using asn1.Unmarshal means throwing away extraneous elements at the end of the SEQUENCE, so for instance an algorithmIdentifier with a trailing VideotextString will look just like one without, but won't actually be byte-for-byte equal. We could probably get access to those bytes, but it'd require adding a handful of asn1.RawContent and alias types all over the place.

@cpu cpu self-assigned this May 31, 2020
Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rolandshoemaker, this is a nice clean implementation ✨

Can you take a pass at fixing the integration test data based on the docs here? It looks like there's also a ~10 error level findings in the corpus. If you could give those a quick look-over when you update the integration/config.json to make sure they're true-positives that would be great.

For my review I flagged a few nits but there's nothing worth holding this PR up on. I'd like to give @sleevi a chance to 🔍 this before I merge but if he's tied up I'm also comfortable pulling the trigger once CI passes and letting it bake in-tree before the next RC.

Thanks again!

@cpu cpu requested a review from sleevi May 31, 2020 14:12
@rolandshoemaker
Copy link
Contributor Author

Thanks for the reviews, think I hit everything.

@zakird zakird merged commit de9eafb into zmap:master Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint the signature field of a tbsCertificate matches the signatureAlgorithm field of a certificate
4 participants