tls module serial numbers should have at least 20 bits of entropy #16744
Labels
Bug
broken, incorrect, or confusing behavior
Execution-Module
help-wanted
Community help is needed to resolve this
P2
Priority 2
Platform
Relates to OS, containers, platform-based utilities like FS, system based apps
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Looking at the
salt/modules/tls.py
code I see that the_new_serial
function creates a serial number based off a md5sum of ca_name, CN, and the time. This should be modified to have atleast 20 bits of entropy, but really the whole thing (or most of it) should probably just be random. This could be as simple as doingbinascii.hexlify(os.urandom(20))
.The rationale is that one of the ways to defeat preimage attacks on certificate signing is by introducing entropy into the certificate payload. While an md5(ca_name + stuff + time) is unlikely to be exploited it would be considered best practice to provide as much entropy as possible in the serial. For those who are mega paranoid about fantastically improbable collisions you can do a smaller chunk from os.urandom and then add microtime to it and hexlify that payload.
In the guidelines for public CA's (https://cabforum.org/wp-content/uploads/Baseline_Requirements_V1_1_9.pdf section 9.6) it says:
The text was updated successfully, but these errors were encountered: