Back to skill

Security audit

CN Content Matrix

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its Chinese content-generation purpose, but it needs review because user topics can be interpolated into Bash in a way that may execute unintended commands and the declared tool access is broader than necessary.

Install only after fixing the Bash topic handling or restricting topics to trusted input. Avoid confidential topics because WebSearch may expose search terms, and do not run content-review on sensitive local files unless you intend the agent to read them. The skill should remove unneeded Agent/WebFetch/Edit permissions, require explicit commands, and add scoped file-read and output controls.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:153
Finding
Command Injection Through Direct Topic Interpolation in Bash Templates<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:153` and `SKILL.md:294` **Vulnerability Type**: Shell command injection **Risk Level**: High ### Vulnerable Code The same unsafe construction appears in both the single-platform and full-matrix generation workflows: ```bash TOPIC_SLUG=$(echo "{主题}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]-_\p{Han}') OUTPUT_DIR="$HOME/content-output/$(date +%Y-%m-%d)/${TOPIC_SLUG}" if [[ -d "$OUTPUT_DIR" ]]; then OUTPUT_DIR="${OUTPUT_DIR}-$(date +%H%M%S)" fi mkdir -p "$OUTPUT_DIR" ``` The matrix-generation variant is: ```bash TOPIC_SLUG=$(echo "{主题}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]-_\p{Han}') OUTPUT_DIR="$HOME/content-output/$(date +%Y-%m-%d)/${TOPIC_SLUG}/matrix" if [[ -d "$OUTPUT_DIR" ]]; then OUTPUT_DIR="$HOME/content-output/$(date +%Y-%m-%d)/${TOPIC_SLUG}-$(date +%H%M%S)/matrix" fi mkdir -p "$OUTPUT_DIR" ``` ### Technical Analysis The topic originates from user-controlled Skill arguments and is inserted directly into executable shell source. Although the placeholder is enclosed in double quotes, Bash still evaluates command substitutions such as `$(...)` and backtick substitutions inside double-quoted strings. The later `tr -cd` filtering does not mitigate this issue because command substitution is evaluated by Bash before the resulting text reaches the filtering pipeline. Consequently, sanitizing the generated slug occurs too late to prevent command execution. This issue affects both content-generation workflows that construct output directories from the topic. ### Attack Path 1. An attacker invokes the Skill with a topic containing Bash command-substitution syntax. 2. The Agent substitutes that topic into the documented Bash template. 3. The Agent executes the generated Bash block to construct the output path. 4. Bash evaluates the injected command substitution before executing `echo` and `tr`. 5. The injected command runs with the same oper ...[truncated 971 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Do not construct executable shell source by substituting user-controlled text into a command template. 1. Pass the topic as data through a positional argument or environment variable: ```bash USER_TOPIC="$1" TOPIC_SLUG="$( printf '%s' "$USER_TOPIC" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]_-' )" ``` 2. Keep all variable expansions quoted: ```bash OUTPUT_DIR="$HOME/content-output/$(date +%Y-%m-%d)/$TOPIC_SLUG" mkdir -p -- "$OUTPUT_DIR" ``` 3. Reject empty slugs after sanitization: ```bash if [[ -z "$TOPIC_SLUG" ]]; then printf '%s\n' 'Invalid topic: no safe slug characters remain.' >&2 exit 1 fi ``` 4. Explicitly reject path separators, control characters, newlines, shell metacharacters, and unexpected Unicode characters before use. 5. Prefer implementing slug generation through a fixed helper script or a non-shell API so that the topic can never become part of executable syntax. 6. Add regression tests using topics containing command substitutions, backticks, quotes, semicolons, newlines, path traversal sequences, and leading option characters. 7. Apply the same correction to both occurrences at lines 153 and 294. ]]>

T05 · Unauthorized Access and Privilege Escalation

Note
Location
SKILL.md:9
Finding
Skill Declares Tools Beyond the Minimum Privileges Required<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:9-18` **Vulnerability Type**: Excessive tool authorization **Risk Level**: Low ### Vulnerable Configuration ```yaml allowed-tools: - Bash - Read - Write - Edit - Grep - Glob - WebSearch - WebFetch - Agent ``` ### Technical Analysis The declared workflows require local reference reads, content output, compliance checks, and search-based topic research. The reviewed instructions do not establish a necessary use for unrestricted `Agent` delegation or arbitrary `WebFetch` access. Broad Bash access is used for directory construction and content checks, but it also significantly increases the consequences of the command-injection vulnerability identified elsewhere in this report. Allowing tools that are not necessary for the Skill's stated functionality violates least-privilege principles and expands the available execution and network surface. This configuration is not by itself proof of malicious behavior. It is a security-hardening issue because another prompt-injection, command-injection, or untrusted-content flaw could leverage these permissions. ### Attack Path 1. A user-supplied topic, reviewed file, or untrusted web result influences the Agent's instructions. 2. The influenced Agent retains access to unrestricted Bash execution, arbitrary web fetching, and sub-agent delegation. 3. The Agent may invoke capabilities that are unnecessary for content generation or review. 4. Those capabilities can broaden local file access, network interaction, task delegation, or command execution beyond the intended workflow. For direct command injection, the unsafe topic interpolation documented in the first vulnerability provides a concrete route to abuse the broad Bash permission. ### Impact Assessment The excessive permissions increase the potential scope of a successful exploit by enabling: - Arbitrary shell command execution within the host account's permissions. - Retrieval of c ...[truncated 454 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove `Agent` unless a specific, documented workflow requires sub-agent delegation. 2. Remove `WebFetch` if `WebSearch` provides all required research functionality. 3. Replace unrestricted Bash operations with narrowly scoped helper functions or fixed scripts where supported. 4. Restrict writes to a dedicated output root such as `$HOME/content-output`. 5. Restrict content-review reads to user-confirmed files and avoid automatically following symbolic links. 6. Require explicit user approval before accessing arbitrary external URLs or files outside the designated workspace. 7. Document the purpose of every retained tool permission and verify that each one is required by at least one declared workflow. 8. After fixing the command-injection issue, add policy tests confirming that user topics remain data and cannot trigger arbitrary shell execution. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description centers on content generation and style adaptation across multiple Chinese platforms. The supplied code does not generate any content, accept a topic, or transform text into platform-specific styles. Instead, it reads an existing file and evaluates it against platform-specific compliance/format heuristics such as length, banned words, emoji usage, and paragraph size. While the description mentions compliance review, this code only covers that auxiliary function and not the primary advertised generator behavior. Therefore the code chunk materially differs from the declared primary purpose.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The README describes the skill as providing 'true style transfer for Chinese social media,' and throughout the document it assumes Chinese-language generation as the required mode. Because the file does not offer user opt-in or a clear policy justification for enforcing a specific language/locale, this appears to violate the language-choice policy.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README advertises WebSearch-powered real-time research but does not disclose that user-provided topics or prompt-derived content may be sent to external services. This creates a data exposure risk if users input sensitive business plans, unpublished campaigns, regulated content, or personal information under the assumption that processing is local.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The description and instructions define the skill as a Chinese content creation agent and all workflows are written to operate in Chinese, but there is no opt-in or explicit statement that the skill is intentionally limited to Chinese-language output. This can violate language/locale choice policy when the constraint is enforced without user selection or documented justification.

Vague Triggers

Medium
Confidence
95% confidence
Finding
Treating any unrecognized input as a `content-matrix` command broadens activation beyond clear user intent. That can cause unintended web searches, file writes, and multi-step processing from ambiguous prompts, increasing the chance of surprise side effects and over-collection/over-processing.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill writes generated outputs to `$HOME/content-output/...` automatically, but the description does not clearly warn users that local files and directories will be created. Unexpected disk writes can expose sensitive topics in filenames/content, clutter the filesystem, and violate user expectations in shared or monitored environments.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The review flow reads an arbitrary user-specified file path, which can be abused to access unintended local files if the agent is invoked with sensitive paths. In an agent context, arbitrary path reads are dangerous because they expand the skill's data access surface beyond the expected content-review use case.

Natural-Language Policy Violations

Medium
Confidence
86% confidence
Finding
The document prescribes content adaptation for Chinese platforms and specifies Chinese-language audience and style conventions for each platform, but it does not indicate that users may choose another language or locale. Because the policy requires flagging language or locale constraints that are forced without opt-in, this is a natural-language policy concern.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The file recommends a comment CTA promising private-message delivery ('想要XX的扣 1,我私信发你') while later warning against off-platform lead diversion and related compliance issues. Even if the example only mentions DMs, this kind of engagement bait can encourage policy-violating traffic routing, spammy outreach, or platform moderation actions because users are being induced to comment in exchange for gated content.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
This markdown file presents all instructions, warnings, and examples exclusively in Chinese, and it does not state that the skill is intended only for Chinese-speaking users or a China-specific compliance context. Under the policy, forcing a specific language without user opt-in or clear justification is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
This markdown file is written as prescriptive guidance for producing Xiaohongshu content and consistently requires platform-specific Chinese phrasing such as '姐妹们', '安利', and other Chinese-language templates. Under the policy, forcing a specific language or locale without user opt-in can be a natural-language policy violation unless the locale restriction is clearly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This shell script’s description and usage instructions force a specific language/locale for users, and the same pattern continues in later output strings. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified as region-specific, which is not present here.

Natural-Language Policy Violations

Low
Confidence
90% confidence
Finding
This markdown file consists exclusively of Chinese-language instructions and examples, and nowhere indicates that the skill is China-specific or that users may choose another language. Under the language/locale policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Static analysis

No suspicious patterns detected.