T09 · Insecure Skill Coding Practices
- Location
SKILL.md:337- Finding
Sensitive SSH Key Hash Written Without Explicit Access Controls
- Content
View full analysis
ssh_hash.txt john ssh_hash.txt --wordlist=/usr/share/wordlists/rockyou.txt ``` ### Technical Analysis The documented command reads an SSH private key and uses `ssh2john` to generate a crackable representation in `ssh_hash.txt`. It does not modify the original `id_rsa` file or transmit its contents over the network. Nevertheless, the generated hash is sensitive because it enables offline passphrase-guessing attacks against the associated private key. The output redirection creates the file according to the invoking user's current `umask` and working-directory permissions. The instructions do not require a private working directory, restrictive file permissions, authorization verification, or deletion of the generated artifact. Consequently, the hash may be exposed to other local users, backup systems, shared workspaces, logs, or subsequent processes. Processing SSH key material is relevant to the Skill's declared password-cracking functionality. However, retaining the derived hash without minimum-privilege safeguards exceeds the minimum safe handling requirements for such sensitive material. ### Attack Path 1. An operator runs the documented commands against an authorized or inadvertently exposed `id_rsa` file. 2. `ssh2john` generates `ssh_hash.txt` in the current directory using permissions determined by the environment's default `umask`. 3. The hash file remains in a shared, backed-up, or otherwise accessible location after the assessment. 4. Another local principal or process obtains the generated hash. 5. The principal performs an offline dictionary or brute-force attack using John the Ripper or another compatible cracking tool. 6. If the passphrase is recovered, the principal combines it ...[truncated 1040 chars]- Remediation
View remediation
"$workdir/ssh_hash.txt" chmod 600 "$workdir/ssh_hash.txt" john "$workdir/ssh_hash.txt" --wordlist=/usr/share/wordlists/rockyou.txt ``` - Do not process a default filename such as `id_rsa` without requiring an explicit, validated input path. - Avoid placing hashes in shared directories, repositories, persistent logs, shell transcripts, or locations included in automatic backups. - Remove the generated hash and temporary directory immediately after the authorized assessment: ```bash rm -f -- "$workdir/ssh_hash.txt" rmdir -- "$workdir" ``` - Document that ordinary deletion may not guarantee physical erasure on journaling, copy-on-write, networked, or solid-state storage. For highly sensitive assessments, use an approved encrypted ephemeral workspace and follow the organization's media-sanitization policy. - Add a warning directly beside the command explaining that the output remains sensitive and can be used for offline passphrase attacks. ]]>
