Back to skill

Security audit

auto-leetcode

Security checks for vulnerabilities and agentic risk

Overview

This LeetCode helper is purpose-aligned and openly describes fetching problem content, generating explanations/code, and writing files to a user-specified directory.

Install only if you want a Chinese-language LeetCode study-file generator. Provide a normal project or notes directory, avoid sensitive/system paths, and review the resolved destination before allowing writes or overwrites.

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
SKILL.md:52
Finding

Unrestricted User-Controlled Output Path May Allow Arbitrary File Writes

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 52-67
Vulnerability Type: Unvalidated file path construction and arbitrary file write
Risk Level: Medium

Vulnerable Code Snippet

markdown
### 4. 创建本地文件

在用户指定目录下创建文件夹并写入文件。

**文件夹命名**:使用题目序号+名称(如 `42.接雨水`)

**文件结构**:

{目录}/{序号}.{名称}/ ├── 题目内容.md ├── 解题思路.md └── {序号}.{ext}

text

Technical Analysis

The skill instructs the agent to create directories and write three files using a user-provided base directory and a folder name derived from user-provided problem identifiers. It does not require path canonicalization, traversal-component rejection, an approved output root, symbolic-link checks, or overwrite protection.

If these values are passed directly to filesystem tools, an attacker could supply an absolute output directory or path components such as ../ to direct writes outside the intended workspace. A pre-existing symbolic link could similarly redirect output to another location. Because the generated filenames are predictable, existing files at the selected destination may also be overwritten if the underlying write operation permits it.

This is an insecure coding and configuration practice rather than evidence of intentional malicious behavior. Exploitability depends on how the agent's filesystem tools enforce permissions and whether they independently restrict output paths.

Attack Path

  1. An attacker invokes the skill and supplies a crafted local directory or problem name containing absolute or traversal-based path components.
  2. The skill combines the supplied values into {directory}/{number}.{name} without requiring validation or canonicalization.
  3. The agent creates the resulting directory and writes the problem statement, solution explanation, and source-code file.
  4. If the resolved path escapes the intended workspace—or passes through an attacker-prepared symbolic link—the files are written to an unint ...[truncated 816 chars]
Remediation
View remediation

Remediation Suggestions

  1. Restrict all generated output to an explicitly approved workspace root.
  2. Resolve the workspace root and proposed destination to canonical absolute paths, then verify that the destination remains beneath the approved root.
  3. Treat the problem number and title as filename components rather than paths. Reject /, \, .., null bytes, drive prefixes, and other platform-specific path metacharacters.
  4. Prefer constructing folder names from a strict allowlist, such as letters, digits, spaces, hyphens, underscores, and a limited set of safe Unicode characters.
  5. Detect symbolic links in every existing destination component and refuse writes where a link could redirect output outside the approved root.
  6. Use exclusive file creation or require explicit user confirmation before overwriting existing files.
  7. Display the fully resolved destination paths before writing and request confirmation when the destination was supplied by the user.
  8. Apply least-privilege filesystem permissions so the agent cannot write to system directories or unrelated user data.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (5)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger description is broad enough to activate on many generic study or algorithm-practice requests, which can cause the skill to run in contexts the user did not explicitly intend. Because this skill performs external fetching and local file creation, over-triggering increases the risk of unintended disk writes and surprising side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description does not clearly warn users that it will create directories and write files locally, which undermines informed consent for a side-effecting action. In an agent environment, hidden file-system effects are security-relevant because users may invoke the skill expecting advice only, not persistent local modifications.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The instructions require '中文注释解释关键逻辑', which forces a specific language for generated explanatory text. This is a natural-language policy concern because the skill does not state that the user can opt into another language for comments or explanations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains a natural-language instruction requiring comments to be written in Chinese. That enforces a specific language/locale without any opt-in, exception, or documented region-specific justification, which matches the policy-violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file presents all user-facing headings, labels, and placeholders in Chinese, which effectively forces a specific language/locale. The policy allows locale constraints when they are explicitly justified or when users are offered a choice, but neither is present here.

Content

No source excerpt is available for this finding.