Back to skill

Security audit

Ssh Remote

Security checks for vulnerabilities and agentic risk

Overview

This skill teaches useful SSH workflows, but its examples encourage unverified root SSH connections and password handling that can leak credentials or create persistent remote access.

Install only if you are comfortable reviewing SSH commands before use. Prefer verified known_hosts entries, non-root accounts, SSH keys managed by an agent, and avoid copying the password and host-key-bypass examples into production systems.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:53
Finding

SSH Host Verification Is Disabled in Credentialed and Operational Examples

Content
View full analysis
Remediation
View remediation
/tmp/server_host_key ssh-keygen -lf /tmp/server_host_key # Compare the displayed fingerprint with a trusted value before installation. cat /tmp/server_host_key >> ~/.ssh/known_hosts rm -f /tmp/server_host_key chmod 600 ~/.ssh/known_hosts ssh root@SERVER_IP "hostname" ``` 4. Keep any bypass example in a clearly isolated, test-only section and do not combine it with real credentials, key enrollment, or privileged accounts. 5. Prefer `StrictHostKeyChecking=yes` for automation after provisioning the expected host key. 6. Avoid using `root` directly where a restricted account with controlled `sudo` permissions is sufficient. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:45
Finding

Predictable Temporary Password File Enables Local File Clobbering and Secret Exposure

Content
View full analysis
/tmp/ssh_pass.sh << 'SCRIPT' #!/bin/bash echo 'YOUR_PASSWORD' SCRIPT chmod 700 /tmp/ssh_pass.sh export SSH_ASKPASS=/tmp/ssh_pass.sh export DISPLAY=dummy:0 ssh -o StrictHostKeyChecking=no \ -o UserKnownHostsFile=/dev/null \ root@SERVER_IP "hostname" rm -f /tmp/ssh_pass.sh ``` A second key-installation example uses the same fixed temporary path: ```bash cat > /tmp/ssh_pass.sh << 'SCRIPT' #!/bin/bash echo 'SERVER_PASSWORD' SCRIPT chmod 700 /tmp/ssh_pass.sh SSH_ASKPASS=/tmp/ssh_pass.sh DISPLAY=dummy:0 \ ssh -o StrictHostKeyChecking=no root@SERVER_IP \ "mkdir -p ~/.ssh && echo '$(cat ~/.ssh/id_ed25519.pub)' >> ~/.ssh/authorized_keys" rm -f /tmp/ssh_pass.sh ``` ### Technical Analysis The examples create `/tmp/ssh_pass.sh` at a fixed, predictable path using ordinary shell redirection. The file is not allocated atomically, and the code does not verify that the path is a newly created regular file owned by the current user. On a multi-user system, another local user can pre-create the path as a symbolic link. Shell redirection then follows the link and truncates or overwrites a file writable by the victim. Changing the mode to `700` after writing does not prevent this race or undo the overwrite. The password is also stored in plaintext. Cleanup occurs only after the SSH command completes normally; interruption, process termination, or shell failure can leave the credential on disk. The reusable helper uses a PID-derived filename, which is less static but remains guessable and lacks guaranteed cleanup. ### Attack Path 1. An attacker with local access predicts that the victim will use `/tmp/ssh_pass.sh`. 2. Before the victim runs the documented command, the attacker creates `/tmp/ssh_pass.sh` as a symbolic link to a ...[truncated 1106 chars]
Remediation
View remediation
"$passfile" <<'SCRIPT' #!/bin/sh printf '%s\n' "$SSH_PASSWORD" SCRIPT chmod 700 "$passfile" ``` 4. Do not embed the actual password directly into generated script text. Obtain it from a protected secret provider or tightly scoped environment mechanism where supported. 5. Avoid printing, logging, or retaining the password beyond the single authentication operation. 6. Prefer SSH public-key authentication or an SSH agent over automated password entry. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:121
Finding

Passwords Are Supplied Through Observable Command-Line Arguments

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 28)May include surrounding context.

ssh root@SERVER_IP "hostname"

text

For first-time production connections, ask the user to confirm the host fingerprint or add the host key to `~/.ssh/known_hosts` first:

```bash
ssh-keyscan -H SERVER_IP >> ~/.ssh/known_hosts

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 31)May include surrounding context.

ssh root@SERVER_IP "hostname"

text

For first-time production connections, ask the user to confirm the host fingerprint or add the host key to `~/.ssh/known_hosts` first:

```bash
ssh-keyscan -H SERVER_IP >> ~/.ssh/known_hosts

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 64)May include surrounding context.

-o UserKnownHostsFile=/dev/null
root@SERVER_IP "hostname"

rm -f /tmp/ssh_pass.sh

text

Important parameters:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 114)May include surrounding context.

-o UserKnownHostsFile=/dev/null
root@SERVER_IP "hostname"

rm -f /tmp/ssh_pass.sh

text

Important parameters:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 91)May include surrounding context.

ssh -o StrictHostKeyChecking=no
-o UserKnownHostsFile=/dev/null
root@"$HOST" "$CMD" rm -f /tmp/.sp$$.sh }

text

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 100)May include surrounding context.

Generate a key if needed:

bash
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "auto-deploy"

Upload the public key when password access is available:

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Modifying ~/.ssh/authorized_keys on a remote system is a persistence mechanism that controls future access. Even though presented as administration guidance, it is a high-risk action because it can silently grant continuing access and is especially sensitive when targeting root.

Content

Scanner excerpt · SKILL.md (reported line 113)May include surrounding context.

chmod 700 /tmp/ssh_pass.sh SSH_ASKPASS=/tmp/ssh_pass.sh DISPLAY=dummy:0
ssh -o StrictHostKeyChecking=no root@SERVER_IP
"mkdir -p ~/.ssh && echo '$(cat ~/.ssh/id_ed25519.pub)' >> ~/.ssh/authorized_keys" rm -f /tmp/ssh_pass.sh

text

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Modifying ~/.ssh/authorized_keys on a remote system is a persistence mechanism that controls future access. Even though presented as administration guidance, it is a high-risk action because it can silently grant continuing access and is especially sensitive when targeting root.

Content

Scanner excerpt · SKILL.md (reported line 113)May include surrounding context.

chmod 700 /tmp/ssh_pass.sh SSH_ASKPASS=/tmp/ssh_pass.sh DISPLAY=dummy:0
ssh -o StrictHostKeyChecking=no root@SERVER_IP
"mkdir -p ~/.ssh && echo '$(cat ~/.ssh/id_ed25519.pub)' >> ~/.ssh/authorized_keys" rm -f /tmp/ssh_pass.sh

text

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
95% confidence
Finding

The flagged command appends a public key into remote root's authorized_keys, which is the same mechanism commonly used for backdoor persistence. In this skill it appears as legitimate admin automation rather than overt malware, but it still enables durable remote access and is materially risky—especially because it is paired with StrictHostKeyChecking=no, increasing the chance of persisting access on an unverified host.

Content

Scanner excerpt · SKILL.md (reported line 113)May include surrounding context.

se

Generate a key if needed:

bash
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "auto-deploy"

Upload the public key when password access is available:

bash
cat > /tmp/ssh_pass.sh << 'SCRIPT'
#!/bin/bash
echo 'SERVER_PASSWORD'
SCRIPT
chmod 700 /tmp/ssh_pass.sh
SSH_ASKPASS=/tmp/ssh_pass.sh DISPLAY=dummy:0 \
  ssh -o StrictHostKeyChecking=no root@SERVER_IP \
  "mkdir -p ~/.ssh && echo '$(cat ~/.ssh/id_ed25519.pub)' >> ~/.ssh/authorized_keys"
rm -f /tmp/ssh_pass.sh

Then connect without a password:

bash
ssh root@SERVER_IP "COMMAND"

Option 3: sshpass on Linux/macOS

bash
sshpass -p 'YOUR_PASSWORD' ssh -o StrictHostKeyChecking=no root@SERVER_IP "COMMAND"

Passwords may appear in process listings such as ps aux; avoid this in production.

Option 4: Plink on Windows PowerShell

powershell
plink -batch -pw "YOUR_PASSWORD" root@SERVER_IP "COMMAND"

Common Operation Patterns

Run a single command:

bash
ssh -o StrictHostKeyChecking=no r

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 179)May include surrounding context.

md
## Security Recommendations

1. Delete temporary password scripts immediately: `rm -f /tmp/ssh_pass.sh`.
2. Use `chmod 700` for temporary password scripts.
3. Prefer SSH keys for long-term servers.
4. Do not hard-code passwords in project files. Prefer environment variables or temporary files.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 55)May include surrounding context.

md
#!/bin/bash
echo 'YOUR_PASSWORD'
SCRIPT
chmod 700 /tmp/ssh_pass.sh

export SSH_ASKPASS=/tmp/ssh_pass.sh
export DISPLAY=dummy:0

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 86)May include surrounding context.

md
#!/bin/bash
echo 'YOUR_PASSWORD'
SCRIPT
chmod 700 /tmp/ssh_pass.sh

export SSH_ASKPASS=/tmp/ssh_pass.sh
export DISPLAY=dummy:0

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 110)May include surrounding context.

md
#!/bin/bash
echo 'YOUR_PASSWORD'
SCRIPT
chmod 700 /tmp/ssh_pass.sh

export SSH_ASKPASS=/tmp/ssh_pass.sh
export DISPLAY=dummy:0

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 180)May include surrounding context.

md
#!/bin/bash
echo 'YOUR_PASSWORD'
SCRIPT
chmod 700 /tmp/ssh_pass.sh

export SSH_ASKPASS=/tmp/ssh_pass.sh
export DISPLAY=dummy:0

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SKILL.md (reported line 100)May include surrounding context.

Generate a key if needed:

bash
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "auto-deploy"

Upload the public key when password access is available: