Back to skill

Security audit

yuhang

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent GitHub-to-agent-skill purpose, but it handles local files, secrets, mirrors, and shell commands too broadly for automatic installation.

Install only if you are prepared to review and constrain it. Run it in an isolated workspace, avoid using --force, provide only simple basename skill names, do not run it from a directory containing secrets in .env, prefer official GitHub sources over mirrors, and manually review generated context and SKILL.md before installing dependencies or executing cloned code. I do not see artifact-backed deception or exfiltration, so this is Review rather than malicious.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/forge.py:1154
Finding

Shell Command Injection Through an Unvalidated Skill Name

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/forge.py:1438
Finding

Path Traversal Enables Filesystem Writes and Recursive Directory Deletion Outside the Output Root

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Error
Location
scripts/forge.py:151
Finding

Unverified Third-Party Mirrors Can Substitute Repository Source and Metadata

Content
View full analysis
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/forge.py:1353
Finding

Untrusted Repository Content Is Inserted Verbatim Into Agent-Consumed Context

Content
View full analysis
0: if len(results["core_code"]) < 10: code = download_file_content(item["download_url"]) results["core_code"][rel_path] = "\n".join( code.splitlines()[:100] ) ``` The content is written verbatim into an Agent-facing context file: ```python for name, text in online_data.get("key_docs", {}).items(): content.append(f"\n{Colors.HEADER}文件: {name}{Colors.RESET}") if len(text) > config.max_doc_size: text = ( text[:config.max_doc_size] + f"\n\n{Colors.YELLOW}... (文档截断){Colors.RESET}" ) content.append(text) ``` ```python with open(output_path, "w", encoding="utf-8") as f: f.write("\n".join(content)) ``` The Skill instructions direct the Agent to consume that file and use it to generate further instructions: ```markdown 1. **读取上下文包**:查看 `context_bundle.md` - 这个文件包含文件树、README 和依赖项 - 不需要手动搜索文件 2. **更新 SKILL.md**:重写新技能目录中的草稿 - **描述**:总结工具的功能 - **先决条件**:列出安装命令 - **用法**:提供使用 `src/...` 运行工具的清晰示例 3. **创建包装脚本(可选)**: ...[truncated 2201 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/forge.py:16
Finding

Automatic Loading of Arbitrary Local Environment Variables Expands Secret Exposure

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (25)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
# 语法: python scripts/forge.py <URL> [SKILL_NAME]

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
# 语法: python scripts/forge.py <URL> [SKILL_NAME]

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The documented remediation uses rm -rf .trae/skills/xxx, which is a destructive shell pattern that can delete directories recursively. In the context of a skill that accepts user-supplied repository URLs and skill names and instructs agents to manipulate filesystem paths, this is especially risky because path confusion, substitution mistakes, or automation errors could lead to unintended data loss.

Content

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

text
2. 或手动删除已存在的目录后重试
   ```bash
   rm -rf .trae/skills/xxx

问题 3:依赖项缺失

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

This line marks the start of .env-loading behavior that can absorb local credentials into the process environment. In a repository-processing skill, automatically collecting secrets from the operator's filesystem is more dangerous because later network and subprocess operations may consume them unexpectedly.

Content

Scanner excerpt · scripts/forge.py (reported line 16)May include surrounding context.

python
import urllib.error
from pathlib import Path

# 尝试加载本地 .env 文件
def load_env_file(env_path: Path):
    """
    轻量级加载 .env 文件到环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The .env-loading routine is part of credential-access behavior because it reads locally stored secrets from developer-controlled files. Even without immediate exfiltration at this line, it broadens access to sensitive data beyond what the tool strictly needs.

Content

Scanner excerpt · scripts/forge.py (reported line 19)May include surrounding context.

python
# 尝试加载本地 .env 文件
def load_env_file(env_path: Path):
    """
    轻量级加载 .env 文件到环境变量
    """
    if not env_path.exists():
        return

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Enumerating multiple possible .env locations increases the chance of collecting unrelated credentials from parent and current working directories. This is especially risky for a general-purpose automation tool that may be run inside many different projects.

Content

Scanner excerpt · scripts/forge.py (reported line 35)May include surrounding context.

python
except Exception:
        pass

# 加载脚本同目录或父目录下的 .env
env_paths = [
    Path(__file__).parent / ".env",
    Path(__file__).parent.parent / ".env",

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The code targets the script directory's .env file as a credential source, contributing to broad secret ingestion behavior. Because the skill is distributed automation, users may not expect execution to read nearby secret files automatically.

Content

Scanner excerpt · scripts/forge.py (reported line 37)May include surrounding context.

python
# 加载脚本同目录或父目录下的 .env
env_paths = [
    Path(__file__).parent / ".env",
    Path(__file__).parent.parent / ".env",
    Path.cwd() / ".env"
]

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The code targets the parent directory's .env file, expanding credential access outside the immediate script directory. This scope creep materially raises the chance of pulling in unrelated secrets from a broader workspace.

Content

Scanner excerpt · scripts/forge.py (reported line 38)May include surrounding context.

python
# 加载脚本同目录或父目录下的 .env
env_paths = [
    Path(__file__).parent / ".env",
    Path(__file__).parent.parent / ".env",
    Path.cwd() / ".env"
]
for env_p in env_paths:

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

Loading a .env file from the current working directory is risky because the working directory is highly variable and may contain unrelated project secrets. In a tool that also performs network requests and subprocess calls, this increases the potential blast radius of local credential exposure.

Content

Scanner excerpt · scripts/forge.py (reported line 39)May include surrounding context.

python
env_paths = [
    Path(__file__).parent / ".env",
    Path(__file__).parent.parent / ".env",
    Path.cwd() / ".env"
]
for env_p in env_paths:
    load_env_file(env_p)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script reads GITHUB_TOKEN from the environment and includes it in an Authorization header for API requests to matching github.com mirror bases. This is a sensitive credential use combined with network transmission, but there is no explicit user disclosure that the token may be used for outbound requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

When force mode is enabled, the script recursively deletes the target directory without an interactive confirmation or strong path safety checks. If the output path or skill name is mistaken or manipulated, this can destroy unintended local data on the operator's system.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script executes shell commands to clone repositories using a command string and shell=True, giving the tool generic command-execution capability. Because this skill processes untrusted repository URLs and paths, the shell usage materially increases the chance of command injection or unsafe execution beyond the stated purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script executes a shell command assembled from repository and filesystem inputs without adequately warning the user that shell execution will occur. In this tool's context, users may expect repository conversion, not shell-mediated command construction, making misuse or injection more dangerous.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

This subprocess invocation uses shell=True unnecessarily for a fixed command, which is a form of unsafe tool parameter usage. It does not appear directly exploitable via user input here, but it establishes insecure execution patterns and reliance on shell semantics.

Content

Scanner excerpt · scripts/forge.py (reported line 1154)May include surrounding context.

python
# 尝试使用 shell=True 并直接拼接字符串(注意安全,这里 clone_url 是可控的)
                # 检查 git 是否可用
                try:
                    subprocess.run(["git", "--version"], capture_output=True, check=True, shell=True)
                    cmd_str = f'git clone --depth {config.clone_depth} "{clone_url}" "{target_dir}"'
                except:
                    # 如果 git 失败,尝试完全限定路径或报错

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

This call executes a shell command built from external and filesystem-derived values, creating a classic parameter-abuse and command-injection risk. Because the tool is designed to handle arbitrary GitHub repositories, treating those parameters as shell-safe is especially dangerous in context.

Content

Scanner excerpt · scripts/forge.py (reported line 1161)May include surrounding context.

python
cmd_str = f'git clone --depth {config.clone_depth} "{clone_url}" "{target_dir}"'

                print(f"{Colors.INFO}执行命令: {cmd_str}")
                result = subprocess.run(
                    cmd_str, capture_output=True, text=True, timeout=config.timeout, shell=True
                )

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill describes capabilities that include shell, network, file read/write, and environment access, but it does not declare any explicit tool scope or permission boundaries. For a meta-skill that clones repositories, generates files, and runs commands, this omission is dangerous because it can cause an agent to apply the skill with overly broad authority and insufficient user awareness.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The invocation phrases are broad enough that ordinary user requests like 'I want to use this GitHub repo' could trigger the skill automatically. Because this skill performs repository cloning, file creation, dependency handling, and validation commands, accidental triggering increases the chance of unreviewed code intake and command execution.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

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

text
3. Agent 编辑 SKILL.md

edit .trae/skills/sqlmap/SKILL.md

text
4. Agent 运行验证

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
76% confidence
Finding

The skill includes installation guidance using privileged commands such as sudo apt install fzf. In a skill that already encourages agents to scaffold and validate external tools, recommending privileged execution raises the risk of system-wide changes or package installation without adequate trust review, especially when the source repository is untrusted.

Content

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

md
brew install fzf
   
   # Linux
   sudo apt install fzf
   
   # Windows
   choco install fzf

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The best-practices section explicitly instructs generated SKILL.md files to '使用中文标题,英文命令', which imposes a specific language choice. This is a natural-language locale policy constraint and the file does not indicate that users may choose another language or opt in to Chinese output.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script automatically loads .env files from multiple nearby directories into process environment variables without explicit user consent. This can ingest unrelated secrets present in the working directory or parent directories and make them available to later network logic, which is broader than required for converting repositories into skills.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Secret-bearing .env files are loaded silently with no user-facing warning, which creates an informed-consent and data-minimization problem. In a developer environment, this can unexpectedly expose credentials to subsequent logic or child processes even if the user only intended repository analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generated template systematically translates descriptions into Chinese and emits the skill content entirely in Chinese, including role, invocation guidance, and workflow steps. This imposes a specific language/locale behavior without offering the user a language choice or documenting it as a justified regional constraint.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
91% confidence
Finding

Using subprocess.run with shell=True for a simple git --version check is unnecessary and normalizes shell-based execution in the codebase. While this specific invocation is not directly attacker-controlled, it increases attack surface and can behave unexpectedly across platforms or with modified shell environments.

Content

Scanner excerpt · scripts/forge.py (reported line 1154)May include surrounding context.

python
# 尝试使用 shell=True 并直接拼接字符串(注意安全,这里 clone_url 是可控的)
                # 检查 git 是否可用
                try:
                    subprocess.run(["git", "--version"], capture_output=True, check=True, shell=True)
                    cmd_str = f'git clone --depth {config.clone_depth} "{clone_url}" "{target_dir}"'
                except:
                    # 如果 git 失败,尝试完全限定路径或报错

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

The script builds a shell command string containing repository-derived data and executes it with shell=True. Although URLs are nominally validated, other interpolated values such as target_dir and clone_url can still introduce shell metacharacter risk, and shell invocation is unnecessary for git clone here. In a skill-forging tool that processes external repository inputs, this expands a repository conversion task into arbitrary command execution if inputs are manipulated.

Content

Scanner excerpt · scripts/forge.py (reported line 1161)May include surrounding context.

python
cmd_str = f'git clone --depth {config.clone_depth} "{clone_url}" "{target_dir}"'

                print(f"{Colors.INFO}执行命令: {cmd_str}")
                result = subprocess.run(
                    cmd_str, capture_output=True, text=True, timeout=config.timeout, shell=True
                )