Back to skill

Security audit

Zhua Distributed

Security checks for vulnerabilities and agentic risk

Overview

The skill is incomplete for its promised distributed features and includes under-scoped local file-writing behavior.

Review this before installing. It appears more like an unfinished distributed-deployment template than a working system, and you should not use it for real cross-device memory or task synchronization until data sharing, peer authentication, and file-write boundaries are documented and implemented. If you run init_master.py, use a simple safe instance name such as zhua-master and avoid names containing slashes or dot-dot path segments.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/init_master.py:23
Finding
User-Controlled Path Traversal and File Overwrite## Vulnerability Details **File Location**: `scripts/init_master.py`, lines 23–27 **Vulnerability Type**: Path traversal leading to arbitrary file creation or overwrite **Risk Level**: Medium ### Vulnerable Code ```python config_dir = Path.home() / ".zhua" / "distributed" config_dir.mkdir(parents=True, exist_ok=True) config_file = config_dir / f"{name}.json" with open(config_file, "w") as f: json.dump(config, f, indent=2, ensure_ascii=False) ``` The value reaching this code is supplied directly through the command-line interface: ```python parser.add_argument("--name", type=str, default="zhua-master", help="实例名称") args = parser.parse_args() init_master(args.name) ``` ### Technical Analysis The user-controlled `name` value is incorporated directly into a filesystem path without validation or normalization. Python's `pathlib` does not prevent path components such as `../` from escaping the intended `~/.zhua/distributed` directory. For example, a name of `../../.config/application/settings` produces a path equivalent to: ```text ~/.zhua/distributed/../../.config/application/settings.json ``` This resolves outside the intended configuration directory. The file is then opened with mode `w`, which creates a missing file or truncates an existing file. The operation also follows a symbolic link if the selected destination is a symlink. The fixed `.json` suffix restricts the set of practical targets, but does not prevent overwriting writable JSON files or creating files in writable directories. No check confirms that the resolved destination remains beneath `~/.zhua/distributed`. ### Attack Path 1. An attacker or untrusted automation controls the `--name` argument. 2. The attacker supplies a traversal value, for example: ```bash python3 scripts/init_master.py \ --name '../../.config/application/settings' ``` 3. The script concatenates the value with the configuration d ...[truncated 1359 chars]
Remediation
## Remediation Suggestions 1. Enforce a strict allowlist for instance names. If names are identifiers rather than paths, accept only a small safe character set: ```python import re if not re.fullmatch(r"[A-Za-z0-9_-]+", name): raise ValueError( "Instance name may contain only letters, digits, underscores, and hyphens" ) ``` 2. Resolve both the base directory and destination, then verify containment before writing: ```python config_dir = (Path.home() / ".zhua" / "distributed").resolve() config_dir.mkdir(parents=True, exist_ok=True) config_file = (config_dir / f"{name}.json").resolve() if config_file.parent != config_dir: raise ValueError("Invalid instance name") ``` 3. If overwriting existing configurations is not required, use exclusive creation mode (`"x"`) instead of `"w"` to prevent silent truncation. 4. Defend against symbolic-link targets. On supported platforms, open files using low-level flags such as `O_NOFOLLOW`, verify the opened file with `fstat`, and then write through the validated descriptor. 5. Create configuration files with restrictive permissions appropriate for their contents, such as mode `0600`, and use an atomic temporary-file-plus-rename strategy for legitimate updates. 6. Add tests covering `../`, absolute-path-like values, embedded separators, symlink destinations, existing files, and valid identifier names.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The Chinese description promises multi-instance collaboration, failover, and load balancing, yet the skill appears to stop at configuration placeholders and local file writes. That gap can mislead users into executing setup steps that affect the local filesystem or network topology while receiving none of the promised resilience or coordination guarantees.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The Chinese description promises multi-instance collaboration, failover, and load balancing, yet the skill appears to stop at configuration placeholders and local file writes. That gap can mislead users into executing setup steps that affect the local filesystem or network topology while receiving none of the promised resilience or coordination guarantees.

Lp3

Medium
Category
MCP Least Privilege
Confidence
76% confidence
Finding
The skill documents commands and behaviors that imply local file/configuration changes, but it declares no explicit tool scope or permissions boundary. In an agent ecosystem, missing scope declarations can let users or orchestrators invoke file-writing behavior without clear consent or policy enforcement, increasing the chance of unintended local modification.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill explicitly describes state synchronization and shared memory across devices but provides no warning that data may be transmitted, replicated, or exposed to other instances. In a distributed assistant context, memory and state can contain sensitive prompts, user data, or credentials, so omitting privacy and sharing warnings creates a real risk of unintended disclosure.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The operational commands for task distribution and state synchronization imply networked actions and possible transmission of task contents or memory, but the skill gives no warning about those effects. Users may run these commands assuming they are local-only, leading to unintended data movement, exposure to untrusted peers, or policy violations in restricted environments.

Natural-Language Policy Violations

Low
Confidence
63% confidence
Finding
The natural-language content is presented in a Chinese-first mixed format, and the document does not indicate that users can choose their preferred language or locale. Under the policy, forced language presentation without opt-in can be a locale-policy issue when no choice is offered.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The file’s user-facing natural-language content, including the module docstring, function descriptions, CLI description, help text, and printed output, is entirely in Chinese. This can violate a language/locale policy when no user opt-in or documented locale restriction is provided.

Static analysis

No suspicious patterns detected.