Fuzz introspector
For issues and ideas: https://github.com/ossf/fuzz-introspector/issues

Fuzzer details

Fuzzer: ssh2_client_fuzzer

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 203 38.8%
gold [1:9] 24 4.59%
yellow [10:29] 13 2.49%
greenyellow [30:49] 2 0.38%
lawngreen 50+ 280 53.6%
All colors 522 100

Fuzz blockers

The followings are the branches where fuzzer fails to bypass.

Unique non-covered Complexity Unique Reachable Complexities Unique Reachable Functions All non-covered Complexity All Reachable Complexity Function Name Function Callsite Blocked Branch
960 2621 15 :

['strlen', '_libssh2_sha_algo_ctx_init', '_libssh2_htonu32', '_libssh2_packet_require', '_libssh2_transport_send', '_libssh2_bn_from_bin', '_libssh2_dh_secret', 'BN_num_bits', '_libssh2_sha_algo_ctx_final', '_libssh2_debug_low', 'explicit_bzero', '_libssh2_sha_algo_value_hash', 'BN_bn2bin', '_libssh2_get_string', '_libssh2_sha_algo_ctx_update']

968 3005 diffie_hellman_sha_algo call site: 00000 /src/libssh2/src/kex.c:517
704 2668 19 :

['_libssh2_htonu32', '_libssh2_ecdh_gen_k', '_libssh2_get_string', 'BN_bn2bin', 'strlen', '_libssh2_sha512_init', '_libssh2_sha512_update', '_libssh2_packet_require', '_libssh2_transport_send', 'BN_num_bits', '_libssh2_sha384_update', 'explicit_bzero', '_libssh2_debug_low', '_libssh2_sha384_final', '_libssh2_sha512_final', '_libssh2_sha256_init', '_libssh2_sha256_update', '_libssh2_sha256_final', '_libssh2_sha384_init']

706 3011 ecdh_sha2_nistp call site: 00000 /src/libssh2/src/kex.c:1972
70 2002 13 :

['strlen', '_libssh2_htonu32', '_libssh2_curve25519_gen_k', '_libssh2_packet_require', '_libssh2_transport_send', '_libssh2_sha256_final', 'BN_num_bits', '_libssh2_debug_low', 'explicit_bzero', '_libssh2_sha256_init', 'BN_bn2bin', '_libssh2_sha256_update', '_libssh2_get_string']

72 2345 curve25519_sha256 call site: 00000 /src/libssh2/src/kex.c:2613
28 47 4 :

['_libssh2_calloc', '_libssh2_list_add', '_libssh2_channel_nextid', '_libssh2_debug_low']

28 1690 packet_x11_open call site: 00403 /src/libssh2/src/packet.c:349
25 44 3 :

['_libssh2_list_add', '_libssh2_channel_nextid', '_libssh2_debug_low']

25 1687 packet_authagent_open call site: 00432 /src/libssh2/src/packet.c:506
17 43 3 :

['_libssh2_rsa_new', '_libssh2_eob', '_libssh2_get_string']

17 43 hostkey_method_ssh_rsa_init call site: 00000 /src/libssh2/src/hostkey.c:102
15 67 3 :

['_libssh2_dsa_new', '_libssh2_eob', '_libssh2_get_string']

15 67 hostkey_method_ssh_dss_init call site: 00000 /src/libssh2/src/hostkey.c:570
11 11 2 :

['kex_get_method_by_name', 'strchr']

13 85 kex_agree_kex_hostkey call site: 00202 /src/libssh2/src/kex.c:3624
11 11 2 :

['kex_get_method_by_name', 'strchr']

13 33 kex_agree_hostkey call site: 00213 /src/libssh2/src/kex.c:3541
11 11 2 :

['kex_get_method_by_name', 'strchr']

13 33 kex_agree_crypt call site: 00224 /src/libssh2/src/kex.c:3703
11 11 2 :

['kex_get_method_by_name', 'strchr']

13 33 kex_agree_mac call site: 00234 /src/libssh2/src/kex.c:3767
11 11 2 :

['kex_get_method_by_name', 'strchr']

13 33 kex_agree_comp call site: 00245 /src/libssh2/src/kex.c:3821

Runtime coverage analysis

Covered functions
110
Functions that are reachable but not covered
35
Reachable functions
104
Percentage of reachable functions covered
66.35%
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
/src/libssh2/tests/ossfuzz/ssh2_client_fuzzer.cc 1
global.c 3
../src/openssl.c 3
session.c 16
misc.c 17
kex.c 12
hostkey.c 1
crypt.c 1
mac.c 2
comp.c 1
transport.c 6
packet.c 6
channel.c 7

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
hostkey_method_ssh_ed25519_initPEMFromMemory /src/libssh2/src/hostkey.c 5 ['struct._LIBSSH2_SESSION *', 'char *', 'size_t', 'char *', 'N/A'] 9 0 89 14 6 123 0 612 539
kex_method_ecdh_key_exchange /src/libssh2/src/kex.c 2 ['struct._LIBSSH2_SESSION *', 'struct.key_exchange_state_low_t *'] 28 0 358 44 17 117 0 1139 401
kex_method_curve25519_key_exchange /src/libssh2/src/kex.c 2 ['struct._LIBSSH2_SESSION *', 'struct.key_exchange_state_low_t *'] 28 0 359 45 17 111 0 968 215
kex_method_diffie_hellman_group_exchange_sha1_key_exchange /src/libssh2/src/kex.c 2 ['struct._LIBSSH2_SESSION *', 'struct.key_exchange_state_low_t *'] 28 0 347 39 16 117 0 983 207
_libssh2_pub_priv_keyfile /src/libssh2/src/../src/openssl.c 7 ['struct._LIBSSH2_SESSION *', 'N/A', 'size_t *', 'N/A', 'size_t *', 'char *', 'char *'] 8 0 164 16 4 121 0 535 59
libssh2_channel_read_ex /src/libssh2/src/channel.c 4 ['struct._LIBSSH2_CHANNEL *', 'int', 'char *', 'size_t'] 29 0 169 33 10 72 0 739 53
libssh2_channel_direct_streamlocal_ex /src/libssh2/src/channel.c 4 ['struct._LIBSSH2_SESSION *', 'char *', 'char *', 'int'] 29 0 101 20 7 75 0 736 46
libssh2_poll /src/libssh2/src/session.c 3 ['struct._LIBSSH2_POLLFD *', 'int', 'size_t'] 12 0 915 111 30 73 0 731 45
_libssh2_pem_parse /src/libssh2/src/pem.c 7 ['struct._LIBSSH2_SESSION *', 'char *', 'char *', 'char *', 'struct._IO_FILE *', 'N/A', 'size_t *'] 5 0 740 98 39 26 0 120 41
hostkey_method_ssh_ecdsa_sig_verify /src/libssh2/src/hostkey.c 6 ['struct._LIBSSH2_SESSION *', 'char *', 'size_t', 'char *', 'size_t', 'N/A'] 3 0 140 20 9 23 0 73 38

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

Functions statically reachable by fuzzers
50.0%
182 / 364
Cyclomatic complexity statically reachable by fuzzers
69.0%
2364 / 3450

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

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
[] []
/src/libssh2/src/global.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/misc.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/crypt.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/comp.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/hostkey.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/channel.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/kex.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/bcrypt_pbkdf.c [] []
/src/libssh2/src/keepalive.c [] []
/src/libssh2/src/../src/blowfish.c [] []
/src/libssh2/src/session.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/../src/openssl.c ['ssh2_client_fuzzer'] []
/src/libssh2/tests/ossfuzz/ssh2_client_fuzzer.cc ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/mac.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/transport.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/packet.c ['ssh2_client_fuzzer'] ['ssh2_client_fuzzer']
/src/libssh2/src/pem.c [] []

Directories in report

Directory
/src/libssh2/src/../src/
/src/libssh2/src/
/src/libssh2/tests/ossfuzz/