Fuzz introspector
For issues and ideas: https://github.com/ossf/fuzz-introspector/issues
Report generation date: 2024-10-16

Project overview: pycrypto

High level conclusions

Reachability and coverage overview

Functions statically reachable by fuzzers
5.0%
45 / 892
Cyclomatic complexity statically reachable by fuzzers
6.0%
168 / 2870
Runtime code coverage of functions
12.0%
108 / 892

Warning: The number of runtime covered functions are larger than the number of reachable functions. This means that Fuzz Introspector found there are more functions covered at runtime than what is considered reachable based on the static analysis. This is a limitation in the analysis as anything covered at runtime is by definition reachable by the fuzzers.
This is likely due to a limitation in the static analysis. In this case, the count of functions covered at runtime is the true value, which means this is what should be considered "achieved" by the fuzzer.

Use the project functions table below to query all functions that were not covered at runtime.

Fuzzer details

Fuzzer: fuzz_hash

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 5 45.4%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 6 54.5%
All colors 11 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
3 6 ...fuzz_hash.TestOneInput call site: 00006 fdp.ConsumeBytes
2 1 ...fuzz_hash.TestOneInput call site: 00001 f.new

Runtime coverage analysis

Covered functions
142
Functions that are reachable but not covered
9
Reachable functions
9
Percentage of reachable functions covered
0.0%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_hash 8

Fuzzer: fuzz_aes

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 149 68.9%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 67 31.0%
All colors 216 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
49 115 Crypto.Util.number.bytes_to_long call site: 00115 Crypto.Cipher.blockalgo.BlockAlgo._start_gcm
42 172 Crypto.Cipher.blockalgo.BlockAlgo.encrypt call site: 00172 Crypto.Cipher.blockalgo.BlockAlgo._start_ccm
13 56 Crypto.Util.number.long_to_bytes call site: 00056 Crypto.Util.Counter.new
8 103 Crypto.Cipher.blockalgo.BlockAlgo._start_PGP call site: 00103 Crypto.Cipher.blockalgo.BlockAlgo._start_eax
6 20 Crypto.Hash.CMAC._SmoothMAC.update call site: 00020 Crypto.Cipher.blockalgo._GHASH._update
6 39 Crypto.Hash.CMAC.CMAC.update call site: 00039 Crypto.Cipher.blockalgo.BlockAlgo._start_ccm
5 14 Crypto.Cipher.blockalgo.BlockAlgo.__init__ call site: 00014 Crypto.Cipher.blockalgo._CBCMAC.__init__
4 87 Crypto.Util.Counter.new call site: 00087 Crypto.Util.py3compat.bstr
4 98 Crypto.Cipher.blockalgo.BlockAlgo._start_PGP call site: 00098 Crypto.Util.py3compat.b
3 165 Crypto.Cipher.blockalgo.BlockAlgo.__init__ call site: 00165 Crypto.Cipher.blockalgo.BlockAlgo.__init__
2 75 Crypto.Util.Counter._encode call site: 00075 Crypto.Util.py3compat.bchr
1 36 Crypto.Hash.CMAC._SmoothMAC.update call site: 00036 Crypto.Hash.CMAC.CMAC.update

Runtime coverage analysis

Covered functions
142
Functions that are reachable but not covered
52
Reachable functions
71
Percentage of reachable functions covered
26.76%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_aes 6
Crypto.Cipher.AES 2
Crypto.Cipher.blockalgo 36
Crypto.Hash.CMAC 18
Crypto.Util.py3compat 6
Crypto.Util.number 6
Crypto.Util.Counter 13
Crypto.Protocol.KDF 9

Fuzzer: fuzz_number

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 8 12.9%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 54 87.0%
All colors 62 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
3 3 ...fuzz_number.TestOneInput call site: 00003 .int
3 58 Crypto.Util.number.getStrongPrime call site: 00058 fdp.ConsumeIntInRange
1 22 Crypto.Util.number.getRandomInteger call site: 00022 .chr
1 43 Crypto.Util.number._rabinMillerTest call site: 00043 Crypto.Util.number.getRandomRange

Runtime coverage analysis

Covered functions
142
Functions that are reachable but not covered
25
Reachable functions
35
Percentage of reachable functions covered
28.57%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_number 5
Crypto.Util.number 27
Crypto.Util.py3compat 3

Fuzzer: fuzz_all_or_nothing

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 2 28.5%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 5 71.4%
All colors 7 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
2 4 ...fuzz_all_or_nothing.TestOneInput call site: 00004 AllOrNothing.AllOrNothing

Runtime coverage analysis

Covered functions
141
Functions that are reachable but not covered
6
Reachable functions
6
Percentage of reachable functions covered
0.0%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...fuzz_all_or_nothing 5

Analyses and suggestions

Optimal target analysis

Remaining optimal interesting functions

The following table shows a list of functions that are optimal targets. Optimal targets are identified by finding the functions that in combination, yield a high code coverage.

Func name Functions filename Arg count Args Function depth hitcount instr count bb count cyclomatic complexity Reachable functions Incoming references total cyclomatic complexity Unreached complexity
Crypto.SelfTest.run Crypto.SelfTest 6 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 4 0 4 7 6 122 0 383 368
Crypto.PublicKey.RSA.RSAImplementation.importKey Crypto.PublicKey.RSA 3 ['N/A', 'N/A', 'N/A'] 9 0 2 5 5 117 8 398 185
Crypto.PublicKey.DSA._DSAobj.exportKey Crypto.PublicKey.DSA 5 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 9 0 1 11 7 117 9 392 94
Crypto.SelfTest.Random.test__UserFriendlyRNG.RNGForkTest.runTest Crypto.SelfTest.Random.test__UserFriendlyRNG 1 ['N/A'] 7 0 13 3 4 36 0 112 91
Crypto.Util.asn1.DerBitString._decodeFromStream Crypto.Util.asn1 2 ['N/A', 'N/A'] 12 0 2 2 4 32 6 105 58
Crypto.Random.Fortuna.FortunaAccumulator.FortunaAccumulator.random_data Crypto.Random.Fortuna.FortunaAccumulator 2 ['N/A', 'N/A'] 7 0 2 2 4 79 0 266 50
Crypto.Signature.PKCS1_PSS.PSS_SigScheme.sign Crypto.Signature.PKCS1_PSS 2 ['N/A', 'N/A'] 6 0 1 2 4 30 2 97 48
Crypto.SelfTest.Cipher.common.CipherSelfTest.runTest Crypto.SelfTest.Cipher.common 1 ['N/A'] 4 0 9 5 5 36 0 118 47
Crypto.SelfTest.Cipher.common.AEADTests.multiple_updates Crypto.SelfTest.Cipher.common 1 ['N/A'] 9 0 7 2 4 82 1 286 43
Crypto.Random.OSRNG.posix.DevURandomRNG.__init__ Crypto.Random.OSRNG.posix 2 ['N/A', 'N/A'] 5 0 2 2 4 14 2 50 35

Implementing fuzzers that target the above functions will improve reachability such that it becomes:

Functions statically reachable by fuzzers
26.0%
236 / 892
Cyclomatic complexity statically reachable by fuzzers
28.0%
817 / 2870

All functions overview

If you implement fuzzers for these functions, the status of all functions in the project will be:

Func name Functions filename Args Function call depth Reached by Fuzzers Fuzzers runtime hit Func lines hit % I Count BB Count Cyclomatic complexity Functions reached Reached by functions Accumulated cyclomatic complexity Undiscovered complexity

Fuzz engine guidance

This sections provides heuristics that can be used as input to a fuzz engine when running a given fuzz target. The current focus is on providing input that is usable by libFuzzer.

/src/fuzz_hash.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['...fuzz_hash.TestOneInput']

/src/fuzz_aes.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['Crypto.Util.number.bytes_to_long', 'Crypto.Cipher.blockalgo.BlockAlgo.encrypt', 'Crypto.Util.number.long_to_bytes', 'Crypto.Cipher.blockalgo.BlockAlgo._start_PGP', 'Crypto.Hash.CMAC._SmoothMAC.update', 'Crypto.Hash.CMAC.CMAC.update', 'Crypto.Cipher.blockalgo.BlockAlgo.__init__', 'Crypto.Util.Counter.new']

/src/fuzz_number.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['...fuzz_number.TestOneInput', 'Crypto.Util.number.getStrongPrime', 'Crypto.Util.number.getRandomInteger', 'Crypto.Util.number._rabinMillerTest']

/src/fuzz_all_or_nothing.py

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['...fuzz_all_or_nothing.TestOneInput']

Files and Directories in report

This section shows which files and directories are considered in this report. The main reason for showing this is fuzz introspector may include more code in the reasoning than is desired. This section helps identify if too many files/directories are included, e.g. third party code, which may be irrelevant for the threat model. In the event too much is included, fuzz introspector supports a configuration file that can exclude data from the report. See the following link for more information on how to create a config file: link

Files in report

Source file Reached by Covered by
[] []
Crypto.Util.RFC1751 [] []
[] []
Crypto.Hash.SHA [] []
re [] []
Crypto.SelfTest.Hash.test_RIPEMD160 [] []
Crypto.SelfTest.PublicKey.test_import_RSA [] []
Crypto.SelfTest.Cipher.test_CAST [] []
Crypto.Hash.CMAC ['fuzz_aes'] []
Crypto.Util.asn1 [] []
Crypto.PublicKey.RSA [] []
Crypto.Random.Fortuna.FortunaGenerator [] []
Crypto.SelfTest.Random.OSRNG.test_posix [] []
Crypto.SelfTest.Random.OSRNG.test_winrandom [] []
Crypto.SelfTest.PublicKey [] []
Crypto.SelfTest.PublicKey.test_RSA [] []
Crypto.Util.Padding [] []
Crypto.PublicKey [] []
os [] []
math [] []
Crypto.Cipher.XOR [] []
atheris [] []
Crypto.SelfTest.Protocol.test_rfc1751 [] []
Crypto.Protocol.AllOrNothing [] []
Crypto.SelfTest.Util [] []
Crypto.SelfTest.Util.test_asn1 [] []
Crypto.Random.OSRNG [] []
Crypto.SelfTest.Random [] []
Crypto.SelfTest.Util.test_winrandom [] []
Crypto.SelfTest.Random.OSRNG.test_nt [] []
stat [] []
Crypto.SelfTest.Protocol.test_AllOrNothing [] []
Crypto.SelfTest.Cipher.test_DES [] []
warnings [] []
Crypto.Util._time [] []
Crypto.Util.winrandom [] []
Crypto.SelfTest.Cipher [] []
Crypto.PublicKey._RSA [] []
Crypto.SelfTest.Signature [] []
Crypto.SelfTest.Hash.test_HMAC [] []
Crypto.Random.OSRNG.fallback [] []
Crypto.SelfTest.Signature.test_pkcs1_15 [] []
threading [] []
Crypto.PublicKey.pubkey [] []
unittest [] []
Crypto.SelfTest.Hash.test_SHA512 [] []
Crypto.SelfTest.Cipher.test_ARC4 [] []
io [] []
Crypto.SelfTest.Util.test_number [] []
Crypto.Cipher.Blowfish [] []
Crypto.SelfTest.Random.OSRNG [] []
Crypto.Random._UserFriendlyRNG [] []
Crypto.SelfTest.Cipher.test_ARC2 [] []
Crypto.Random.OSRNG.posix [] []
Crypto.SelfTest.Hash.test_SHA384 [] []
Crypto.Signature.PKCS1_v1_5 [] []
Crypto.SelfTest.PublicKey.test_import_DSA [] []
Crypto.Cipher.DES [] []
Crypto.SelfTest.Hash.test_CMAC [] []
...fuzz_all_or_nothing ['fuzz_all_or_nothing'] []
Crypto.IO.PEM [] []
Crypto.Cipher.ARC2 [] []
multiprocessing [] []
Crypto.Hash.MD5 [] []
getopt [] []
imp [] []
Crypto.Cipher [] []
Crypto.SelfTest.Hash.test_SHA1 [] []
Crypto.Cipher.CAST [] []
Crypto.SelfTest.Signature.test_pkcs1_pss [] []
Crypto.IO.PKCS8 [] []
Crypto.IO._PBES [] []
Crypto.Cipher.ARC4 [] []
Crypto.SelfTest.Random.test_rpoolcompat [] []
Crypto.SelfTest.Cipher.test_Blowfish [] []
Crypto.Random.OSRNG.rng_base [] []
Crypto.Random.random [] []
Crypto.Cipher.PKCS1_OAEP [] []
base64 [] []
Crypto.Random.Fortuna.FortunaAccumulator [] []
Crypto.SelfTest.Cipher.test_pkcs1_15 [] []
Crypto.SelfTest.Util.test_Padding [] []
Crypto.Util.number ['fuzz_aes', 'fuzz_number'] []
Crypto.SelfTest.Hash.test_MD2 [] []
Crypto.Protocol [] []
Crypto.Signature [] []
Crypto.SelfTest.Util.test_Counter [] []
md5 [] []
...fuzz_hash ['fuzz_hash'] []
Crypto.Util._number_new [] []
Crypto.SelfTest.IO.test_PKCS8 [] []
...fuzz_aes ['fuzz_aes'] []
Crypto.Cipher.PKCS1_v1_5 [] []
Crypto.Hash.SHA1 [] []
Crypto.SelfTest.Random.Fortuna.test_FortunaAccumulator [] []
Crypto.SelfTest.Cipher.test_pkcs1_oaep [] []
Crypto.Random.Fortuna.SHAd256 [] []
Crypto.Cipher.DES3 [] []
Crypto.SelfTest.st_common [] []
Crypto.Util [] []
Crypto.Util.randpool [] []
Crypto.Signature.PKCS1_PSS [] []
Crypto.Cipher.blockalgo ['fuzz_aes'] []
sha [] []
Crypto.SelfTest.Cipher.test_AES [] []
Crypto.SelfTest.Hash.test_SHA256 [] []
Crypto.SelfTest.Cipher.common [] []
Crypto.SelfTest.PublicKey.test_ElGamal [] []
Crypto.SelfTest.Hash.test_MD5 [] []
sys [] []
Crypto.Random.Fortuna [] []
Crypto.SelfTest.Hash [] []
struct [] []
functools [] []
hashlib [] []
Crypto.PublicKey._slowmath [] []
pickle [] []
Crypto.SelfTest.Random.OSRNG.test_generic [] []
Crypto.SelfTest.Hash.test_SHA224 [] []
Crypto.SelfTest.PublicKey.test_DSA [] []
Crypto.SelfTest.Hash.common [] []
Crypto [] []
Crypto.SelfTest.Random.Fortuna [] []
Crypto.SelfTest.Random.test_random [] []
Crypto.SelfTest.Random.Fortuna.test_FortunaGenerator [] []
Crypto.IO [] []
Crypto.SelfTest.Protocol.test_KDF [] []
Crypto.SelfTest.Protocol [] []
Crypto.SelfTest.IO [] []
Crypto.Util.Counter ['fuzz_aes'] []
Crypto.Cipher.AES ['fuzz_aes'] []
Crypto.SelfTest.Hash.test_MD4 [] []
Crypto.SelfTest [] []
Crypto.Protocol.KDF ['fuzz_aes'] []
Crypto.Hash.RIPEMD [] []
Crypto.Random [] []
Crypto.PublicKey._DSA [] []
time [] []
Crypto.Util.py3compat ['fuzz_aes', 'fuzz_number'] []
Crypto.SelfTest.Random.test__UserFriendlyRNG [] []
Crypto.SelfTest.Random.OSRNG.test_fallback [] []
Crypto.PublicKey.ElGamal [] []
Crypto.SelfTest.Cipher.test_XOR [] []
Crypto.SelfTest.Random.Fortuna.test_SHAd256 [] []
Crypto.Protocol.Chaffing [] []
...fuzz_number ['fuzz_number'] []
binascii [] []
Crypto.Hash.HMAC [] []
Crypto.pct_warnings [] []
Crypto.PublicKey.DSA [] []
Crypto.SelfTest.Protocol.test_chaffing [] []
Crypto.Hash [] []
Crypto.SelfTest.Cipher.test_DES3 [] []

Directories in report

Directory