Back to skill

Security audit

Academic Paper Assistant

Security checks for vulnerabilities and agentic risk

Overview

This is a Chinese-language academic writing assistant with inactive helper scripts; no hidden execution, persistence, network access, or credential handling was found.

Installers should treat this primarily as a Chinese-language academic writing assistant. Do not run the bundled packaging script on untrusted skill folders or folders that may contain symlinks; use only the writing guidance unless you specifically intend to validate or package a skill directory.

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
scripts/package_skill.py:34
Finding

Path Containment Bypass Allows Files Outside the Skill Directory to Be Packaged

Content
View full analysis

Vulnerability Details

File Location: scripts/package_skill.py, lines 34-38 and 57-70
Vulnerability Type: Improper path containment validation
Risk Level: Medium

Vulnerable Code

python
def is_safe_path(path: str, base_path: str) -> bool:
    """检查路径安全性,防止符号链接逃逸"""
    real_path = Path(path).resolve()
    real_base = Path(base_path).resolve()
    return str(real_path).startswith(str(real_base))
python
with zipfile.ZipFile(output_file, 'w', zipfile.ZIP_DEFLATED) as zf:
    for root, dirs, files in os.walk(skill_path):
        # 排除隐藏目录和临时文件
        dirs[:] = [d for d in dirs if not d.startswith('.') and d != '__pycache__']
        files = [f for f in files if not f.startswith('.') and not f.endswith('.pyc')]

        for file in files:
            file_path = Path(root) / file
            arcname = file_path.relative_to(skill_path)

            # 安全检查
            if not is_safe_path(file_path, skill_path):
                print(f"跳过不安全的路径: {file_path}")
                continue

            zf.write(file_path, arcname)

Technical Analysis

The is_safe_path() function compares resolved paths using str.startswith(). String-prefix equality does not verify that one path is a filesystem descendant of another.

For example, if the package root is /tmp/skill, the external path /tmp/skill-private/secret.txt starts with the string /tmp/skill even though it is not located beneath that directory. A symbolic link inside /tmp/skill that resolves to this external path therefore passes the check.

Path.resolve() follows the symbolic link, but the subsequent prefix comparison incorrectly accepts the resolved target. zipfile.ZipFile.write() then reads the target using the privileges of the packaging process and stores its contents under the symbolic link's archive name.

Exploitation requires the attacker to place or influence a symbolic link within the directory ...[truncated 1799 chars]

Remediation
View remediation

Remediation Suggestions

Replace string-prefix comparison with component-aware path containment validation and reject symbolic links explicitly:

python
def is_safe_path(path: Path, base_path: Path) -> bool:
    if path.is_symlink():
        return False

    try:
        resolved_base = base_path.resolve(strict=True)
        resolved_path = path.resolve(strict=True)
        resolved_path.relative_to(resolved_base)
        return True
    except (ValueError, FileNotFoundError, RuntimeError):
        return False

Apply the following additional hardening measures:

  1. Reject symbolic links for both files and directories unless following them is an explicit requirement.
  2. Validate every traversed directory with Path.relative_to() against the resolved package root.
  3. Use os.path.commonpath() as an alternative component-aware check, ensuring the result exactly equals the resolved base path.
  4. Open files defensively where supported, such as with no-follow semantics, to reduce time-of-check/time-of-use risks caused by replacing a checked file with a symbolic link.
  5. Treat packaging input as untrusted and run the script with minimal filesystem privileges.
  6. Add regression tests covering:
    • Ordinary files beneath the package root.
    • Symbolic links to unrelated external paths.
    • Prefix-colliding paths such as /tmp/skill and /tmp/skill-private.
    • Broken symbolic links.
    • Symbolic-link replacement between validation and archive creation.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill claims to assist with academic writing, but detected behavior includes validating skill directories, parsing frontmatter, checking metadata fields, and returning process exit codes. This undisclosed validation/CLI-style behavior indicates the skill may operate on local project files rather than just user-supplied text, creating opportunities for unintended file inspection and misuse under a misleading label.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill claims to assist with academic writing, but detected behavior includes validating skill directories, parsing frontmatter, checking metadata fields, and returning process exit codes. This undisclosed validation/CLI-style behavior indicates the skill may operate on local project files rather than just user-supplied text, creating opportunities for unintended file inspection and misuse under a misleading label.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill advertises no explicit tool scope or permissions, yet static analysis detected file-read capability. That creates a trust and containment problem: an academic-writing assistant could access local files outside the user's expectation, enabling unintended data exposure if invoked on sensitive documents or directories.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This markdown skill forces a specific language/locale for activation text, instructions, and outputs, but does not state that it is China-specific or provide any user opt-in for Chinese. Under the policy, language-specific behavior without user choice or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The title and content frame the guidance specifically around Chinese academic writing standards, beginning with Chinese-language requirements and examples. Because the file presents a fixed language/locale norm without any opt-in or statement that it is only for users seeking Chinese-language conventions, it can be read as forcing a specific language/locale preference.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file presents the skill content entirely in Chinese and does not indicate that the user can choose another language or that the skill is intentionally limited to a Chinese-language context. Under the policy rule for language/locale constraints, forcing a specific language without opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring and all CLI output are written only in Chinese, which imposes a specific language on users without any opt-in or alternative locale support. Under the policy rule, a skill that forces one language without user choice is a natural-language policy violation unless the locale restriction is clearly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Lines L081-L082 require every description field to contain Chinese characters and emit an error otherwise. This is a natural-language policy constraint that forces a specific language/locale, and the file does not indicate that the tool is intentionally limited to a China-specific or Chinese-only context.

Content

No source excerpt is available for this finding.