-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from mike-arnica/security-review
Fix insecure/undeclared raised errors; initial commit of scripts for atheris fuzzer
- Loading branch information
Showing
5 changed files
with
151 additions
and
87 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python3.10 | ||
|
||
import atheris,sys | ||
import sys | ||
with atheris.instrument_imports(): | ||
#import openssh_key | ||
from openssh_key.private_key_list import PrivateKeyList | ||
|
||
@atheris.instrument_func | ||
def TestOneInput(data): | ||
key = bytes("-----BEGIN OPENSSH PRIVATE KEY-----\nopenssh-key-v1", 'utf-8') \ | ||
+ data \ | ||
+ bytes("\n-----END OPENSSH PRIVATE KEY-----\n", 'utf-8') | ||
try: | ||
parsed = PrivateKeyList.from_string(key, None) | ||
except ValueError as e: | ||
if e.args[0] == "Not an openssh private key": | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
atheris.Setup(sys.argv, TestOneInput) | ||
atheris.Fuzz() |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3.10 | ||
|
||
import atheris | ||
import sys, re | ||
from base64 import b64encode | ||
|
||
with atheris.instrument_imports(): | ||
#import openssh_key | ||
from openssh_key.private_key_list import PrivateKeyList | ||
|
||
@atheris.instrument_func | ||
def TestOneInput(data): | ||
headered_data = bytes("openssh-key-v1", 'utf-8') | ||
b = bytes("-----BEGIN OPENSSH PRIVATE KEY-----\n", 'utf-8') \ | ||
+ re.sub(b"(.{70})", b"\\1\n", b64encode(headered_data), 0, re.DOTALL) \ | ||
+ bytes("\n-----END OPENSSH PRIVATE KEY-----\n", 'utf-8') | ||
key = b.decode("utf-8") | ||
try: | ||
parsed = PrivateKeyList.from_string(key, None) | ||
except ValueError as e: | ||
if not e.args[0] == "Unexpected error condition reached.": | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
atheris.Setup(sys.argv, TestOneInput) | ||
atheris.Fuzz() |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bcrypt@3.2.2 | ||
cffi@1.15.0 | ||
pycparser@2.21 | ||
atheris@2.0.11 |