Repository navigation
Conversation
Adds a fuzz harness for libssh2_knownhost_readline() covering the OpenSSH known_hosts line parser in src/knownhost.c: - Plain and comma-separated hostname parsing (oldstyle_hostline) - Hashed hostname parsing (hashed_hostline, |1|salt|hash format) - Key-type token recognition and base64 public-key blob decoding - HMAC-SHA1 computation for hashed host verification The harness uses only the public API, requires no network access, and is wired into CMakeLists.txt, Makefile.am, and ossfuzz.sh.
09f460c to
ceb2ba2
Compare
|
Thanks for the feedback @vszakats! Addressed all three points:
Regarding merging into PR #1953: that PR already covers both sftp and knownhost fuzzers. I'm happy to close this one if #1953 is the preferred path, or keep this as a standalone PR for just the knownhost fuzzer — whichever you prefer. |
Since merging both this and #1953 will conflict due to doing the same/similar |
|
Closing as requested by @vszakats — the |
Summary
The existing
ssh2_client_fuzzercovers only the SSH session handshake. Theknown_hostsparser (src/knownhost.c) has no OSS-Fuzz coverage.src/knownhost.chandles: base64 decoding of host keys, SHA1 HMAC hostname hashing/matching, OpenSSHknown_hostsline parsing (including|1|salt prefix), and binary-search of the host store.New harness:
tests/ossfuzz/ssh2_knownhost_fuzzer.ccThree operation modes (selected by first fuzz byte):
libssh2_knownhost_readline()– parse one known_hosts linelibssh2_knownhost_checkp()hostname lookuplibssh2_knownhost_writefile()write round-trip