T09 · Insecure Skill Coding Practices
- Location
src/service.js:46- Finding
Privileged Remote Command Injection Through Service Names
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This SSH administration skill is coherent, but it gives broad remote control while missing important safeguards around credentials, host identity, command construction, destructive actions, and target selection.
Review this skill carefully before installing, especially for production servers. Use only least-privilege SSH accounts and dedicated keys, avoid storing passwords or key passphrases in the JSON config, verify server host keys out of band, and do not run destructive or sudo-backed operations unless you have separately validated the inputs and target host.
src/service.js:46Privileged Remote Command Injection Through Service Names
src/log.js:19Privileged Command Injection in Log Cleanup and Log Query Functions
src/upload.js:51Command Injection Through Upload Destinations and Preset Filenames
src/index.js:47SSH Connections Do Not Verify Remote Host Identity
src/exec.js:84Unsafe Remote Script Staging Uses a Predictable Shared Temporary Path
src/connect.js:82SSH Passwords and Key Passphrases Are Stored in Plaintext Without Enforced Permissions
src/download.js:281Preset Downloads Permit Local Path Traversal and Arbitrary File Replacement
src/index.js:107Unknown Server Names Silently Fall Back to the First Configured Host
skill.json:15Dependency Installation Is Not Reproducible or Integrity-Locked
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_SERVER_IP",
"port": 22,
"username": "YOUR_USERNAME",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_SERVER_IP",
"port": 22,
"username": "YOUR_USERNAME",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_SERVER_IP",
"port": 22,
"username": "YOUR_USERNAME",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_SERVER_IP",
"port": 22,
"username": "YOUR_USERNAME",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "YOUR_SERVER_IP",
"port": 22,
"username": "YOUR_USERNAME",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
The configuration example explicitly includes plaintext fields for 'password' and 'passphrase' alongside a private key path, normalizing storage of sensitive secrets in a local JSON config. If users follow this pattern, credentials may be left unencrypted on disk, committed to repositories, or exposed to other local processes and backups.
"port": 22,
"username": "SSH 用户名",
"password": "SSH 密码(或使用私钥)",
"privateKeyPath": "~/.ssh/id_rsa",
"passphrase": "私钥密码(如有)"
}
]
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).
1. **凭证安全**:妥善保管 SSH 密码和私钥,不要提交到代码仓库
2. **权限控制**:确保 SSH 用户有足够权限
3. **连接池**:避免创建过多并发连接
4. **命令安全**:避免执行危险命令(如 `rm -rf /`)
5. **生产环境**:生产环境操作前请备份
---
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).
1. **凭证安全**:妥善保管 SSH 密码和私钥,不要提交到代码仓库
2. **权限控制**:确保 SSH 用户有足够权限
3. **连接池**:避免创建过多并发连接
4. **命令安全**:避免执行危险命令(如 `rm -rf /`)
5. **生产环境**:生产环境操作前请备份
---
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).
1. **凭证安全**:妥善保管 SSH 密码和私钥,不要提交到代码仓库
2. **权限控制**:确保 SSH 用户有足够权限
3. **连接池**:避免创建过多并发连接
4. **命令安全**:避免执行危险命令(如 `rm -rf /`)
5. **生产环境**:生产环境操作前请备份
---
代码与描述在核心方向上基本一致,确实是一个 SSH 远程管理工具,并支持多服务器配置、连接复用、命令执行和文件传输。但描述声称支持系统监控、服务管理、日志分析、安全检查等更高层运维能力,而给出的代码中并未实现这些具体功能;仅提供了通用远程命令执行能力,理论上可被上层调用来完成这些任务,但这些能力并不是当前代码块直接实现的。因此描述相对代码存在一定夸大,属于能力声明与实际实现不完全一致。
The documentation instructs users to reference a default private SSH key path (~/.ssh/id_rsa), which normalizes direct use of sensitive credentials by the skill. In a remote-management tool, encouraging broad access to a default private key can increase the blast radius of compromise, accidental disclosure, or misuse of highly privileged credentials.
"host": "YOUR_SERVER_IP",
"port": 22,
"username": "YOUR_USERNAME",
"privateKeyPath": "~/.ssh/id_rsa"
}
]
}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"host": "192.168.1.100",
"port": 22,
"username": "root",
"privateKeyPath": "/root/.ssh/id_rsa"
},
{
"name": "staging",
The documentation explicitly includes a destructive remote command example, rm /path/file, through a generic SSH execution interface. In an agent skill that can forward natural-language requests into remote shell actions, showcasing deletion without safeguards materially increases the risk of accidental or unauthorized data loss.
ssh 执行 production ls -la /path # 列出文件 ssh 执行 production cat /path/file # 查看文件 ssh 执行 production tail -f /path/log # 实时日志 ssh 执行 production rm /path/file # 删除文件
---
cleanupOldLogs performs remote deletion of files under /var/log using sudo, which exceeds the expected semantics of a log viewing/analysis helper. In an SSH administration skill, this is especially dangerous because an upstream agent may call it automatically, causing loss of forensic evidence, operational visibility, or compliance-relevant logs on production systems.
The code issues a destructive sudo delete command over SSH without any confirmation, preview, or safety interlock. In a remote operations skill, lack of a confirmation step materially increases the risk of accidental or automated execution against the wrong host, deleting logs needed for debugging, auditing, or incident response.
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
echo "4. 检查允许的用户:" &&
grep -i "AllowUsers" /etc/ssh/sshd_config || echo "未限制用户" &&
echo "" &&
echo "5. 检查失败的登录尝试:" &&
sudo lastb | head -10
`);