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

Add regex and tests for PEM formatted private key #179

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

alfredtso
Copy link
Contributor

The regex will match private key generated by ssh-keygen and those
defined by OpenSSL header file. The regex, however, doesn't validate if
the string within BEGIN and END label is "correct" Base64 encoded. As it
can be validated be direct checking with the public key

Resolves: #174

"Name": "PEM-formatted Private Key",
"Regex": "^(-----BEGIN( ANY| RSA| DSA| ENCRYPTED| EC| OPENSSH)? PRIVATE KEY-----\\n?[a-zA-Z0-9\\/\\.\\n\\:\\+\\=]+-----END( ANY| RSA| DSA| ENCRYPTED| EC| OPENSSH)? PRIVATE KEY-----)$",
"plural_name": false,
"Description": "Textual encoding of Public-Key Cryptography Standards (PKCS) described in RFC7468. Some of these PEM headers are defined in OpenSSL in https://github.com/openssl/openssl/blob/master/include/openssl/pem.h",
Copy link
Owner

Choose a reason for hiding this comment

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

@amadejpapez Do you think we need this description?

Copy link
Collaborator

@amadejpapez amadejpapez Oct 7, 2021

Choose a reason for hiding this comment

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

I don't think so. If a user wants to get this additional info they can easily search for it. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should i change it or what should i do? sorry first time contributing, don't know how to proceed 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi! We think it is not needed, so you can remove it yes. Replace it with null :)

"Rarity": 1,
"URL": null,
"Tags": [
"Credentials"
Copy link
Owner

Choose a reason for hiding this comment

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

Can we add the tag "Bug Bounty" here too please?

The regex will match private key generated by ssh-keygen and those
defined by OpenSSL header file. The regex, however, doesn't validate if
the string within BEGIN and END label is "correct" Base64 encoded. As it
can be validated be direct checking with the public key

Resolves: bee-san#174
@bee-san bee-san enabled auto-merge (squash) October 8, 2021 08:33
@bee-san bee-san merged commit 005516a into bee-san:main Oct 8, 2021
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.

Add Regex from sshGit
3 participants