Back to skill

Security audit

ai-coding-standards

Security checks for vulnerabilities and agentic risk

Overview

This skill is not clearly malicious, but it overstates what it provides and includes under-scoped local file persistence that should be reviewed before installation.

Review this before installing. It is suitable only if you are comfortable with a small, mostly Chinese-language quality-checking and plan-tracking utility, manual repository hook guidance, and persistent local plan files. Avoid using untrusted plan IDs, and prefer a version that validates plan IDs and accurately documents which tools are actually included.

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
plan_tracker.py:51
Finding
Arbitrary JSON File Read and Write Through Unsanitized Plan IDs## Vulnerability Details **File Location**: `plan_tracker.py`, lines 51-88 **Vulnerability Type**: Path traversal and unrestricted file access **Risk Level**: Medium ### Vulnerable Code ```python def _get_plan_path(self, plan_id: str) -> str: return os.path.join(self.storage_dir, f"{plan_id}.json") ``` ```python def save_plan(self, plan: Plan) -> None: """Save a plan.""" path = self._get_plan_path(plan.id) with open(path, 'w', encoding='utf-8') as f: json.dump({ 'id': plan.id, 'title': plan.title, 'description': plan.description, 'tasks': [asdict(t) for t in plan.tasks], 'status': plan.status, 'created_at': plan.created_at, 'updated_at': plan.updated_at }, f, indent=2, ensure_ascii=False) ``` ```python def load_plan(self, plan_id: str) -> Optional[Plan]: """Load a plan.""" path = self._get_plan_path(plan_id) if not os.path.exists(path): return None with open(path, 'r', encoding='utf-8') as f: data = json.load(f) ``` ### Technical Analysis `_get_plan_path()` directly incorporates a caller-controlled plan identifier into a filesystem path. It does not validate the identifier, reject absolute paths or traversal components, resolve the resulting path, or verify that it remains under `storage_dir`. Because `os.path.join()` discards the preceding storage directory when its subsequent component is absolute, a plan ID such as `/tmp/target` resolves to `/tmp/target.json`. Relative traversal values such as `../../tmp/target` can similarly escape the intended plan directory. Both access directions are affected: - `load_plan()` can open and parse an attacker-selected JSON file outside the plan directory. - `save_plan()` trusts `plan.id` and can create or overwrite an attacker-selected `.json` file. - Symlinks inside the storage directory coul ...[truncated 1536 chars]
Remediation
## Remediation Suggestions 1. Enforce the generated plan-ID format before any filesystem operation. For example, accept only eight lowercase hexadecimal characters with `^[0-9a-f]{8}$`. 2. Explicitly reject absolute paths, path separators, `.` and `..` components, and identifiers outside the expected character set. 3. Resolve both the storage directory and candidate path with `os.path.realpath()` or `pathlib.Path.resolve()`. 4. Verify containment using `os.path.commonpath()` before opening the file. Reject the operation unless the resolved candidate is strictly inside the resolved storage directory. 5. Apply validation independently in both `load_plan()` and `save_plan()` so that a forged `Plan.id` cannot bypass protections. 6. Mitigate symlink attacks by rejecting symlink targets or using platform-supported no-follow file-opening options where available. 7. Write through a securely created temporary file inside the storage directory and atomically replace the destination. 8. Create plan files with restrictive permissions appropriate for potentially sensitive task data. 9. Add tests covering absolute paths, `../` traversal, nested separators, malformed IDs, symlinks, and valid generated IDs.
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 (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The code chunk implements only the 'Plan persistence' portion of the description: it defines Plan and Task dataclasses, persists plans to local JSON files, and exposes simple CLI commands for creating and managing plans. There is no evidence of coding-standard enforcement, self-correction logic, quality red lines, progressive context loading, or hook interception. Because the declared purpose presents a broader AI coding standards/self-repair framework while the actual code is just a plan tracker component, the description does not accurately represent the full behavior of this code chunk.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The code only implements a basic static quality checker. It reads files from disk, applies simple heuristics for maximum file size, function length, and nesting depth, and prints results via a CLI. While this partially aligns with the 'quality red line' portion of the description, the description prominently advertises additional capabilities—self-correction, progressive context loading, Plan persistence, and hook interception—that are not present in the supplied code. This is therefore a material description-to-behavior mismatch, even though there are no suspicious undeclared permissions or unrelated triggers.

Lp3

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding
The skill describes behaviors that involve reading and writing files, including creating hook files and persisting plans, but it does not declare any explicit tool scope or permissions boundaries. In an agent environment, missing scope declarations can lead to broader-than-expected filesystem access and make it harder for operators to constrain what the skill is allowed to do.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The trigger signals are broad, generic terms such as code_quality and file_size, which may cause the skill to activate in unrelated contexts. In agent systems, underspecified triggers can expand the skill’s reach unexpectedly, increasing the chance of inappropriate file operations, unwanted guidance, or interference with other workflows.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The module docstring presents the skill description in Chinese, and later CLI output and help-adjacent strings are also Chinese-only. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The CLI entrypoint prints status messages such as plan counts, creation confirmations, and default titles/tasks in Chinese only. This imposes a locale choice on all users without opt-in or documented justification.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
SQP-3 applies to all file types and covers language or locale policy violations. This script mixes English and Chinese, but several docstrings and user-facing CLI messages are Chinese-only, with no opt-in or locale selection mechanism for users who may expect another language.