Back to skill

Security audit

疑难法律实操案例库

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent legal-research purpose, but it asks users to run an unpinned external Python runner and send sensitive legal questions to Cue with limited safeguards.

Review before installing. Use this only if you are comfortable sending legal questions to cuecue.cn, redact names, ID numbers, phone numbers, addresses, case numbers, employer/client details, and other confidential facts where possible, restrict ~/.cue/config.json permissions to owner-only, and avoid running the external runner unless you can verify exactly which version you installed.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:108
Finding
Shell Command Injection Through Direct Interpolation of the User's Legal Query<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 108-117 **Vulnerability Type**: Shell command injection through untrusted argument interpolation **Risk Level**: High ### Vulnerable Code The placeholder below is translated to English from the original documentation while preserving the command structure: ```bash python3 ~/.cue/cue-skills/cue-research/scripts/research_run.py \ --query "<USER_QUESTION_VERBATIM>" \ --template-id <RUNTIME_TEMPLATE_ID> \ --output ~/cue-reports/$(date +%Y-%m-%d-%H%M)-legal-practice-cases.md ``` The parameter documentation additionally requires the user's original question to be used without rewriting it. ### Technical Analysis The Skill instructs the Agent to interpolate unmodified, user-controlled text into a double-quoted shell argument. Double quotes do not neutralize all shell metacharacters. In particular, command substitution using `$(...)` or backticks remains active inside double quotes. An embedded quote may also terminate the intended argument and introduce shell operators. For example, if an Agent constructs the documented command through textual substitution, a query containing command substitution could cause the shell to execute the substituted command before Python receives the `--query` argument. This behavior is unnecessary for the declared legal-research functionality. The question only needs to be passed as a data argument to the Python process; it does not need to be interpreted by a shell. ### Attack Path 1. An attacker supplies a purported legal question containing shell syntax such as command substitution or a quote followed by shell operators. 2. The Agent follows the instruction to use the user's question verbatim. 3. The Agent inserts the malicious text into the documented shell command. 4. A shell parses the resulting command line. 5. The injected expression executes before or alongside `research_run.py`. 6. The attacker's ...[truncated 867 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not construct the invocation by concatenating a shell command string. - Launch Python with a process API that accepts an argument array, such as Python's `subprocess.run([...], shell=False)`. - Pass the exact user question as one argument without shell parsing: ```python subprocess.run( [ "python3", runner_path, "--query", user_question, "--template-id", template_id, "--output", output_path, ], check=True, shell=False, ) ``` - If an interactive shell is unavoidable, pass the query through a securely assigned environment variable or apply robust platform-specific argument quoting. Do not rely only on surrounding the value with double quotes. - Validate `template_id` separately against the expected identifier format. - Construct the output path using a filesystem API rather than shell command substitution. - Add tests using queries containing quotes, semicolons, newlines, backticks, `$()`, pipes, redirections, and option-like prefixes. - Explicitly instruct Agents that verbatim preservation applies to the data sent to the runner, not to raw insertion into executable shell text. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:93
Finding
Bearer API Key Stored Without Explicit Restrictive Filesystem Permissions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 93-97 **Vulnerability Type**: Insecure storage permissions for a plaintext credential **Risk Level**: Medium ### Vulnerable Code The example key placeholder is translated to English while preserving the documented command: ```bash mkdir -p ~/.cue echo '{"api_key": "sk-YOUR-KEY"}' > ~/.cue/config.json ``` ### Technical Analysis The setup instructions write a bearer API key to a plaintext JSON file but do not explicitly restrict permissions on either `~/.cue` or `~/.cue/config.json`. The resulting permissions depend on the user's current `umask` and any pre-existing directory permissions. On a system with a permissive `umask`, the credential file may be readable by other local users or processes operating under different accounts. Because the key is a bearer credential, possession may be sufficient to make authenticated requests and consume account credits. Storing a local credential is reasonably related to the declared API-based functionality. However, allowing its confidentiality to depend entirely on ambient filesystem defaults exceeds the minimum safe exposure necessary. ### Attack Path 1. A user follows the documented setup command. 2. The shell creates `~/.cue/config.json` using permissions derived from the current `umask`. 3. On a permissively configured or shared system, another local account can traverse the directory and read the file. 4. The attacker extracts the bearer API key. 5. The attacker uses the key to authenticate to the Cue service and consume credits or access any data available to that credential. This path requires local filesystem access and permissions that permit reading the created file. ### Impact Assessment The likely impact is disclosure and unauthorized use of the Cue API credential. Potential consequences include: - Unauthorized API requests under the victim's account. - Consumption of paid or limi ...[truncated 305 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Create the credential directory with owner-only permissions: ```bash install -d -m 700 "$HOME/.cue" ``` - Create the credential file atomically with mode `600`. For example: ```bash umask 077 printf '%s\n' '{"api_key":"sk-YOUR-KEY"}' > "$HOME/.cue/config.json" chmod 600 "$HOME/.cue/config.json" ``` - Avoid placing real API keys directly in commands that may be retained in shell history. Prefer a hidden prompt, a secure credential manager, or a setup utility that reads from standard input. - Verify ownership and reject configuration files owned by another user. - Where supported, use the operating system's credential store instead of a plaintext JSON file. - Document key rotation and immediate revocation procedures. - Ensure diagnostic commands never print the key or include it in verbose HTTP logs. ]]>

T08 · Insecure Dependencies

Error
Location
SKILL.md:84
Finding
Execution of an Unpinned Externally Maintained Research Runner<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 84-89 and 108-112 **Vulnerability Type**: Unpinned external executable dependency **Risk Level**: High ### Vulnerable Code The Skill identifies `sensedeal/cue-skills` on GitHub, with a Gitee mirror, as the source of its runner and later executes that runner from the user's home directory: ```bash python3 ~/.cue/cue-skills/cue-research/scripts/research_run.py \ --query "<USER_QUESTION_VERBATIM>" \ --template-id <RUNTIME_TEMPLATE_ID> \ --output ~/cue-reports/$(date +%Y-%m-%d-%H%M)-legal-practice-cases.md ``` The project being audited contains only `SKILL.md`; the referenced installer and runner are not included in the reviewed artifact. No immutable commit, release digest, checksum, or signature is specified. ### Technical Analysis The Skill's principal functionality depends on locally executing Python code obtained from an external repository. Because no immutable version or integrity verification is documented, the code executed by users can differ from the code that existed when the Skill was reviewed. This creates a supply-chain trust boundary: compromise of the upstream account, repository, mirror, release process, DNS/TLS endpoint, or installation workflow could substitute modified executable code. Python scripts execute with the full privileges of the invoking user and can access local files, environment variables, credentials, and the network. The external runner may be necessary for the declared functionality, but fetching a mutable version is not necessary. An audited, immutable release would provide the same functionality with substantially lower risk. The static-scan concern about line 172 is distinct from this finding. Line 172 does not pipe HTTP output into Bash; it pipes JSON into a local Python JSON parser. The risk arises from the separately sourced runner, not from that health-check pipeline. ### Attack Path 1. The user ...[truncated 1411 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Bundle the reviewed runner with the Skill when licensing and distribution constraints permit. - Otherwise, pin the dependency to an immutable commit hash or versioned release rather than a mutable branch. - Publish and verify a cryptographic checksum for every downloaded artifact before execution. - Prefer signed releases and verify signatures against a documented maintainer key. - Remove automatic fallback between mirrors unless each mirror is independently integrity-verified. - Display the exact source URL, version, commit, and expected digest before installation. - Review the complete transitive dependency set and repeat the review whenever the pinned version changes. - Run the runner in a constrained environment with only the required report directory, configuration file, and network destinations available. - Avoid elevated execution and explicitly state that the installer and runner must never be run with `sudo`. - Fail closed if integrity verification fails or if the installed runner does not match the audited version. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Vague Triggers

Medium
Confidence
84% confidence
Finding
The trigger list includes very broad legal and everyday dispute terms such as 离婚、继承、劳动仲裁、交通事故 and 实务案例, which can cause the skill to activate in situations where the user did not intend to send sensitive legal facts to this external service. In this skill’s context, accidental invocation is more dangerous because user prompts may contain highly sensitive personal, financial, criminal, or family-dispute information.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill describes an architecture where user queries are sent to Cue API and then to external data sources, but it does not present a prominent privacy warning or informed-consent step before transmission. Because this skill handles legal disputes, users may disclose names, allegations, case facts, ID numbers, employer data, or criminal-defense details, making undisclosed third-party transmission a significant privacy and confidentiality risk.

Static analysis

No suspicious patterns detected.