Back to skill

Security audit

SSH 服务诊断与 firewalld 加固

Security checks for vulnerabilities and agentic risk

Overview

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.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:43
Finding

Unsafe SSH and Firewall Migration Sequence Can Cause Remote Administrative Lockout

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (12)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

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 断会话)

sudo systemctl reload sshd

text

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

权威配置核对:sshd -T

bash
sudo sshd -T | grep -iE '^(port|permitrootlogin|passwordauthentication|pubkeyauthentication)'

直接输出 sshd 实际生效值,比肉眼读 sshd_config 可靠。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
# 改前备份
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 断会话)