T09 · Insecure Skill Coding Practices
- Location
SKILL.md:43- Finding
Unsafe SSH and Firewall Migration Sequence Can Cause Remote Administrative Lockout
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill gives SSH and firewall hardening commands that fit its purpose, but some privileged steps could lock a user out of remote administration if followed as written.
Only install or use this skill if you are comfortable reviewing privileged SSH and firewalld commands before execution. Treat the examples as templates, confirm the actual admin subnet and port, keep an existing SSH path open until a new session is verified, and ensure console or rollback access before removing the old SSH firewall service.
SKILL.md:43Unsafe SSH and Firewall Migration Sequence Can Cause Remote Administrative Lockout
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
sudo sed -i 's/^PermitRootLogin yes$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
sudo firewall-cmd --permanent --remove-service=ssh && sudo firewall-cmd --reload
sudo systemctl reload sshd
The manifest description and all instructional content are written in Chinese, and there is no indication that the skill supports other languages or that the locale restriction is intentional for a region-specific use case. This can violate language/locale policy when users are not given an opt-in or alternative language.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sshd -Tsudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'
直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
# 改前备份
sudo cp -a /etc/ssh/sshd_config /etc/ssh/sshd_config.bak.$(date +%Y%m%d)
# root 禁密码登录(仅密钥)
sudo sed -i 's/^PermitRootLogin yes$/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
# 移除已无监听的旧端口服务(收紧假放行)
sudo firewall-cmd --permanent --remove-service=ssh && sudo firewall-cmd --reload
# reload 保持已有连接(勿 restart 断会话)