trufflesecurity / trufflehog

Find, verify, and analyze leaked credentials
https://trufflesecurity.com
GNU Affero General Public License v3.0
17.34k stars 1.72k forks source link

PrivateKey detector should emit some metadata about the corresponding certificate if available #3631

Open hasnain-db opened 3 days ago

hasnain-db commented 3 days ago

Description

In some cases private keys are committed alongside the certificate chain in the same file. In those cases, it would be great if TruffleHog can also emit metadata about the cert (similar to how e.g. the AWS detector emits the account ID). In particular, some fields I think would be relevant:

Preferred Solution

N/A

Additional Context

N/A

References

Conceptually, I think this aligns well with what driftwood already does: https://trufflesecurity.com/blog/driftwood

ahrav commented 3 days ago

Hey @hasnain-db, thanks for opening this issue! I’m working on updating Driftwood to store some of the issuer information that wasn’t previously saved. Once that’s done, I’ll re-index the existing records and update the private key detector to include the information you mentioned in the ExtraData field.

One thing to note: we might not be able to retrieve issuer information for all certificates, as some of the CT servers we indexed in the past are no longer online. I’ll link the PR for the private key detector update to this issue once I start working on it.

hasnain-db commented 2 days ago

thanks @ahrav ! Really appreciate this. FWIW I added 2 more fields to the list after consulting with someone else.