Back to skill

Security audit

源码分析

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed source and prompt analysis helper, but it writes potentially sensitive extraction reports to predictable temporary paths that deserve review before installation.

Review before installing. Use this only for repositories, packages, or binaries you are authorized to analyze, and avoid the default /tmp output path; choose a private directory with restrictive permissions and delete reports when finished.

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/extract-prompts.sh:8
Finding

Predictable Temporary Report File Permits Symlink Overwrite and Information Disclosure

Content
View full analysis

Vulnerability Details

File Location: scripts/extract-prompts.sh, lines 8 and 14–16
Vulnerability Type: Unsafe temporary-file handling
Risk Level: Medium

Vulnerable Code

bash
OUTPUT_DIR="${2:-/tmp/source-analysis}"

# ...

mkdir -p "$OUTPUT_DIR"
BASENAME=$(basename "$BINARY")
REPORT="$OUTPUT_DIR/extracted-${BASENAME}.txt"

echo "=== Source Analysis Extract ===" > "$REPORT"

Technical Analysis

The script uses the shared /tmp hierarchy by default and derives the report filename predictably from the input file's basename. It creates or truncates that report using ordinary shell redirection without:

  • Creating a private temporary directory;
  • Verifying directory ownership and permissions;
  • Rejecting symbolic links;
  • Creating the report atomically and exclusively;
  • Enforcing restrictive report permissions.

Shell redirection follows symbolic links. Consequently, another local user who can predict the analyzed file's basename may pre-create /tmp/source-analysis/extracted-<basename>.txt as a symbolic link. When a victim runs the script, the initial redirection follows that link and truncates the linked file if the victim has permission to write it. Later redirections append extracted data through the same link.

In addition, report permissions depend on the invoking user's umask. The report may contain proprietary system prompts, behavioral instructions, tool names, environment-variable names, and other strings extracted from the supplied binary. A permissive umask or attacker-controlled output directory may expose this information to other local users.

Attack Path

  1. A local attacker determines or predicts the basename of a binary that a victim will analyze.
  2. The attacker creates /tmp/source-analysis before the victim, if necessary, and places a symbolic link at /tmp/source-analysis/extracted-<basename>.txt.
  3. The symbolic link targets a file writab ...[truncated 1217 chars]
Remediation
View remediation

Remediation Suggestions

  1. Set a restrictive permission mask before creating output artifacts:

    bash
    umask 077
    
  2. Create a private temporary directory with mktemp rather than using a predictable shared directory:

    bash
    OUTPUT_DIR="${2:-$(mktemp -d "${TMPDIR:-/tmp}/source-analysis.XXXXXXXX")}"
    
  3. If a caller supplies an output directory, verify that it is a real directory, is owned by the invoking user, and is not writable by untrusted users.

  4. Create the report atomically with exclusive-creation and no-symbolic-link semantics. Avoid directly redirecting to a predictable path. Where available, use a small helper in a language that supports O_CREAT | O_EXCL | O_NOFOLLOW, or first create a secure temporary report with mktemp inside the validated directory.

  5. Before publishing a final predictable filename, verify that the destination does not exist and use an atomic operation that cannot overwrite an attacker-created entry. Prefer retaining a random report name if predictable naming is unnecessary.

  6. Explicitly apply mode 0600 to report files and mode 0700 to generated directories.

  7. Add cleanup handling for partially generated reports and private temporary directories:

    bash
    trap 'rm -f -- "$REPORT_TMP"' EXIT
    
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill claims to perform GitHub/npm source analysis, but its documented workflow also includes scraping strings from local packaged binaries to extract embedded prompts, tool names, and behavior instructions. This expands the capability beyond the declared purpose and can enable opaque reverse-engineering of binaries and collection of embedded secrets or internal prompt content without clearly disclosing that behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description and operational guidance are entirely in Chinese, with no indication that users may interact in another language or choose their preferred locale. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale restriction is documented and justified.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

The skill instructs outbound requests to GitHub endpoints, which constitutes external data transmission and network interaction. In this context the behavior is expected for repository analysis, but it can still expose user-supplied targets, metadata, or analysis intent to third parties if performed without clear consent or network-boundary controls.

Content

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

md
curl -s -L --max-time 15 "https://raw.githubusercontent.com/{owner}/{repo}/main/README.md"
   
   # 获取仓库结构(如果API可达)
   curl -s -L --max-time 15 "https://api.github.com/repos/{owner}/{repo}/git/trees/main?recursive=1"
   
   # 检查关键文件
   for path in "package.json" "src/index.ts" "CLAUDE.md" ".claude/CLAUDE.md" "plugins/README.md"; do

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

This shell script explicitly scans the target binary for environment-variable identifiers matching provider-related prefixes such as CLAUDE_CODE_ and ANTHROPIC_ and writes the results to a report. Although it prints progress messages, there is no warning in comments or usage text that the analysis includes credential- or configuration-related identifiers, which is a safety-relevant behavior for a code file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The instructions direct the agent to save extracted artifacts in /tmp and write a report file into the workspace without warning the user about persistence. This can leave behind potentially sensitive extracted content, such as prompts, tool definitions, or repository-derived data, creating unnecessary local data retention.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The title and all instructional content are written in Chinese, which signals a fixed language/locale for the skill content. Under the stated policy, forcing a specific language without user opt-in or an explicit justification can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file contains a Chinese-only descriptive comment ('分析AI Agent源码与架构') even though the rest of the script interface is in English, which imposes a locale choice without explanation. The policy calls for flagging language or locale constraints unless the skill offers user choice or clearly documents and justifies the locale.

Content

No source excerpt is available for this finding.