T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/win-exec.sh:22
- Finding
- SSH Host Authentication Disabled for Remote Command Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/win-exec.sh:19-24` **Vulnerability Type**: Disabled SSH host-key verification **Risk Level**: Medium ### Vulnerable Code ```bash SSH_OPTS=( -o "ConnectTimeout=$TIMEOUT" -o "StrictHostKeyChecking=no" -o "BatchMode=yes" -p "$PORT" ) ``` ### Technical Analysis The script unconditionally passes `StrictHostKeyChecking=no` to the SSH client. This causes SSH to accept a host key that has not been trusted in advance, preventing reliable authentication of the configured Windows endpoint. SSH public-key authentication may still authenticate the client without revealing the private key, but it does not compensate for the loss of server authentication. An attacker capable of redirecting or intercepting the connection could impersonate the remote Windows host and receive commands intended for it or return forged command output. The use of an SSH private key is consistent with the Skill's declared remote-administration functionality and does not itself exceed minimum privileges. The script checks for the key and passes its path to SSH; it does not directly read, modify, print, or transmit the private-key contents. ### Attack Path 1. A user configures `WINDOWS_SSH_HOST` and invokes `win-exec.sh`. 2. An attacker gains a network interception position or redirects the hostname through DNS, routing, or local-network manipulation. 3. The attacker's SSH server presents an untrusted host key. 4. `StrictHostKeyChecking=no` allows the connection to continue without rejecting the unknown identity. 5. The script sends the caller-supplied remote command to the impersonating server. 6. The attacker observes the command and returns attacker-controlled output, which may mislead subsequent users or automation. ### Impact Assessment A successful attacker can compromise the confidentiality and integrity of commands and command results for affected SSH sessions. The attacker can learn operational details i ...[truncated 308 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove `-o "StrictHostKeyChecking=no"`. - Require strict host authentication with `-o "StrictHostKeyChecking=yes"`. - Provision the expected Windows SSH host key through a trusted, out-of-band process before the first connection. - Consider using a Skill-specific known-hosts file, for example: ```bash SSH_OPTS=( -o "ConnectTimeout=$TIMEOUT" -o "StrictHostKeyChecking=yes" -o "UserKnownHostsFile=${WINDOWS_SSH_KNOWN_HOSTS:-$HOME/.ssh/known_hosts}" -o "BatchMode=yes" -p "$PORT" ) ``` - Document how administrators can verify the host-key fingerprint directly on the Windows server. - Do not automatically trust output from an unauthenticated `ssh-keyscan` operation; verify the resulting fingerprint over a separate trusted channel. ]]>
