Back to skill

Security audit

高考助手 Gaokao Tutor

Security checks for vulnerabilities and agentic risk

Overview

This Gaokao tutoring skill is mostly purpose-aligned, but it needs review because it stores student profile data persistently and gives inadequate guidance for explicit self-harm language.

Install only if you are comfortable with a local tutor that remembers student profile and mistake data across sessions. Users should be told where that data is stored and how to delete it. The emotional-support section should be fixed before use with vulnerable students: explicit self-harm or suicide language should trigger immediate crisis-oriented guidance to contact local emergency services or a trusted adult, not ordinary study-stress reassurance.

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
scripts/mistakes.py:18
Finding
Student Records Are Persisted Without Explicit Restrictive File Permissions<![CDATA[ ## Vulnerability Details **File Location**: `scripts/mistakes.py:18-34` **Vulnerability Type**: Insecure plaintext storage and insufficient access-control hardening **Risk Level**: Medium ### Vulnerable Code ```python MISTAKES_FILE = os.path.expanduser("~/.openclaw/workspace/memory/gaokao-mistakes.json") REVIEW_INTERVALS = [1, 3, 7, 15, 30] def load_mistakes(): if not os.path.exists(MISTAKES_FILE): return {"mistakes": []} with open(MISTAKES_FILE, "r", encoding="utf-8") as f: return json.load(f) def save_mistakes(data): os.makedirs(os.path.dirname(MISTAKES_FILE), exist_ok=True) with open(MISTAKES_FILE, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The mistake database is written as plaintext to a predictable persistent path. The implementation relies on the process umask and inherited directory permissions instead of explicitly enforcing owner-only access. The stored records include subjects, weak topics, question summaries, error reasons, review history, and mastery status. These fields form an educational profile and may contain portions of user-submitted questions or other personal information. On a system with a permissive umask, shared workspace permissions, or another component running under the same account, the file may be readable or writable by unintended parties. The use of a fixed path and ordinary `open(..., "w")` also lacks symlink checks and atomic replacement, increasing the risk of tampering or corruption where an attacker already has relevant local filesystem access. The Skill documentation also directs persistent storage of a broader student profile in `memory/gaokao-profile.json`, but no implementation for that file was present in the reviewed project. Therefore, the confirmed code-level finding is limited to the mistake database. ### Attack Path 1. The Skill records a student's mistake using the `add` command. 2. `save_ ...[truncated 1254 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Create the storage directory with owner-only permissions: ```python os.makedirs(directory, mode=0o700, exist_ok=True) os.chmod(directory, 0o700) ``` 2. Create files with mode `0600` using `os.open()` rather than relying on the process umask: ```python fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600) with os.fdopen(fd, "w", encoding="utf-8") as file: json.dump(data, file, ensure_ascii=False, indent=2) ``` 3. Write to an owner-only temporary file in the same directory, flush and synchronize it, and atomically replace the destination with `os.replace()`. 4. Reject symbolic-link destinations and verify that the resolved storage path remains inside the intended memory directory. 5. Validate loaded JSON against a strict schema before using it. Reject unexpected types, missing fields, invalid dates, and excessively large records. 6. Document what information is retained, how long it is retained, and how users can inspect or permanently delete it. 7. Avoid storing unnecessary portions of submitted questions or other identifying information. If the runtime threat model includes untrusted components under the same account, use platform-provided encrypted storage. ]]>

other

Error
Location
references/emotional-support.md:23
Finding
Explicit Suicidal Language Is Handled Without Crisis Assessment or Escalation<![CDATA[ ## Vulnerability Details **File Location**: `references/emotional-support.md:23-36` **Vulnerability Type**: Unsafe self-harm crisis handling **Risk Level**: High ### Vulnerable Instruction The following is an English translation of the complete relevant instruction block: ```text ### Breakdown level (prioritize reassurance) Trigger words: "I do not want to study anymore," "I cannot get admitted," "despair," "cried," "give up," "collapsed," "there is no hope," "it is too difficult and I want to die" Response template: Stop for a moment and take a deep breath. Senior year is genuinely exhausting. Feeling this way is completely normal; it does not mean you are incapable. Would you be willing to tell me what is making you feel overwhelmed? Or do you just need someone to stay with you right now, without talking? Wait for the student's response. Do not rush to say, "Everything is fine; continue studying." ``` ### Technical Analysis The emotional-support policy places an explicit statement of wanting to die in the same general category as exam frustration and instructs the Agent to provide reassurance and wait. It does not distinguish figurative language from possible suicidal intent. The workflow contains no assessment of immediate danger, current intent, plan, access to means, recent self-harm, or whether the user is alone. It also lacks instructions to involve a trusted adult, contact local emergency services when danger is imminent, or remain engaged while the user seeks help. This omission is especially significant because the Skill is designed for high-school students, who may be minors. The emotional-support module has the highest routing priority, so its incomplete workflow may displace a more appropriate crisis response. ### Attack Path This is primarily a safety-failure path rather than an adversarial privilege-escalation path: 1. A student expresses explicit suicidal intent using a phrase covered by the trigger list. 2. The highest ...[truncated 893 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Add a separate crisis branch for explicit self-harm or suicide language rather than grouping it with general academic distress. 2. In a calm, direct manner, assess: - Whether the user is in immediate danger. - Whether they intend to harm themselves. - Whether they have a plan or access to means. - Whether they have already harmed themselves. - Whether they are alone. 3. For imminent danger, instruct the Agent to encourage immediate contact with local emergency services and a nearby trusted adult. The Agent should not assume a specific country or emergency number without knowing the user's location. 4. Because intended users may be minors, prioritize contacting a parent, guardian, teacher, school counselor, or another trusted adult who can be physically present. 5. Encourage the user to move away from accessible means of harm and go to a place where another trusted person is present, when this can be done safely. 6. Keep the user engaged while help is being contacted. Do not abruptly return to study tasks, debate the user's feelings, or rely solely on breathing exercises and reassurance. 7. Preserve the existing empathetic tone, but do not describe explicit suicidal intent as automatically normal examination stress. 8. Add test cases covering ambiguous distress, passive death wishes, active suicidal intent, an identified plan, access to means, and an ongoing attempt. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (24)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The code only implements one narrow subset of the declared description: mistake tracking/review. It provides CLI commands to add mistakes, list them, show due reviews, mark reviews complete, and display weak-point statistics, persisting data to a local JSON file under the user's home directory. While mistake tracking is mentioned in the description, the declared primary purpose is a full-featured Gaokao AI tutor with many educational capabilities that are absent here. This is a material description-behavior mismatch because the actual code is a standalone错题本 management script, not a multi-function AI tutoring system.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The supplied code does not behave like a general-purpose Gaokao tutoring assistant across subjects. Instead, it is a narrow CLI utility for querying local score data and estimating admission options. While college application guidance is loosely related to the declared mention of 志愿填报, the implementation is limited to score-line lookup and school recommendation by score bands. Most declared educational/tutoring features are absent, making the description materially broader and misleading relative to the actual code behavior.

Missing User Warnings

High
Confidence
98% confidence
Finding
This guidance explicitly includes suicidal wording ('太难了想死') yet only instructs the agent to soothe and continue conversation, without stating that the skill is not a crisis service or directing the student to immediate human help. In the context of a student-facing exam tutor, that omission is especially dangerous because distressed minors may rely on the system during an acute crisis and be delayed from reaching qualified support.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill explicitly instructs reading and writing persistent files (`memory/gaokao-profile.json`, `memory/gaokao-mistakes.json`) but declares no tool scope or permission boundaries. That creates an authorization gap: a host may expose file capabilities more broadly than intended, and users are not given clear limits on what storage actions the skill may perform.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger phrases are broad enough to match ordinary tutoring or conversational requests, which can cause this skill to activate unexpectedly. Because the skill also performs persistent memory reads/writes, overbroad activation increases the chance of collecting or storing student data in contexts where the user did not intend to invoke this skill.

Ssd 3

Medium
Confidence
95% confidence
Finding
This section instructs the agent to read and reuse persistent student data across sessions, which creates privacy and profiling risk. In an education context the data may seem low sensitivity, but province, exam year, weaknesses, and study history can still be personal and longitudinally revealing, especially for minors.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill directs persistent storage of student profile and mistake data without a clear user-facing notice or consent flow for retention. This is risky because it collects educational profile data across sessions, and users may not realize their inputs are being written to disk and reused later.

Ssd 3

Medium
Confidence
96% confidence
Finding
The onboarding flow collects detailed student profile data and persists it without visible safeguards, consent, or minimization. Since this skill targets high school students, the context makes the privacy risk more serious because the system is profiling likely minors and tracking academic weaknesses over time.

Ssd 3

Medium
Confidence
93% confidence
Finding
Maintaining a persistent mistake log and updating user history after interactions creates a behavioral dossier of a student's academic performance. If accessed improperly or retained indefinitely, this can expose learning weaknesses and other personal patterns beyond what users expect from a tutoring interaction.

Natural-Language Policy Violations

Medium
Confidence
81% confidence
Finding
The file is entirely written in Chinese and repeatedly frames the skill around the Chinese Gaokao context, indicating a language/locale constraint. Because no opt-in or alternative language support is mentioned here, this can constitute a natural-language policy violation under the language-choice requirement.

Natural-Language Policy Violations

Medium
Confidence
86% confidence
Finding
The design explicitly makes province and exam year mandatory profile fields for all users, which creates unnecessary collection pressure for personal contextual data without an opt-in path or a clearly documented minimization boundary. While these fields are pedagogically relevant for localized guidance, forcing collection across all interactions increases privacy risk and creates a larger retained profile surface than necessary.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This markdown file presents all guidance in Chinese and does not indicate that the user can choose another language or that the skill is intended only for Chinese-speaking users. Under the language/locale policy rule, forcing a specific language without opt-in is a natural-language policy violation.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger list for mild anxiety uses common study-frustration phrases like '好难', '好烦', and '好累' that are likely to appear in ordinary tutoring conversations. In a Gaokao tutoring skill, this can cause the agent to divert from academic help into emotional-support mode too often, creating unpredictable behavior and weakening appropriate handling boundaries for more serious distress.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The high-severity trigger list mixes vague terms like '放弃' and '崩了' with explicit self-harm language like '想死' but provides no clear escalation boundary. That ambiguity is dangerous because the system may treat suicidal ideation as just another exam-stress state and respond with general comfort instead of urgent safety-oriented guidance.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The file is entirely written as a Chinese-only instruction set, including headings, prompts, and interaction text such as the post-question flow. This imposes a specific language/locale on users without documenting a choice, opt-in, or region-specific justification, which matches the language/locale policy violation category.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The entire guide is written as a prescriptive tutoring workflow in Chinese and provides only Chinese prompt examples and output structure, with no indication that users may choose another language. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown file presents all instructions and templates exclusively in Chinese, and there is no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Per the policy criteria, forcing a specific language without user opt-in is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This code’s docstring, CLI description, and runtime messages are entirely in Chinese, which imposes a specific language on users. The policy allows locale constraints only when justified or when users are given a choice, and neither is present here.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The user-facing string instructs users to send the Chinese phrase “今日复习” to access a related feature, and the rest of the CLI/help text is also exclusively in Chinese. This creates a natural-language locale constraint without opt-in or an explicit statement that the tool is intentionally limited to Chinese-speaking users.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The metadata strings are entirely in Chinese, including the description and warning text, which imposes a single language/locale in a file intended for general skill consumption. The file does not indicate that the dataset is region-specific for Chinese-speaking users only, nor does it offer any language choice or localization mechanism.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
This JSON file encodes all descriptive metadata and usage guidance in Chinese only, including the description, warning, and usage fields. For a generally reusable skill dataset, that is a natural-language locale constraint without any explicit opt-in or documented region-specific justification in the file.

Natural-Language Policy Violations

Low
Confidence
86% confidence
Finding
This markdown file applies to SQP-3, which covers language or locale policy violations in natural-language content. The document presents all instructions and output format in Chinese without indicating user opt-in, alternative language support, or a documented reason for enforcing a single language.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
This markdown file presents all instructional content in Chinese, including the title and all subject descriptions. Under the policy for natural-language violations, forcing a specific language without offering user choice can be a locale-policy issue when no opt-in or justification is provided.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
This code file contains natural-language instructions and CLI help/output entirely in Chinese, including the module docstring usage examples and subsequent user-facing messages. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless a justified locale constraint is clearly documented, which is not present here.

Static analysis

No suspicious patterns detected.