-
Notifications
You must be signed in to change notification settings - Fork 37
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
PEM private keys detect enchancement #456
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
561d64a
private keys enchanced search and validation
babenek c7b88d7
Check OPENSSH for encryption
babenek 7ab17f1
becnhmark scores fix, tests fix
babenek 6717550
Update credsweeper/rules/config.yaml
babenek 06af53f
severity
babenek 9685077
benchmark fix
babenek 0b31098
Merge branch 'main' into ecpkey
babenek a508383
tmp fix
babenek 440a992
update sample for depth 3
babenek 0085f89
benchmark scores fix
babenek 90d4e3f
benchmark scores fix 2
babenek 5e87de1
Apply suggestions from code review
babenek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
DATA: 19434458 valid lines. MARKUP: 74416 items | ||
DATA: 19419621 valid lines. MARKUP: 74230 items | ||
Category Positives Negatives Template | ||
-------------------------- ----------- ----------- ---------- | ||
Authentication Key & Token 77 1 31 | ||
Generic Secret 1056 15 203 | ||
Generic Token 333 45 558 | ||
Other 850 63503 634 | ||
Password 1406 110 4170 | ||
Other 844 63294 635 | ||
Password 1402 110 4164 | ||
Predefined Pattern 330 2 40 | ||
Private Key 1001 1 2 | ||
Private Key 1008 2 32 | ||
Seed, Salt, Nonce 40 4 4 | ||
TOTAL: 5093 63681 5642 | ||
Detected Credentials: 5840 | ||
credsweeper result_cnt : 5131, lost_cnt : 0, true_cnt : 4227, false_cnt : 904 | ||
TOTAL: 5090 63473 5667 | ||
Detected Credentials: 5864 | ||
credsweeper result_cnt : 5161, lost_cnt : 0, true_cnt : 4263, false_cnt : 898 | ||
Category TP FP TN FN FPR FNR ACC PRC RCL F1 | ||
-------------------------- ---- ---- -------- ---- --------- --------- -------- -------- -------- -------- | ||
Authentication Key & Token 60 4 28 17 0.125 0.220779 0.807339 0.9375 0.779221 0.851064 | ||
Generic Secret 973 3 215 83 0.0137615 0.0785985 0.932496 0.996926 0.921402 0.957677 | ||
Generic Token 289 7 596 44 0.0116086 0.132132 0.945513 0.976351 0.867868 0.918919 | ||
Other 594 756 63381 256 0.0117873 0.301176 0.984428 0.44 0.698824 0.54 | ||
Password 996 130 4150 410 0.0303738 0.291607 0.90503 0.884547 0.708393 0.78673 | ||
Other 589 749 63180 255 0.0117161 0.302133 0.9845 0.440209 0.697867 0.539872 | ||
Password 996 129 4145 406 0.0301825 0.289586 0.905743 0.885333 0.710414 0.788287 | ||
Predefined Pattern 312 2 40 18 0.0476191 0.0545455 0.946237 0.993631 0.945455 0.968944 | ||
Private Key 967 0 3 34 0.033966 0.966135 1 0.966034 0.982724 | ||
Private Key 1008 2 32 0 0.0588235 0.998081 0.99802 1 0.999009 | ||
Seed, Salt, Nonce 36 2 6 4 0.25 0.1 0.875 0.947368 0.9 0.923077 | ||
4227 904 19428461 866 4.653e-05 0.170037 0.999909 0.823816 0.829963 0.826878 | ||
4263 898 19413633 827 4.625e-05 0.162475 0.999911 0.826003 0.837525 0.831724 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain it more about why you decided to remove
EC
keyword from the pattern?I think EC(elliptic curve encryption) can't be decrypted..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In openssl/test exists not encrypted EC key https://github.com/openssl/openssl/blob/master/test/testec-p256.pem.
It can be analysed with ASN1 parser. It works without a password:
Encrypted key i found has structure like this and cannot be parsed with asn1:
So, i think, with the simple analysis for ASN1 structure we can decide whether a key is encrypted or not in the level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh.. i didn't know about that.
Yes, using ASN1 decryption can be a solution.
How about change the logic to check ASN1 decryptable if the line includes EC keyword?
And other cases that doesn't include EC keyword just follow the logic before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full decryption is not acceptable for obfuscated benchmark. If first symbols are not changed - the header might be parsed in benchmark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@csh519
EC keys are ASN1 too (if are not encrypted), so the approach may be used too.
OPENSSH keys have PBKDF2 format and cannot be checked with the obfuscated values. Only keyword 'bcrypt' in header may point to encrypted key.
PGP is still checked for entropy..