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

Lints: add new lints for Mozilla Root Store Policy (adopted) #353

Merged
merged 44 commits into from
Jan 16, 2020

Conversation

cpu
Copy link
Member

@cpu cpu commented Jan 15, 2020

This is an updated copy of #323 by @fotisl that addresses the outstanding review feedback.

It adds five new lints to the lints/mozilla package, specyfing the source lint.MozillaRootStorePolicy

  1. n_mp_allowed_eku
  2. e_mp_authority_key_identifier_correct
  3. e_mp_exponent_cannot_be_one
  4. e_mp_modulus_must_be_2048_bits_or_more
  5. e_mp_modulus_must_be_divisible_by_8

Notable changes from #323:

To be done:

  • Integration test data update: I'm working on verifying the new lint findings. I'll push a commit with updated test data for these lints over the next few days. Opening this PR as a draft in the meantime.

fotisl and others added 30 commits October 2, 2019 14:00
Mozilla Root Store Policy contains multiple different requirements on
RSA keys. All these were tested in a single lint. These split into two
different lints based on the different requirement.
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
Co-Authored-By: Daniel McCarney <daniel@binaryparadox.net>
@cpu cpu requested a review from zakird January 15, 2020 15:45
@cpu cpu self-assigned this Jan 15, 2020
@zakird
Copy link
Member

zakird commented Jan 15, 2020 via email

Copy link
Member

@zakird zakird left a comment

Choose a reason for hiding this comment

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

Thanks for the insight @cpu and @jsha. This looks good to go once we get the test numbers fixed up.

@cpu
Copy link
Member Author

cpu commented Jan 16, 2020

This looks good to go once we get the test numbers fixed up.

Here's my analysis of the new findings across the integration test corpus. Everything looked good to me so I've run make integration INT_FLAGS="-overwriteExpected" and committed the updated data to the branch in 44d8557.

n_mp_allowed_eku

This new lint has 14 informational findings in the integration test data. I checked each but did not cross-reference which had SPKI's in the Moz. trust data (e.g. some will be false positives).

The majority were flagged because they had no EKU:

https://censys.io/certificates/05503f08d2dc8edd2467cd211e6dc356bb1b7869fea2b62f697dc136b7960675
https://censys.io/certificates/06b9722a699c57dff1869f430b479bb6eb49aae1184eac9c5325c1334a34ea4c
https://censys.io/certificates/072bedbcf4d334598e341d72abcf14cdd8c3f9a7310e0157fc0375239de018ab
https://censys.io/certificates/68b9c761219a5b1f0131784474665db61bbdb109e00f05ca9f74244ee5f5f52b
https://censys.io/certificates/7f93e8e4bee47624ced4e8384dba96c4828d461d787d0ae3eb316de985d51c6c
https://censys.io/certificates/89c82431c45c730113cf570faf37fa4e62f9a57c8232a98cedc7e6ff89326c43
https://censys.io/certificates/a6cf64dbb4c8d5fd19ce48896068db03b533a8d1336c6256a87d00cbb3def3ea
https://censys.io/certificates/b959b2482b6db289bf2f04af99c2323c260b50d45914171292a24d5e5325f3d9
https://censys.io/certificates/c84e1378b974a991acdcdd733421e3061e6fa21a0491c8902bafde3855e0063e
https://censys.io/certificates/dda8da736187d76f4f0ed5a5f667b54d99a98ae06091d0e3a01714e9221695ad
https://censys.io/certificates/f90aca63cb8bb44f8d91b864474bb42aae177e73fdfe6f4acbd12a013a415c15

In one case there was an EKU, but I believe it wasn't known by the Go stdlib and so was not parsed. The EKU was 1.3.6.1.5.5.7.3.31 (BIMI certificate extended key usage):

https://censys.io/certificates/985fb389f469a5f1ed2d2d83e37b253054dfe74b81ca5e8e537f7f9f4ac08c81

Two cases were found where the EKU specified both x509.ExtKeyUsageEmailProtection and
x509.ExtKeyUsageServerAuth:

https://censys.io/certificates/ada5a71af2121b569104be385e746fa975617e81dbfaf6f722e62352471bd838
https://censys.io/certificates/e7fa0f67c9b6d886c868408996dbdfc3680e8b9ec47628eefb4824c23a287693

e_mp_authority_key_identifier_correct

This new lint has 135 error level findings in the integration test data. I didn't have the time to check each individually but I did spot check a handful. All of the ones I picked were issued by camerfirma and had an Authority Key Identifier that specified both a KeyID and a DirName. I believe these are true positives. Here are some examples I checked:

https://censys.io/certificates/00125724a9dc8587db9dc9ac3b6c61d63b57fbb5d15ce1177d230fad73d62ac1
https://censys.io/certificates/0664963819e53272c6d5a9468d0d2209a69e7a2be91f158251d7602a1f713881
https://censys.io/certificates/0d5247817c3660b6e76014471761e09d24071dd39beb14d17c3a51c72b1e7340
https://censys.io/certificates/1aca1f6ae73bc34ad1167150c0f216a65d4987c88f0eaefe18dee3ee2e08fca2
https://censys.io/certificates/2e37c6b08418b4fc71daed37151e2a54661c540e87988a8515adbd3e235a2380
https://censys.io/certificates/4e2e746641d5e2a7149f5f4165041ea1593ca34763620f42eecf72fd27eba4ec
https://censys.io/certificates/760a9c4ca28450ff37f44f75dac47f0c9548892dfb7fad9b4b6b9e04f2fc9497
https://censys.io/certificates/966fd35a445799f30b263e6faea85df68e8e2a666ada994ec6bb1e346dd692dc
https://censys.io/certificates/ecc96ed57b26c6f0c26017774e455479ab7433c36332d30e4f194b9a7e6a2caa
https://censys.io/certificates/fdef9ff897831ed5458c58ceb18e16140ffd92876879247f61f35eea15cdaeb6

e_mp_exponent_cannot_be_one

No findings.

e_mp_modulus_must_be_2048_bits_or_more

There was one error finding for a certificate issued by Actalis for an RSA
subject public key that has a modulus of 1024 bits.

https://censys.io/certificates/f6e2f72307d136d2b6687c45b0e400daacecf40fbf45b7631313757b4218fa34

e_mp_modulus_must_be_divisible_by_8

This lint found 21 error results. All appeared to be true positives:

These have a 2049 bit modulus:

https://censys.io/certificates/b67876ac20b5c4ae61de592ab5c9a699b0310d7d371b5da7600a77e9cdd6f9c8
https://censys.io/certificates/f818dd5d10a3fd552e6e8742062b45e4c0fca64097f65f86c91495ee0cfef12f
https://censys.io/certificates/b6b6be90a803812b242c096f071ad69a5c6754b05f0f3ac0d860018078dad3a2
https://censys.io/certificates/dfd97ffa6ffc88a7f67f1e5f50f9d8f01e62b737e24669a2271161e68dc3d101
https://censys.io/certificates/209d01a420eb39765b5f337ec1af51d0afd0da1c88fa254947e4fedeff2b956a

This one have a 2084 bit modulus:
https://censys.io/certificates/2d52b797d5205694063031883a0921b67a91ec2355c49832c19c1b8d25412bcf

These have a 4068 bit modulus:
https://censys.io/certificates/dd7b3f7d4fea75b9e2ab1c4113aee6b4a91c6f567aca3be0d0c3ce21fdfbcdde
https://censys.io/certificates/6675e16893fd7c879186424a6286e8cc1942dfde7ac7c69e7dd616d131ff0f95
https://censys.io/certificates/277b6e095189d18f69c1b9ab1181ba6a0a0afd82f168a31a37be24832aba1d3c
https://censys.io/certificates/8798b3d0f4354204c662527207a3316877326d52875cc86e1ded448b9b1ea8ac

These have a 4069 bit modulus:
https://censys.io/certificates/67d230b324ee9a02c3937df0add10a43efb020f11f920e3e82b88a150d756b1a
https://censys.io/certificates/c654421ceb26ed174cebdd41e35b56887142e90c9623ccf555f637cf5874a696
https://censys.io/certificates/8b62c95c5afec869c23add0266b6584628454294e985c4569d6c63856c65791f
https://censys.io/certificates/23759950308dbde8aaa74c774b2b91f4b72b921674ce916726e5c2307b6b33c1

These have a 4098 bit modulus:
https://censys.io/certificates/640b44ad18fed420bed7e482d4213929a1728c97e0510418e48ea43c80536fc8
https://censys.io/certificates/5406676dd9a5f8beb615c87d9d6d29dcaf8245c2f614dd637c3702515557eb0a
https://censys.io/certificates/a02c180e201526af8deafb9b0000673f79178dc39d778d98df36f511c3cac5ec
https://censys.io/certificates/ea0a0a04ef121ba8747593d170d00dd30fe93278d6db0a68abca6cc87b2aaf84
https://censys.io/certificates/7f65c7028867c6d18f29147365da30a41fe9c0e7d47f7bf25895a41577e309a2

These have a 20148 bit modulus (!!):
https://censys.io/certificates/205a97fb109b514e80056229b5086d90906f73f55035b52afeb76a0392d71ce7
https://censys.io/certificates/cf8324c03a18987436ea2e72f927a04106ccebb02f70e2dd29ae44826e95af49

@cpu cpu marked this pull request as ready for review January 16, 2020 16:00
@cpu cpu requested a review from zakird January 16, 2020 16:12
@sleevi
Copy link
Contributor

sleevi commented Jan 16, 2020

All of the ones I picked were issued by camerfirma and had an Authority Key Identifier that specified both a KeyID and a DirName. I believe these are true positives.

Yes, this is https://bugzilla.mozilla.org/show_bug.cgi?id=1586860

@cpu
Copy link
Member Author

cpu commented Jan 16, 2020

@sleevi Aha, thanks! I didn't think to check Bugzilla for overlap.

@zakird zakird merged commit 566701e into zmap:master Jan 16, 2020
@cpu cpu deleted the cpu-adopts-323 branch January 16, 2020 17:21
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.

5 participants