Skip to content

fuzz: add sshconfig_fuzz harness for SSH client config parser#680

Open
XananasX7 wants to merge 1 commit into
openssh:masterfrom
XananasX7:fuzz-sshconfig-and-authkeys
Open

fuzz: add sshconfig_fuzz harness for SSH client config parser#680
XananasX7 wants to merge 1 commit into
openssh:masterfrom
XananasX7:fuzz-sshconfig-and-authkeys

Conversation

@XananasX7

Copy link
Copy Markdown

Summary

Add a new libfuzzer harness sshconfig_fuzz.cc that covers the SSH client configuration file parser (readconf.c).

Motivation

The SSH client config parser (readconf.c, 3957 lines) handles complex and security-sensitive directives:

  • Match blocks with arbitrary criteria
  • ProxyCommand / ProxyJump arguments
  • IdentityFile / CertificateFile path patterns
  • Hostname canonicalization rules
  • Per-host option merging

This parser is exercised whenever a client reads ~/.ssh/config or /etc/ssh/ssh_config. It is currently not covered by any OSS-Fuzz harness.

Changes

  • regress/misc/fuzz-harness/sshconfig_fuzz.cc: new harness calling read_config_file() with fuzz input written to a tempfile. Exercises process_config_line_depth() across all config keywords and Match blocks.
  • regress/misc/fuzz-harness/Makefile: add sshconfig_fuzz to TARGETS with correct link deps (readconf.o, addrmatch.o, misc.o, krl.o).

Testing

Harness builds cleanly following the existing Makefile pattern. Verified locally that initialize_options() + read_config_file() is the correct entry point used by the SSH client binary.

Add a libfuzzer harness covering the SSH client configuration file
parser (readconf.c). The parser handles complex directives including
Match blocks, ProxyCommand, IdentityFile patterns, and many other
options that represent a large attack surface for malformed input.

The new harness:
- Writes fuzz input to a tempfile and calls read_config_file()
- Exercises process_config_line_depth() across all config keywords
- Covers Match block evaluation and conditional parsing
- Builds against readconf.o, addrmatch.o, misc.o, krl.o

Also adds sshconfig_fuzz to the TARGETS list in Makefile.
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.

1 participant