Back to skill

Security audit

Cli Toolkit Cn

Security checks for vulnerabilities and agentic risk

Overview

This command-line help skill is coherent, but it includes unsafe destructive and privileged shell commands without enough safeguards.

Review this skill before installing if you expect safe operational command generation. It should avoid or heavily qualify destructive commands, prefer previews and backups, and require explicit confirmation before suggesting sudo, rm -rf, bulk deletion, or force-kill operations.

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

Error
Location
SKILL.md:63
Finding
Unsafe Destructive File and Process Management Commands## Vulnerability Details **File Location**: `SKILL.md`, lines 63, 119, 299, 352, and 362 **Vulnerability Type**: Unsafe destructive shell command guidance **Risk Level**: High ### Vulnerable Code `SKILL.md:63` ```bash rm -rf directory/ # Delete directory ``` `SKILL.md:119` ```bash kill -9 PID # Force termination ``` `SKILL.md:299` ```bash find . -name "*.log" | xargs rm # Batch deletion ``` `SKILL.md:352` ```bash kill -9 $(lsof -t -i:8080) ``` `SKILL.md:362` ```bash sudo rm -rf /var/log/*.log ``` ### Technical Analysis The Skill provides destructive shell commands without adequate validation, scoping, preview, confirmation, or error handling: - `rm -rf directory/` recursively removes a target without confirmation. If the path is incorrect, empty after variable substitution in generated variants, or unexpectedly resolved, the command can cause extensive data loss. - `find . -name "*.log" | xargs rm` does not use null-delimited filenames or an option terminator. Filenames containing whitespace, newlines, or leading hyphens can be parsed incorrectly. A leading-hyphen filename may be interpreted as an `rm` option. - `sudo rm -rf /var/log/*.log` performs privileged wildcard deletion of system logs. This can remove active diagnostic or security records, interfere with services, and destroy evidence needed for incident investigation. - `kill -9` immediately terminates processes without allowing graceful shutdown, cleanup, lock release, or state persistence. - `kill -9 $(lsof -t -i:8080)` does not explicitly validate that the returned values are expected numeric process identifiers belonging to the intended application. It can terminate multiple processes associated with the port and may disrupt unrelated services. These commands are presented as reusable operational guidance and may therefore be copied directly or reproduced by an agent in ge ...[truncated 2516 chars]
Remediation
## Remediation Suggestions 1. Replace broad recursive deletion examples with scoped, defensive alternatives. Require users to inspect the target before deletion: ```bash target="/expected/path/directory" printf 'Target: %s\n' "$target" find "$target" -maxdepth 1 -print rm -rI -- "$target" ``` 2. Use null-delimited pathname handling and an explicit option terminator for batch operations: ```bash find . -type f -name '*.log' -print0 | xargs -0 --no-run-if-empty rm -- ``` Alternatively: ```bash find . -type f -name '*.log' -exec rm -- {} + ``` Add a preview stage using `-print` before recommending deletion. 3. Do not recommend deleting system logs using `sudo rm -rf`. Use the system's log-management facilities, such as `logrotate` or bounded journal cleanup: ```bash sudo journalctl --vacuum-time=7d ``` Any cleanup guidance should preserve active logs, comply with retention requirements, and identify the exact files affected before modification. 4. Prefer graceful process termination and verify process identity before escalation: ```bash pids=$(lsof -t -iTCP:8080 -sTCP:LISTEN) if [ -n "$pids" ]; then ps -fp $pids kill $pids fi ``` Recommend `SIGKILL` only as a final recovery step after graceful termination fails and the operator verifies each PID. 5. Add explicit safeguards to generated scripts, including: - Quoted path and variable expansions. - Nonempty and expected-prefix checks for paths. - Numeric validation for process identifiers. - Dry-run or preview modes. - Interactive confirmation for destructive operations. - Least-privilege execution. - Backups or recovery instructions before deletion.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (19)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
# 文件操作
cp -r source/ dest/                # 复制目录
mv oldname newname                 # 重命名
rm -rf directory/                  # 删除目录
touch file.txt                     # 创建文件
mkdir -p path/to/dir               # 创建多级目录
Confidence
90% confidence
Finding
Including 'rm -rf directory/' as a basic file-operation example normalizes one of the most dangerous shell primitives without immediate safeguards. In a script-generating skill, this can lead to accidental data loss if users substitute the wrong path or the model reuses the pattern in generated commands.

Chaining Abuse

High
Category
Tool Misuse
Content
# 组合使用
cat file.txt | grep "error" | wc -l       # 统计错误数
ps aux | grep python | awk '{print $2}'   # 获取 PID
find . -name "*.log" | xargs rm           # 批量删除
curl -s URL | jq '.data[].name'          # JSON 处理

# 输出重定向
Confidence
88% confidence
Finding
The pipeline 'find . -name "*.log" | xargs rm' performs bulk deletion using command chaining without safe handling for spaces, unusual filenames, or prior review. In an agent skill, presenting this as a generic 'pipe trick' encourages hazardous copy-paste behavior that can delete unintended files.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
find / -type f -size +100M 2>/dev/null

# 清理日志
sudo rm -rf /var/log/*.log

# 清理缓存
sudo apt clean          # Ubuntu/Debian
Confidence
97% confidence
Finding
The command 'sudo rm -rf /var/log/*.log' is an irreversible bulk-deletion operation on system logs. This is dangerous because it can destroy troubleshooting and audit information, interfere with services expecting log files, and condition users to use root-level force deletion for maintenance tasks.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
find / -type f -size +100M 2>/dev/null

# 清理日志
sudo rm -rf /var/log/*.log

# 清理缓存
sudo apt clean          # Ubuntu/Debian
Confidence
97% confidence
Finding
The command 'sudo rm -rf /var/log/*.log' is an irreversible bulk-deletion operation on system logs. This is dangerous because it can destroy troubleshooting and audit information, interfere with services expecting log files, and condition users to use root-level force deletion for maintenance tasks.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The title, description, examples, and guidance all assume Chinese as the interaction language, with no indication that users may choose another language. This can violate language or locale policy when a skill forces a specific language without user opt-in.

Vague Triggers

Medium
Confidence
88% confidence
Finding
The usage section shows generic prompts such as '怎么查看 Linux 磁盘使用情况', '生成一个批量重命名文件的脚本', and '命令报错 permission denied 怎么解决' without defining explicit trigger phrases, boundaries, or non-matching examples. These are common help-style requests that could overlap with many other general assistant behaviors and lead to unintended invocation.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill includes destructive commands like 'rm -rf' and file-modifying examples without attaching immediate safety warnings, dry-run alternatives, or confirmation guidance at the point of use. In an agent setting, this can normalize unsafe command suggestions and increase the chance of users running irreversible operations without understanding the risk.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
mkdir -p path/to/dir               # 创建多级目录

# 文件权限
chmod 755 script.sh                # 设置权限
chmod +x script.sh                 # 添加执行权限
chown user:group file              # 更改所有者
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Session Persistence

Medium
Category
Rogue Agent
Content
pkill -f "script.py"               # 按命令匹配

# 后台运行
nohup python script.py &           # 后台运行
nohup python script.py > log.txt 2>&1 &  # 输出到文件
disown                             # 脱离终端
jobs                               # 查看后台任务
Confidence
65% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
pkill -f "script.py"               # 按命令匹配

# 后台运行
nohup python script.py &           # 后台运行
nohup python script.py > log.txt 2>&1 &  # 输出到文件
disown                             # 脱离终端
jobs                               # 查看后台任务
Confidence
65% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
# 后台运行
nohup python script.py &           # 后台运行
nohup python script.py > log.txt 2>&1 &  # 输出到文件
disown                             # 脱离终端
jobs                               # 查看后台任务
fg %1                              # 前台运行
```
Confidence
65% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# 方案 2:使用 bash 运行
bash script.sh

# 方案 3:使用 sudo
sudo ./script.sh
```
Confidence
89% confidence
Finding
The troubleshooting guidance suggests running scripts with sudo, which can cause users to execute unreviewed or unnecessary code as root. In a skill that generates and explains shell commands, recommending elevation without strict preconditions raises the risk of system-wide damage or privilege misuse.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
bash script.sh

# 方案 3:使用 sudo
sudo ./script.sh
```

### Command Not Found
Confidence
89% confidence
Finding
This line reinforces direct root execution of a script via sudo without contextual safeguards. Such advice is dangerous because it conditions users to bypass permission problems through privilege escalation rather than verifying script safety and least-privilege operation.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# 安装缺失命令
# Ubuntu/Debian
sudo apt install package_name

# CentOS/RHEL
sudo yum install package_name
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# 安装缺失命令
# Ubuntu/Debian
sudo apt install package_name

# CentOS/RHEL
sudo yum install package_name
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# 安装缺失命令
# Ubuntu/Debian
sudo apt install package_name

# CentOS/RHEL
sudo yum install package_name
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# 安装缺失命令
# Ubuntu/Debian
sudo apt install package_name

# CentOS/RHEL
sudo yum install package_name
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# 安装缺失命令
# Ubuntu/Debian
sudo apt install package_name

# CentOS/RHEL
sudo yum install package_name
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
find / -type f -size +100M 2>/dev/null

# 清理日志
sudo rm -rf /var/log/*.log

# 清理缓存
sudo apt clean          # Ubuntu/Debian
Confidence
95% confidence
Finding
The example combines sudo with recursive forced deletion of log files, creating a high-risk command that can destroy forensic data, break diagnostics, or remove unintended files if copied or adapted carelessly. In an agent skill, providing this as routine cleanup guidance materially increases the likelihood of harmful execution.

Static analysis

No suspicious patterns detected.