T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:22
- Finding
- Insecure SSH Password Handling and Disabled Host Verification<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 22, 26-27, 40-53, 58, and 64 **Vulnerability Type**: Insecure command-line credential handling and SSH host verification bypass **Risk Level**: High ### Vulnerable Code ```bash # Line 22 sshpass -p 'VPS密码' ssh -o StrictHostKeyChecking=no root@VPS_IP ``` ```bash # Lines 26-27 rsync -avz --exclude='sessions' --exclude='.DS_Store' --exclude='memory.md' \ ~/.openclaw/agents/[agent名]/ root@VPS_IP:/root/.openclaw/agents/[agent名]/ ``` ```bash # Lines 40-53 sshpass -p 'VPS密码' ssh -o StrictHostKeyChecking=no root@VPS_IP 'python3 -c " import json with open(\"/root/.openclaw/openclaw.json\") as f: data = json.load(f) data[\"channels\"][\"discord\"][\"accounts\"][\"[Discord_ID]\"] = { \"name\": \"[Agent名字]\", \"enabled\": True, \"token\": \"[Token]\", \"groupPolicy\": \"allowlist\", \"streaming\": \"off\" } with open(\"/root/.openclaw/openclaw.json\", \"w\") as f: json.dump(data, f, indent=2) "' ``` ```bash # Line 58 sshpass -p 'VPS密码' ssh -o StrictHostKeyChecking=no root@VPS_IP 'openclaw config set bindings \"[{\\\"agentId\\\":\\\"[agentId]\\\",\\\"match\\\":{\\\"channel\\\":\\\"discord\\\",\\\"accountId\\\":\\\"[Discord_ID]\\\"}}]\"' ``` ```bash # Line 64 sshpass -p 'VPS密码' ssh -o StrictHostKeyChecking=no root@VPS_IP "openclaw gateway restart" ``` ### Technical Analysis The skill recommends placing the VPS password directly in the `sshpass -p` command-line argument. Depending on the environment, command-line secrets can be exposed through shell history, process inspection, terminal logging, debugging output, or automation logs. The explicit `StrictHostKeyChecking=no` option disables verification of the remote server's identity. This removes an essential SSH security boundary and allows a network-positioned attacker to impersonate the VPS. Because the connection is also used for privileged configuration changes and transmission of agent data and Discord credential ...[truncated 1695 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Replace password-based root authentication with a dedicated SSH key protected by an appropriate passphrase or managed identity. - Do not use `sshpass -p` or place credentials in command-line arguments. - Remove `StrictHostKeyChecking=no`. - Provision and verify the VPS host key in `known_hosts` before migration. For automation, use a dedicated known-hosts file and fail closed on mismatches. - Connect through a dedicated, non-root migration account with narrowly scoped `sudo` permissions for only the required OpenClaw operations. - Disable direct root SSH login and disable password authentication where operationally possible. - Ensure shell tracing is disabled while handling secrets and prevent migration commands from being recorded in shared logs. - Rotate any password that has already been used through the documented command-line pattern. ]]>
