Back to skill

Security audit

法律幻觉校验器

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently verifies legal citations through a disclosed external API, but users should be careful with confidential legal text and API-key handling.

Install only if you are comfortable sending the legal text you ask it to verify to the disclosed chineselaw.com API. Avoid using it on privileged or highly confidential material unless that service is approved for your matter, keep the API key out of chats and source control, and delete or protect generated body.json and response.json files after use.

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
SKILL.md:41
Finding
Confidential Legal Data Written to Predictable Files## Vulnerability Details **File Location**: `SKILL.md`, lines 41–42 **Vulnerability Type**: Unsafe temporary-file handling and plaintext sensitive-data storage **Risk Level**: Medium **Complete source excerpt, translated into English:** ```text 1. Always write the request body to `body.json` to avoid escaping failures for long Chinese text on the command line. 2. Save the request result as `response.json` and record `HTTP_STATUS` at the same time. ``` ### Technical Analysis The skill requires every API request and response to be written to fixed, relative filenames: `body.json` and `response.json`. Legal documents may contain confidential personal, commercial, litigation, or privileged information. The instructions do not require restrictive permissions, a private directory, randomized filenames, exclusive file creation, symbolic-link protection, or deletion after processing. Predictable relative paths also create race and collision risks when multiple skill instances run in the same working directory. One invocation may overwrite or consume data belonging to another invocation. On systems where an attacker can modify the working directory, a pre-created symbolic link may cause the agent to write data to an unintended file accessible with the agent process's existing permissions. ### Attack Path 1. An attacker obtains local access to, or write access within, the directory used for skill execution. 2. The attacker monitors the predictable `body.json` and `response.json` paths or creates one of those paths as a symbolic link. 3. A user invokes the skill with confidential legal text. 4. The agent writes the request and response to the predictable paths. 5. The attacker reads the retained information, causes cross-run data exposure, or redirects a write to another location writable by the agent. This path requires local filesystem access or another process operating under a context that can access the working directory. ...[truncated 569 chars]
Remediation
## Remediation Suggestions - Avoid writing request and response bodies to disk when the HTTP client can stream them directly from and into memory. - If files are necessary, create a private temporary directory with permissions restricted to the current user. - Generate cryptographically random filenames rather than using fixed relative paths. - Create files atomically and exclusively, reject symbolic links, and set file permissions to `0600`. - Keep request and response files separate for every invocation to prevent concurrent-run collisions. - Delete temporary files in a guaranteed cleanup block, including after network failures and malformed responses. - Redact unnecessary personal or confidential information before transmission and local storage. - Obtain user consent before uploading confidential documents to the external service and document the service's retention and privacy implications.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:25
Finding
Plaintext API-Key Storage in the Skill Directory## Vulnerability Details **File Location**: `SKILL.md`, lines 25–26 **Vulnerability Type**: Insecure credential storage **Risk Level**: Medium **Complete source excerpt, translated into English:** ```text - It may be written to a `.env` file in the same directory as this `SKILL.md`, but it must be explicitly loaded before invocation; merely writing the file does not make it effective automatically. - The `.env` file must not be committed to Git. ``` ### Technical Analysis The skill permits the `YUANDIAN_API_KEY` credential to be stored in a plaintext `.env` file beside `SKILL.md`. Preventing Git commits reduces one exposure path but does not protect the credential from permissive filesystem permissions, shared workspaces, backups, directory archives, diagnostic bundles, or unrelated local processes. The instructions do not require restrictive file permissions, secret-manager integration, secure deletion, or credential rotation after suspected exposure. They also do not establish a repository-level ignore rule, so accidental source-control inclusion remains possible despite the written warning. ### Attack Path 1. A user stores `YUANDIAN_API_KEY` in the permitted `.env` file within the skill directory. 2. The directory is readable by another local user or process, copied into a backup, archived for transfer, or accidentally added to source control. 3. An attacker obtains the plaintext `.env` file. 4. The attacker extracts the API key and submits authenticated requests to the legal-verification service under the victim's account. Exploitation requires access to a copy of the skill directory or another channel through which the plaintext file is exposed. ### Impact Assessment A disclosed key may allow unauthorized API requests, consumption of the victim's quota, unexpected charges, service throttling, and activity attributed to the victim's account. The exact service-side access available to an attacker is limited to th ...[truncated 305 chars]
Remediation
## Remediation Suggestions - Prefer injecting `YUANDIAN_API_KEY` through the process environment or retrieving it from an operating-system or managed secret store. - Do not store credentials in the skill package or a shared project directory. - If `.env` support must remain, require permissions equivalent to `0600` and verify those permissions before loading the file. - Supply and enforce an ignore rule covering `.env` and related secret-file variants. - Exclude secret files from backups, archives, support bundles, and diagnostic output. - Never print or log the API key, including in verbose HTTP traces or error messages. - Document immediate key revocation and rotation procedures for suspected exposure. - Where supported, use narrowly scoped, short-lived credentials with quota and anomaly monitoring.
Vulnerability Patterns
  • 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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (1)

Ae1

High
Category
analysis-evasion
Content
- 可写入与本 `SKILL.md` 同目录的 `.env`,但调用前必须显式加载;仅写入文件不会自动生效。
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Static analysis

No suspicious patterns detected.