Back to skill

Security audit

skill审查

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent read-only skill review tool, but it can read outside the target skill through symlinks and can give misleading passing results for incomplete security checks.

Use this only as a lightweight structural checker, not as a security approval tool. Run it in an isolated workspace on packages without symlinks, manually inspect scripts and nested files, and treat a passing result as advisory rather than proof that a skill is safe to install or publish.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/review_skill.py:415
Finding

Untrusted symbolic links allow filesystem access outside the reviewed Skill directory

Content
View full analysis

Vulnerability Details

File Location: scripts/review_skill.py:415-422 and scripts/review_skill.py:556-559
Vulnerability Type: Unrestricted symbolic-link traversal
Risk Level: Medium

Vulnerable Code

python
script_files = list(scripts_dir.glob("*"))

if not script_files:
    return CategoryResult("脚本代码", max_score, max_score, issues)

for script_file in script_files:
    if script_file.is_dir():
        continue

    content = script_file.read_text(encoding="utf-8", errors="ignore")

The recursive file-size inspection is also performed without rejecting symbolic links or validating resolved paths:

python
large_files = []
for file_path in self.skill_path.rglob("*"):
    if file_path.is_file():
        size = file_path.stat().st_size
        if size > 1024 * 1024:  # Greater than 1 MB
            large_files.append((file_path.relative_to(self.skill_path), size))

Technical Analysis

The reviewed Skill directory must be treated as attacker-controlled input. The implementation enumerates directory entries and then calls read_text(), is_file(), and stat() without checking whether an entry is a symbolic link. These operations follow symbolic links.

Consequently, a file under scripts/ can resolve to a file outside the supplied Skill directory. The reviewer does not compare the resolved file path against the resolved review root before opening it. This violates the expected directory boundary of a read-only package reviewer.

The same issue affects recursive file-size inspection. Although Path.rglob() does not normally recurse through a symbolic link to a directory, symbolic links to files can still be followed by is_file() and stat().

Attack Path

  1. An attacker creates a Skill package containing a symbolic link such as scripts/check.py pointing to a local file outside the package.
  2. The victim extracts or checks out the package in a way that pres ...[truncated 1002 chars]
Remediation
View remediation

Remediation Suggestions

  • Reject symbolic links before reading or inspecting package files:
    python
    if script_file.is_symlink():
        issues.append(Issue(
            level="error",
            message="Symbolic links are not allowed",
            file=str(script_file.relative_to(self.skill_path)),
            category="Script code",
        ))
        continue
    
  • Resolve every candidate path and verify that it remains under the resolved Skill root:
    python
    root = self.skill_path.resolve()
    candidate = script_file.resolve(strict=True)
    
    if not candidate.is_relative_to(root):
        raise ValueError(f"Path escapes the Skill directory: {script_file}")
    
  • Apply the same containment validation before read_text(), stat(), or any future file operation.
  • Open files defensively where supported, using no-follow semantics such as O_NOFOLLOW, to reduce time-of-check/time-of-use races.
  • Check file size before reading full content and enforce a conservative maximum review size.
  • Catch per-file OSError, decoding, and permission errors so one hostile entry cannot terminate the complete audit.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/review_skill.py:414
Finding

Incomplete script discovery and security checks can produce misleading passing results

Content
View full analysis

Vulnerability Details

File Location: scripts/review_skill.py:414-457
Vulnerability Type: Incomplete security validation and non-recursive executable-file inspection
Risk Level: Medium

Vulnerable Code

python
script_files = list(scripts_dir.glob("*"))

if not script_files:
    return CategoryResult("脚本代码", max_score, max_score, issues)

for script_file in script_files:
    if script_file.is_dir():
        continue

    content = script_file.read_text(encoding="utf-8", errors="ignore")
    rel_path = f"scripts/{script_file.name}"

    # Check shebang
    if script_file.suffix in ['.sh', '.py']:
        if not content.startswith('#!'):
            issues.append(Issue(
                level="warn",
                message="脚本缺少 shebang",
                file=rel_path,
                category="脚本代码"
            ))
            score -= 1

    # Check hard-coded sensitive information
    sensitive_patterns = [
        (r'password\s*=\s*["\'][^"\']+["\']', "可能的硬编码密码"),
        (r'api[_-]?key\s*=\s*["\'][^"\']+["\']', "可能的硬编码 API Key"),
        (r'secret\s*=\s*["\'][^"\']+["\']', "可能的硬编码密钥"),
        (r'token\s*=\s*["\'][^"\']+["\']', "可能的硬编码 Token"),
    ]

    for pattern, msg in sensitive_patterns:
        if re.search(pattern, content, re.IGNORECASE):
            issues.append(Issue(
                level="error",
                message=f"发现 {msg}",
                file=rel_path,
                category="脚本代码"
            ))
            score -= 5

Technical Analysis

Script discovery uses scripts_dir.glob("*"), which only enumerates direct children. Any executable code placed in nested directories is skipped because directory entries are explicitly ignored and are not traversed.

For files that are inspected, the security analysis is limited to four regular expressions matching direct quoted assignments to names resembling password, `api_ke ...[truncated 2029 chars]

Remediation
View remediation

Remediation Suggestions

  • Recursively enumerate files under scripts/ while rejecting symbolic links and enforcing path containment.
  • Inspect executable files regardless of extension, including files marked executable and common script formats in nested directories.
  • Add behavior-oriented checks for command execution, network access, remote payload retrieval, persistence, credential access, obfuscation, unsafe deserialization, and package installation.
  • Parse supported languages with syntax-aware tooling instead of relying exclusively on regular expressions.
  • Inventory dependencies and flag unpinned, unknown, typo-susceptible, or remotely sourced packages.
  • Make --verbose perform documented additional checks or remove the claim that it enables detailed code analysis.
  • Distinguish structural conformance from security approval. Reports should clearly state when analysis coverage is incomplete and should not assign a security “passed” status solely from the current heuristic score.
  • Add regression tests using nested payloads and representative dangerous constructs to verify that they cannot receive an unqualified passing result.
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (10)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- [ ] `SKILL.md` 文件存在于根目录

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description is written in Chinese and does not indicate that other languages are supported or that Chinese is required for a specific regional/compliance reason. Under the policy rule for natural-language constraints, this creates an implicit language restriction without user opt-in.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and main content are written entirely in Chinese, and the skill does not indicate that language selection is optional or that the skill is specifically intended only for Chinese-speaking users. This creates a natural-language locale constraint that may conflict with organizational language-choice policies.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown file is natural-language documentation, and its content consistently forces a single language/locale for readers. Under the policy, language constraints should either be optional for the user or explicitly justified as region-specific; neither is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This shell script contains user-facing descriptions and messages in Chinese, starting with the top-level description, while the file provides no opt-in, fallback, or explanation that the skill is region-specific. That creates a natural-language locale policy concern because users are implicitly forced into a specific language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The usage/help text and examples shown to users are written in Chinese only, and later runtime messages follow the same pattern. Because the script does not let users choose language or state a justified regional limitation, this is a natural-language policy violation under the locale rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This Python file contains natural-language descriptions and messages entirely in Chinese, including the module docstring and later CLI/help output. The stated policy flags language or locale constraints when a skill forces a specific language without user opt-in, and this file provides no mechanism to choose another language or justification for the restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file presents all user-facing guidance exclusively in Chinese, starting from the title and continuing throughout the document. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale restriction is clearly documented and justified, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

该 markdown 文件的全部自然语言说明均为中文,且没有提供多语言选项、用户选择机制,或说明这是面向特定中文使用场景的限定文档。根据语言/locale 政策,未经用户选择即强制单一语言可能构成自然语言策略问题。

Content

No source excerpt is available for this finding.