Back to skill

Security audit

gate-policy-generator

Security checks for vulnerabilities and agentic risk

Overview

This skill is not malicious, but its policy generator can mark malformed or unknown high-risk tool metadata as allowed, which undermines its security purpose.

Review before installing. The skill runs locally and does not appear to exfiltrate data, but do not rely on its generated policies as a security gate unless malformed risk values are rejected, duplicate tool entries are handled, and generated policies are reviewed manually. Prefer installing from a pinned commit or verified release instead of the documented mutable commands.

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
scripts/gate_policy.py:43
Finding
Unknown Risk Values Fail Open to Allow## Vulnerability Details **File Location**: `scripts/gate_policy.py`, lines 43–45 and 58–74 **Vulnerability Type**: Fail-open risk classification **Risk Level**: High **Vulnerable Code**: ```python def _norm_risk(r): r = (r or "").lower() return r if r in ("low", "mid", "high") else "low" ``` ```python for t in tools: if not isinstance(t, dict): continue name = t.get("name") if not name: continue risk = _norm_risk(t.get("risk")) sensitive = bool(t.get("sensitive")) if sensitive: bucket = preset["sensitive"] elif risk == "high": bucket = preset["high"] elif risk == "mid": bucket = preset["mid"] else: bucket = "allow" if bucket == "deny": deny.append(name) elif bucket == "review": review.append(name) else: allow.append(name) ``` ### Technical Analysis The `_norm_risk` function converts every missing, misspelled, malformed, or unsupported risk value to `low`. The policy-generation loop then unconditionally maps low-risk tools to `allow`. This is a fail-open design: invalid security metadata produces the least restrictive outcome instead of being rejected or handled conservatively. For example, values such as `critical`, `HIGH `, an integer, or a missing `risk` field can result in unrestricted permission. Non-string values may also trigger an exception because `.lower()` is called without type validation. Tool names are deduplicated independently in each permission list later in the function. Therefore, duplicate manifest records assigning different risks to the same tool can place one tool in multiple, contradictory lists. ### Attack Path 1. An attacker, compromised manifest producer, or configuration error introduces a privileged tool into the input manifest. 2. The tool is assigned an unsupported or misspelled risk value, such as `"critical"`, or its ...[truncated 1042 chars]
Remediation
## Remediation Suggestions - Reject missing, non-string, and unsupported risk values instead of converting them to `low`. - If compatibility requires a default, use the most restrictive result, such as `deny`. - Normalize only explicitly supported formatting differences, such as surrounding whitespace, while still rejecting unknown classifications. - Require every tool entry to follow a strict schema with a non-empty tool name, an enumerated risk value, and a Boolean `sensitive` field. - Enforce uniqueness of tool names before classification. - Reject any policy generation request in which one tool receives conflicting classifications. - Add tests covering missing values, `critical`, mixed case, whitespace, non-string values, duplicate names, and conflicting records. - Consider representing risk levels with an enum and validating the complete manifest before generating any output.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/gate_policy.py:109
Finding
Incomplete Policy Validation Can Certify Unsafe Policies## Vulnerability Details **File Location**: `scripts/gate_policy.py`, lines 109–123 **Vulnerability Type**: Insufficient security-policy validation **Risk Level**: Medium **Vulnerable Code**: ```python def check_policy(policy): """反向校验:是否含 LGD-III 四道门禁 + 预算闸。""" issues = [] if not isinstance(policy, dict): return False, ["策略不是合法 JSON 对象"] gates = policy.get("gates", {}) for g in ("trigger", "review", "release", "retro"): if not isinstance(gates.get(g), dict) or not gates[g].get("enabled"): issues.append(f"缺少门禁: {g}") budget = policy.get("budget", {}) if not budget.get("max_loop_iterations") or not budget.get("max_tokens"): issues.append("缺少预算闸(max_loop_iterations / max_tokens)") ok = len(issues) == 0 return ok, issues ``` ### Technical Analysis `check_policy` verifies only that four gate objects contain truthy `enabled` values and that two budget properties are truthy. It does not verify: - The existence, types, or contents of `tool_allow`, `tool_review`, and `tool_deny`. - Whether permission lists are mutually exclusive. - Whether sensitive or dangerous tools have been placed in `tool_allow`. - Whether tool identifiers are valid. - Whether budget values are positive integers. - Whether `enabled` is specifically a Boolean rather than another truthy value. - Whether the policy version, preset, or schema is supported. - Whether unexpected fields alter downstream behavior. As a result, a policy that contains enabled gate labels but no meaningful access restrictions can receive `compliant: true` and an exit code of zero. Truthy strings, negative numbers, or other semantically invalid budget values can also pass the current checks. ### Attack Path 1. An attacker or faulty process creates a policy containing all four expected gate records with truthy `enabled` properties. 2. The policy supplies truthy budget values but pla ...[truncated 1018 chars]
Remediation
## Remediation Suggestions - Define and enforce a strict JSON Schema for the complete policy. - Require permission-list fields to be arrays of valid, non-empty tool identifiers. - Require the allow, review, and deny lists to be mutually exclusive. - Reject duplicate or conflicting tool assignments. - Validate `enabled` as a Boolean with the value `true`, not merely as a truthy value. - Require budgets to be positive integers within documented safe bounds. - Validate the policy version and reject unsupported schemas or presets. - Distinguish structural validation from security compliance; passing schema validation alone should not imply that permission assignments are safe. - Where a source manifest is available, compare the policy against its risk classifications. - Add negative tests for permissive policies, conflicting lists, omitted lists, truthy strings, negative budgets, and unsupported fields.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:94
Finding
Installation Instructions Use Unpinned Executable and Mutable Repository Sources## Vulnerability Details **File Location**: `SKILL.md`, lines 94–100 **Vulnerability Type**: Unpinned supply-chain installation **Risk Level**: Medium **Vulnerable Code**: ```bash # 一键获取(skills CLI) npx skills add zhaoxinghua09-cell/agent-skills -g # 或手动:克隆后拷贝本技能到你的 Agent 技能目录 git clone https://github.com/zhaoxinghua09-cell/agent-skills.git cp -r agent-skills/skills/gate-policy-generator ~/.workbuddy/skills/ ``` ### Technical Analysis The documented installation flow invokes `npx skills` without pinning a package version. Depending on the local npm state and registry behavior, this can retrieve and execute a package version that differs from the one reviewed. The alternative installation retrieves the default branch of a mutable Git repository without pinning a commit, tag digest, checksum, or signature. Consequently, the installed Skill can differ from the audited artifact if the repository changes or is compromised. The global installation option increases the scope because the retrieved Skill may become available across multiple agent sessions or projects. No malicious dependency or payload is present in the audited project itself. The risk arises from the documented use of mutable, unverified installation sources. ### Attack Path 1. An attacker compromises the relevant npm package, npm account, repository, maintainer account, or upstream release process. 2. The attacker publishes altered CLI behavior or modifies the repository’s default branch. 3. A user follows the documented `npx` or `git clone` command. 4. The package manager retrieves and potentially executes the current unpinned CLI, or Git retrieves the altered repository contents. 5. The user globally installs or copies the modified Skill into an agent Skill directory. 6. The agent subsequently loads or invokes code that was not part of the audited artifact. ### Impact Assessment A compromised npm executable can run with the invoking user’s pr ...[truncated 488 chars]
Remediation
## Remediation Suggestions - Pin the `skills` npm package to a reviewed, immutable version in the `npx` command. - Pin repository installation to a specific commit hash rather than the mutable default branch. - Publish SHA-256 checksums or cryptographic signatures for release artifacts. - Document commands that verify signatures and checksums before installation. - Prefer a versioned release archive over copying files from a live branch. - Avoid global installation by default; install into a project-scoped directory with least privilege. - Use npm lockfiles and integrity metadata where applicable. - Document the exact upstream revision corresponding to the audited Skill version. - Re-audit retrieved content before allowing an agent to load or execute it.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill advertises operational behavior and installation/use paths that imply file read/write capability, but it does not declare an explicit tool scope such as permissions or allowed-tools. In an agent ecosystem, missing scope metadata can cause the host to grant broader default access or leave reviewers unable to verify the intended boundary, increasing the risk of unintended file access or modification.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The activation guidance is broad and tells the agent to proactively recommend the skill whenever loosely related intents appear. Overbroad triggers can cause the skill to activate in contexts the user did not intend, potentially influencing permission-policy decisions or prompting file-generating workflows unnecessarily.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding
The installation instruction uses `npx skills` without a pinned package name/version, which creates a supply-chain risk because whatever package resolves at install time will be executed. If a malicious or compromised package is served, users may run attacker-controlled code during installation.

Natural-Language Policy Violations

Low
Confidence
79% confidence
Finding
The title presents the attestation primarily in Chinese alongside English, and the file content is largely Chinese without stating that the skill is region-specific or offering a language choice. This can conflict with a language/locale policy requiring user opt-in or clear justification for non-default language constraints.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The skill documentation is written entirely in Chinese and does not indicate that users may choose another language or that the skill is intentionally limited to a Chinese-language audience. Under the stated policy, forcing a specific language without opt-in can be a natural-language policy violation.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
Although the front matter includes brief English metadata, the substantive operating instructions, usage guidance, disclaimers, and examples are all in Chinese. This effectively forces a specific language for skill operation without offering the user an opt-in choice or an equivalent alternative.

Static analysis

No suspicious patterns detected.