Back to skill

Security audit

Zh Semantic Enhancer

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly performs local Chinese text analysis, but it bundles under-disclosed monetization and self-rewriting utilities that can alter installed skill code and store local usage data.

Install only if you are comfortable reviewing the bundled monetization scripts and local state files. Avoid running scripts/revenue_optimize.py unless you intentionally want it to rewrite an installed skill, and consider removing or fixing the credit/trial persistence code before using this in a shared or production environment. The advertised limited-time offer ended on 2026-03-31, so the pricing copy is stale as of 2026-09-12.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/credit_system.py:14
Finding
User-Controlled Path Traversal Enables Arbitrary JSON File Access and Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `scripts/credit_system.py`, lines 14–18 and 31–33 **Vulnerability Type**: Path traversal and unsafe file storage **Risk Level**: High ### Vulnerable Code ```python def __init__(self, user_id: str): self.user_id = user_id self.credit_file = Path(f"~/.openclaw/zh_semantic_credits/{user_id}.json").expanduser() self.credit_file.parent.mkdir(parents=True, exist_ok=True) self.data = self._load() def _save(self): with open(self.credit_file, 'w', encoding='utf-8') as f: json.dump(self.data, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The `user_id` value is interpolated directly into a filesystem path without validation, normalization, or a canonical containment check. A value containing traversal components such as `../` can cause `self.credit_file` to resolve outside the intended `~/.openclaw/zh_semantic_credits` directory. The constructor also creates the resolved parent directories. Subsequent calls to `_load()` and `_save()` can therefore read from or overwrite a caller-selected path ending in `.json`, subject to the operating-system permissions of the Skill process. There is no protection against symbolic links. If an attacker can place a symlink at the calculated location, writes may also be redirected to another file. ### Attack Path 1. An attacker reaches code that constructs `CreditSystem` and supplies a crafted `user_id`. 2. The value contains sufficient `../` components to escape the intended credit directory. 3. `Path.expanduser()` expands the home directory but does not remove or reject traversal. 4. `mkdir(parents=True)` creates attacker-selected parent directories when possible. 5. The attacker triggers `use_credit()` or `add_credits()`, which invokes `_save()`. 6. The resolved `.json` file is created or overwritten with the credit-state document. Reading an existing target through `_load()` requires it to contain valid JSON. Creating or overwriting ...[truncated 516 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate `user_id` against a strict allowlist, such as `^[A-Za-z0-9_-]{1,64}$`. 2. Prefer deriving the filename from a cryptographic hash of the identifier rather than using the raw identifier. 3. Resolve the storage root and target path before use and verify that the target remains inside the storage root. 4. Reject absolute paths, traversal components, path separators, null bytes, and unexpected Unicode separator characters. 5. Refuse symbolic-link targets and use secure file-opening flags where supported. 6. Create the storage directory with mode `0700` and state files with mode `0600`. 7. Use atomic writes through a securely created temporary file followed by an in-directory rename. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/credit_system.py:35
Finding
Credit Balance Can Be Forged Without Authorization or Payment Verification<![CDATA[ ## Vulnerability Details **File Location**: `scripts/credit_system.py`, lines 35–52 **Vulnerability Type**: Missing authorization, payment verification, and numeric validation **Risk Level**: High ### Vulnerable Code ```python def get_balance(self) -> int: return self.data["credits"] - self.data["used"] def use_credit(self, amount: int = 1) -> bool: if self.get_balance() >= amount: self.data["used"] += amount self._save() return True return False def add_credits(self, amount: int, payment_method: str = ""): self.data["credits"] += amount self.data["purchases"].append({ "amount": amount, "date": datetime.now().isoformat(), "method": payment_method }) self._save() ``` ### Technical Analysis `add_credits()` accepts an arbitrary amount and payment-method string without authenticating the caller or verifying a payment event. Any caller with access to the class can grant credits directly. `use_credit()` does not enforce that `amount` is a positive integer. Passing a negative value satisfies the balance comparison in normal cases and subtracts from `used`, increasing the calculated balance: ```text balance = credits - used used = used + negative_amount ``` The state is also stored as unsigned, editable JSON. No integrity protection prevents a local actor with file access from directly changing `credits`, `used`, or purchase records. ### Attack Path A caller can bypass credit enforcement using either of these paths: 1. Instantiate `CreditSystem` for the selected account. 2. Call `add_credits()` with an arbitrary positive amount and an unverified payment-method label. 3. The balance is increased and persisted without any proof of payment. Alternatively: 1. Call `use_credit()` with a negative amount. 2. The balance check succeeds because the current balance is generally greater than a negative value. 3. The negative amount decreases `used`. 4. The calculated remaining balan ...[truncated 698 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Perform entitlement and balance updates in an authenticated server-side service. 2. Grant credits only after verifying a signed payment-provider event, transaction identifier, amount, currency, recipient, and confirmation status. 3. Enforce `type(amount) is int` and a bounded positive range for all credit mutations. 4. Make credit additions an internal privileged operation rather than a public unrestricted method. 5. Protect stored balances with authenticated integrity controls or use a transactional database with access control. 6. Use atomic transactions and locking to prevent concurrent balance corruption. 7. Maintain immutable audit records and idempotency keys for payment events. 8. Reject duplicate payment transaction identifiers. ]]>

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/revenue_optimize.py:54
Finding
Revenue Optimization Utility Destructively Rewrites Installed Skill Code and Instructions<![CDATA[ ## Vulnerability Details **File Location**: `scripts/revenue_optimize.py`, lines 54–73, 153–156, 247–250, 328–331, 399–402, 410–481, and 489–506 **Vulnerability Type**: Local tool hijacking through destructive self-modification **Risk Level**: High ### Vulnerable Code ```python def evolve_for_revenue(self) -> Dict[str, Any]: print("💰 Starting revenue optimization evolution") print("=" * 60) changes = [] changes.extend(self._add_tiered_pricing()) changes.extend(self._add_premium_features()) changes.extend(self._add_api_credit_system()) changes.extend(self._add_enterprise_features()) changes.extend(self._optimize_marketing_copy()) new_version = self._bump_version() ``` Representative destructive write: ```python pricing_file = self.skill_path / "scripts" / "pricing.py" with open(pricing_file, 'w', encoding='utf-8') as f: f.write(pricing_code) ``` Instruction-file rewrite: ```python with open(skill_md, 'w', encoding='utf-8') as f: f.write(content) ``` Hard-coded execution target: ```python def main(): skill_path = "/home/node/.openclaw/workspace/skills/zh-semantic-enhancer" engine = RevenueOptimizationEngine(skill_path) analysis = engine.analyze_revenue_potential() result = engine.evolve_for_revenue() ``` ### Technical Analysis When run directly, the utility unconditionally invokes `evolve_for_revenue()` against a hard-coded installed Skill directory. It opens executable Python modules and `SKILL.md` using truncating write mode, replacing their current contents with embedded templates and marketing material. The affected files include pricing, premium-feature, credit-system, and enterprise-feature modules, as well as the Skill instruction document. The operation has no confirmation prompt, backup, dry-run default, source-integrity check, ownership check, symlink check, or atomic replacement. This behavior can replace code that was previously reviewed, patched, or locally customiz ...[truncated 1255 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the self-modifying utility from the production Skill package. 2. If code generation is required, write only to a new, explicitly supplied output directory. 3. Default to dry-run mode and present a complete diff before any change. 4. Require explicit confirmation for each affected file. 5. Create verified backups and support safe rollback. 6. Refuse symbolic links and verify that all resolved targets remain inside the selected project root. 7. Use atomic file replacement and preserve restrictive permissions. 8. Never modify an installed `SKILL.md` or executable module during normal operation. 9. Verify the expected hash or version of a file before replacing it to avoid overwriting unknown modifications. 10. Replace the hard-coded workspace path with an explicit command-line argument. ]]>

T08 · Insecure Dependencies

Warning
Location
README.md:17
Finding
Unpinned npx Installation Command Exposes Users to Mutable Supply-Chain Code<![CDATA[ ## Vulnerability Details **File Location**: `README.md`, lines 17–19 **Vulnerability Type**: Unpinned package download and execution **Risk Level**: Medium ### Vulnerable Code ```bash npx clawhub install zh-semantic-enhancer ``` ### Technical Analysis The documented installation command invokes `npx` without an exact package version or integrity pin. Depending on local cache and npm configuration, `npx` may download executable package content from a registry at installation time. Because package resolution is mutable, the code executed by future users may differ from the code that was originally reviewed. The documentation does not identify the expected registry, package digest, signature, or verification procedure. No evidence was found that the currently referenced package is malicious. The vulnerability is the unsafe, mutable installation mechanism. ### Attack Path 1. A user follows the README installation instructions. 2. `npx` resolves the unpinned `clawhub` package using the configured package registry. 3. The package is downloaded if it is not already available locally. 4. Downloaded package code executes with the user's privileges. 5. A compromised registry account, malicious replacement release, registry redirection, or dependency compromise could therefore execute code during installation. ### Impact Assessment A compromised resolved package can execute with the privileges of the user running the installation command. Depending on those privileges, it could access user files, environment variables, credentials, project data, or other resources available to the installer process. The finding does not establish an active compromise; it identifies exposure to a mutable third-party supply chain. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the installer to an exact reviewed version. 2. Document the expected package registry and avoid ambiguous registry configuration. 3. Publish cryptographic checksums or signed release artifacts. 4. Instruct users to verify signatures or integrity hashes before execution. 5. Prefer a package-lock mechanism with integrity metadata. 6. Avoid installation workflows that implicitly download and execute the newest available package. 7. Periodically review the installer package and its transitive dependencies. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
index.py:167
Finding
Persistent User Identifiers and Usage Records Are Stored Without Permission Hardening<![CDATA[ ## Vulnerability Details **File Location**: `index.py`, lines 167–198 and 201–215 **Vulnerability Type**: Weakly protected persistent user tracking **Risk Level**: Low ### Vulnerable Code ```python class TrialManager: def __init__(self, skill_name: str): self.skill_name = skill_name self.trial_dir = os.path.expanduser("~/.openclaw/skill_trial") self.trial_file = os.path.join(self.trial_dir, f"{skill_name}.json") self.max_free_calls = 100 os.makedirs(self.trial_dir, exist_ok=True) def _load_trial_data(self) -> Dict[str, Any]: if os.path.exists(self.trial_file): try: with open(self.trial_file, 'r', encoding='utf-8') as f: return json.load(f) except: return {} return {} def _save_trial_data(self, data: Dict[str, Any]): try: with open(self.trial_file, 'w', encoding='utf-8') as f: json.dump(data, f, ensure_ascii=False, indent=2) except: pass ``` User identifier persistence: ```python def use_trial(self, user_id: str) -> bool: if not user_id: return False data = self._load_trial_data() if user_id not in data: data[user_id] = {'used_calls': 0} data[user_id]['used_calls'] += 1 self._save_trial_data(data) return True def on_user_input(text: str, context: dict = None) -> dict: context = context or {} user_id = context.get("user_id", "") enhancer = ZHSemanticEnhancer() return enhancer.process(text, user_id) ``` ### Technical Analysis For non-demo operation, the Skill stores user identifiers as JSON object keys and records cumulative call counts in the user's home directory. The directory and file are created using ambient process defaults rather than explicit restrictive modes. The implementation has no retention limit, pseudonymization, deletion mechanism, consent control, file locking, or atomic rep ...[truncated 1304 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Clearly disclose local identifier and usage-count persistence. 2. Provide an option to disable persistence and a supported deletion mechanism. 3. Replace raw identifiers with keyed, pseudonymous identifiers where possible. 4. Apply retention limits and automatically remove stale records. 5. Create the directory with mode `0700` and the file with mode `0600`. 6. Use file locking or a transactional local database for concurrent access. 7. Write updates atomically through a securely created temporary file and rename. 8. Replace blanket exception handling with narrow exceptions and safe diagnostic logging. 9. Minimize stored data to the least information required for trial enforcement. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (25)

Context-Inappropriate Capability

High
Confidence
97% confidence
Finding
This script does not just analyze a skill; it rewrites the target skill to add pricing, premium features, enterprise features, and a persistent credit-tracking system under the user's home directory. Those behaviors materially expand the skill’s scope and data handling without user consent, making the script capable of silently monetizing or altering a deployed skill in ways unrelated to its apparent semantic-processing purpose.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The title and description state that the skill is specifically designed to make the system 'understand Chinese,' which implies a fixed language/locale orientation. Under the language/locale policy, this should either be presented as an explicit opt-in choice or clearly justified as a region-specific tool; neither is stated here.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding
The README instructs users to run `npx clawhub install zh-semantic-enhancer` without pinning a specific version, which can cause users to fetch and execute whatever package version is current at install time. In a supply-chain compromise or malicious update scenario, this increases the chance of unintended code execution on the user's system.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The README explicitly declares the skill language as "zh-CN" and describes it as making OpenClaw "truly understand Chinese," without offering any user language choice or stating that use is limited to users who intentionally selected a Chinese-only skill. This is a natural-language locale policy concern because it imposes a fixed locale rather than presenting it as an opt-in preference.

Context-Inappropriate Capability

Medium
Confidence
91% confidence
Finding
With no manifest available, the module docstrings and function names indicate a Chinese semantic understanding/enhancement skill. In addition to text analysis, the code reads billing-related API credentials from environment variables and later enforces a paid/trial usage model with per-user accounting, which is a separate monetization capability not justified by the stated analysis role in the code documentation.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The class and method documentation explicitly define the skill as processing Chinese text only, and the instance sets `self.lang = 'zh'`. There is no natural-language indication that users can choose another language or must opt in to this locale restriction, which is a language/locale policy concern.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill persistently stores per-user trial usage in ~/.openclaw/skill_trial without integrity protection, access control hardening, or disclosure. Even though the data is limited, it creates an unnecessary local tracking artifact tied to user identifiers and can expose privacy information or be tampered with by other local processes.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill writes trial usage data to a user-local file with no user-facing warning, consent, or retention explanation. Silent persistence of identifiers and usage counts is privacy-relevant and can surprise users or violate host expectations, especially in a text-processing skill where local tracking is not obvious.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The package description explicitly defines the skill as a Chinese semantic understanding enhancement capability, which indicates a language-specific constraint. In this manifest there is no accompanying note that the skill is optional, user-selected, or limited to a justified region-specific context.

Natural-Language Policy Violations

Medium
Confidence
78% confidence
Finding
The file description and storage path use Chinese-specific wording (for example, 'API积分系统' and 'zh_semantic_credits'), which suggests the skill is scoped to a specific language/locale. There is no natural-language indication that users can opt into this locale or choose an alternative.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The module title and docstrings prominently use Chinese-language labels such as "企业版功能" and "自定义词典 - 企业版" without any indication that users may choose another language or that the skill is region-specific. This can violate language/locale policy because the skill implicitly fixes its interaction language rather than making it optional or explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The module title and surrounding documentation explicitly frame the skill as focused on Chinese intent understanding, and later functions are hard-coded for Chinese normalization and cultural interpretation. This can violate language/locale policy when a skill implicitly forces a specific language behavior without offering user choice or clearly documenting a justified regional scope.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The file’s natural-language strings and documentation are predominantly in Chinese, including module descriptions, comments, and domain vocabularies, with no indication that users may choose another language or locale. This can violate language/locale policy when a skill effectively constrains usage to a specific language without opt-in.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
This Python file contains natural-language strings and documentation exclusively in Chinese, including the module docstring and pricing tier names/features. Under the policy criteria, forcing a specific language without user opt-in or documented regional justification is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The file header and embedded descriptions frame the skill as a Chinese semantic enhancement system and all generated user-facing content is fixed to Chinese/bilingual output without offering a language choice. This can violate language or locale policy when the skill implicitly forces a specific language experience rather than letting the user opt in or select their preference.

Intent-Code Divergence

Medium
Confidence
89% confidence
Finding
The docstring and method name state that the function analyzes revenue potential, but the implementation fixes revenue_score to 30 and merely scans index.py for strings like 'subscription' and 'premium'. This is an intent mismatch because the code presents itself as substantive analysis while performing only superficial keyword checks.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script writes new modules directly into the skill directory without warning, confirmation, or transactional safeguards. In an agent-skill context, silent modification of executable files is dangerous because it can alter runtime behavior, introduce unreviewed capabilities, and make supply-chain style changes that a user may never notice.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The generated credit system persists per-user usage and purchase history to a local file path in the home directory without any disclosure, consent flow, access control, or retention policy. Even if the stored fields are limited, undisclosed persistence of monetization and usage data creates privacy risk and can expose behavioral or financial metadata to other local processes or future components.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The module description states it is a Chinese expressions detection module, and the implementation only recognizes Chinese-specific idioms, slang, and proverbs. For the policy category, this is a natural-language locale constraint without any visible user opt-in or documented justification in the file.

Missing User Warnings

Low
Confidence
86% confidence
Finding
This markdown file presents the skill as specifically built for Chinese semantics, but does not include any user-facing warning that the skill is language-specific and may not work correctly for other languages. Because markdown files should warn about behavior that can materially affect outputs, the lack of a clear limitation notice is a quality/safety gap.

Unpinned Dependencies

Low
Category
Supply Chain
Content
"entry_point": "on_user_input"
  },
  "dependencies": {
    "jieba": "^0.42.1",
    "hanlp": "^2.1.0"
  },
  "scripts": {
Confidence
88% confidence
Finding
The dependency uses a caret range, which allows newer compatible versions to be installed without review. This can introduce supply-chain risk if a future release is compromised, malicious, or incompatible, especially for a skill that processes untrusted user input through third-party NLP libraries.

Unpinned Dependencies

Low
Category
Supply Chain
Content
},
  "dependencies": {
    "jieba": "^0.42.1",
    "hanlp": "^2.1.0"
  },
  "scripts": {
    "test": "python -m pytest tests/"
Confidence
88% confidence
Finding
The dependency uses a caret range, allowing automatic adoption of future 2.x releases. This increases exposure to supply-chain compromise or unexpected behavior in a library that may handle complex model loading and text processing paths.

Missing User Warnings

Low
Confidence
88% confidence
Finding
The _save method persists usage and purchase data to ~/.openclaw/zh_semantic_credits/{user_id}.json, which is a file write affecting user data. The code provides no confirmation prompt, logging, print statement, or explanatory comment/docstring warning that local account data will be stored on disk.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The module docstring and method/class docstrings include Chinese text such as '订阅管理器' and '获取活跃订阅' without any indication that the user can choose their preferred language or locale. This can violate a language/locale policy when a skill implicitly forces one language in user-facing text.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The module name and documentation explicitly define the skill as a Chinese tokenization module, and all user-facing strings in the test output are in Chinese. Per the policy, forcing a specific language can be a locale-policy issue when there is no opt-in or documented region-specific justification in the file.

Static analysis

No suspicious patterns detected.