T09 · Insecure Skill Coding Practices
- Location
SKILL.md:126- Finding
SSH Host-Key Verification Disabled in Password-Based Connection Example
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:126
Vulnerability Type: SSH server authentication bypass through disabled host-key verification
Risk Level: Highbash lelogin exec --env-file ssh.env -- /bin/sh -c \ 'sshpass -e ssh -o StrictHostKeyChecking=no -p "$SSH_PORT" \ "$SSH_USER@$SSH_HOST" "echo ok"'Technical Analysis
The documented SSH workflow passes
StrictHostKeyChecking=noto the SSH client. This setting permits a connection to proceed without requiring the remote server's host key to be trusted or previously verified.The same workflow retrieves a password from
lelogin, injects it into theSSHPASSenvironment variable, and directssshpass -eto submit that password during authentication. Consequently, disabling host-key verification removes the mechanism that protects the injected credential from being sent to an impersonated SSH server.An attacker able to manipulate DNS resolution, routing, network traffic, or the specified SSH endpoint could present an arbitrary host key. The client would accept it without an authenticity check and could then submit the password to the attacker's server.
Attack Path
- A user authorizes the documented
lelogin execoperation. leloginresolves the referenced secret and injects the SSH password intoSSHPASS.- The attacker redirects the connection to a server under the attacker's control, such as through DNS poisoning, route manipulation, or a malicious network intermediary.
- The attacker's server presents an untrusted SSH host key.
- Because
StrictHostKeyChecking=nois configured, the client proceeds without requiring trusted server identity verification. sshpass -esupplies the resolved password to the impersonated server.- The attacker captures the credential and can attempt to reuse it against the legitimate SSH service or other systems where the credential is valid.
Impact Assessment
Successful exploitation can disclose the SSH accoun ...[truncated 600 chars]
- A user authorizes the documented
- Remediation
View remediation
Remediation Suggestions
- Remove
-o StrictHostKeyChecking=nofrom the documented command. - Require strict host-key validation with
-o StrictHostKeyChecking=yes. - Provision the expected server host key through a trusted channel before initiating the connection.
- Use a dedicated, permission-restricted
known_hostsfile and specify it explicitly, for example:
bash lelogin exec --env-file ssh.env -- /bin/sh -c \ 'sshpass -e ssh \ -o StrictHostKeyChecking=yes \ -o UserKnownHostsFile="$HOME/.ssh/known_hosts" \ -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" "echo ok"'- Verify host-key fingerprints out of band rather than automatically trusting keys obtained from the same potentially compromised network path.
- Prefer SSH public-key authentication with passphrase-protected keys over reusable account passwords.
- Disable direct root login and password authentication on SSH servers where operationally possible.
- Use a minimally privileged account and narrowly scoped privilege escalation instead of authenticating directly as
root. - Retain the existing requirement for explicit user approval before resolving or injecting secrets.
- Remove
