T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/upload_media_remote.sh:24
- Finding
- SSH Host Authenticity Verification Is Disabled<![CDATA[ ## Vulnerability Details **File Location**: `scripts/upload_media_remote.sh:24-29`; also present in `scripts/publish_wp_remote.sh:19-24` and documented in `SKILL.md:120-127` **Vulnerability Type**: Improper SSH host verification **Risk Level**: Medium ### Complete Code Snippet ```bash SSH_OPTS="-i $SSH_KEY -p $SSH_PORT \ -o StrictHostKeyChecking=no \ -o BatchMode=yes \ -o ConnectTimeout=15 \ -o PasswordAuthentication=no" ``` The publishing script contains the equivalent configuration: ```bash SSH_OPTS="-i $SSH_KEY -p $SSH_PORT \ -o StrictHostKeyChecking=no \ -o BatchMode=yes \ -o ConnectTimeout=15 \ -o PasswordAuthentication=no" ``` ### Technical Analysis `StrictHostKeyChecking=no` causes SSH and SCP to accept an unknown host key automatically. Public-key authentication proves the client's identity to the server, but it does not protect the client unless the server's host key is independently verified. Consequently, DNS poisoning, routing manipulation, a compromised network gateway, or malicious modification of the configured hostname can redirect the Skill to an attacker-controlled SSH server. The scripts would then upload article and image data and execute the intended commands against that server without detecting the substitution. The private key contents are not directly transmitted by SSH, so this issue does not by itself disclose the private key. Nevertheless, it compromises server authenticity and the confidentiality and integrity of data exchanged by the workflow. The use of a dedicated private key is necessary for the declared remote-publishing function and does not inherently exceed minimum required privileges. The weakness is the absence of server verification, not the use of key-based authentication. ### Attack Path 1. The attacker gains the ability to redirect traffic for `WP_SSH_HOST`, such as through DNS poisoning, routing manipulation, or configu ...[truncated 908 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Provision the legitimate server's host key before running the Skill. - Replace `StrictHostKeyChecking=no` with: ```bash -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/secure/path/wp_known_hosts ``` - Generate the dedicated known-hosts file through a trusted administrative channel. Do not rely on an unauthenticated `ssh-keyscan` result without verifying its fingerprint. - Store SSH options in a Bash array so paths and values remain distinct arguments: ```bash SSH_OPTS=( -i "$SSH_KEY" -p "$SSH_PORT" -o StrictHostKeyChecking=yes -o UserKnownHostsFile="$WP_KNOWN_HOSTS" -o BatchMode=yes -o ConnectTimeout=15 -o PasswordAuthentication=no ) ``` - Continue using a dedicated, non-root SSH account and key with only the filesystem and WP-CLI permissions required for the target WordPress installation. ]]>
