T09 · Insecure Skill Coding Practices
- Location
scripts/healthcheck.sh:6- Finding
SSH Host-Key Verification Is Disabled
- Content
View full analysis
Vulnerability Details
File Location:
scripts/healthcheck.sh, line 6
Vulnerability Type: Improper SSH server authentication
Risk Level: MediumVulnerable Code
bash ssh -i $KEY -o StrictHostKeyChecking=no $USER@$HOST << EOFTechnical Analysis
The script explicitly sets
StrictHostKeyChecking=no. This causes SSH to accept an unknown or changed server host key without requiring validation by the operator.SSH host-key verification establishes that the remote endpoint is the intended server. Disabling it allows a system controlling DNS resolution, network routing, or a network gateway to impersonate the target host. Although SSH public-key authentication does not directly disclose the private key, the client can authenticate to or interact with an unintended endpoint without warning.
The behavior is not necessary for health auditing. A health-check tool can use the normal SSH trust model, a pre-provisioned
known_hostsfile, or carefully controlled trust-on-first-use behavior.Attack Path
- A user invokes the health-check script for a remote VPS.
- An attacker interferes with DNS resolution or network routing for the specified host.
- The attacker presents an SSH host key that is not associated with the legitimate VPS.
StrictHostKeyChecking=nosuppresses the host-identity validation failure.- The script connects to the attacker-controlled endpoint and runs the diagnostic command sequence against the wrong server.
Impact Assessment
An attacker can impersonate the audited server and cause the client to establish an SSH connection to an unintended host. This undermines the integrity and confidentiality of the audit session and can produce falsified health-check results. The vulnerability does not, by itself, reveal the contents of the client's private key or grant access to the legitimate server.
- Remediation
View remediation
Remediation Suggestions
-
Remove
-o StrictHostKeyChecking=no. -
Use
StrictHostKeyChecking=yesfor pre-provisioned infrastructure. -
Maintain a dedicated
known_hostsfile containing independently verified host keys. -
If trust on first use is operationally required, use
StrictHostKeyChecking=accept-new; this still rejects changed keys. -
Consider specifying a dedicated known-hosts database:
bash ssh \ -o StrictHostKeyChecking=yes \ -o UserKnownHostsFile="$HOME/.ssh/known_hosts" \ -i "$KEY" \ "$USER@$HOST" -
Document a secure process for verifying server fingerprints before the first audit.
-
