Back to skill

Security audit

Skill Preflight

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local SKILL.md preflight checker with a real validation bug, but its behavior is disclosed, purpose-aligned, and does not show malicious or high-impact authority.

Install only if you want a lightweight local preflight helper. Treat ok:true as a convenience signal, not a security guarantee, until the YAML/frontmatter parsing bug is fixed with proper hierarchy-aware validation.

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/preflight.py:43
Finding
Required dependency declaration validation can be bypassed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/preflight.py:43-56` **Vulnerability Type**: Improper validation of hierarchical YAML configuration **Risk Level**: Medium ### Vulnerable Code ```python # inline form: bins: [python3, jq] (also bins: []) m = re.search(r"bins:\s*\[(.*?)\]", block, re.DOTALL) if m: inner = m.group(1) inner = re.sub(r"#.*", "", inner) # strip trailing comments bins = [b.strip().strip("'\"") for b in inner.split(",")] return True, [b for b in bins if b] # block form: # bins: # - python3 m = re.search(r"bins:\s*\n((?:\s*-\s*.+\n?)+)", block) if m: bins = re.findall(r"-\s*(.+?)\s*$", m.group(1), re.MULTILINE) return True, [b.strip().strip("'\"") for b in bins if b.strip()] return False, [] ``` ### Technical Analysis The checker is intended to verify that `metadata.openclaw.requires.bins` is declared. However, `declared_bins()` searches the entire raw frontmatter block for any text matching `bins:`. It does not validate the YAML hierarchy, indentation, parent mappings, or whether the match appears inside a comment. Consequently, unrelated or commented content such as the following may be treated as a valid dependency declaration: ```yaml --- name: example description: Example skill version: 1.0.0 # bins: [] --- ``` An unrelated property can produce the same result: ```yaml --- name: example description: Example skill version: 1.0.0 unrelated: bins: [] --- ``` In both cases, the inline regular expression can set `declared=True` and return an empty binary list. No `bin:<name>` checks are then created. If all other checks pass, the final `all()` validation gate can emit `ok: true`, even though `metadata.openclaw.requires.bins` is absent. This is a fail-open validation flaw and contradicts the documented outcome contract that `ok:true` means every specified manifest check passed. ### Attack Path 1. An attacker or Skill ...[truncated 1298 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Parse the frontmatter with a safe YAML parser rather than searching raw YAML with unrestricted regular expressions. 2. Explicitly verify that: - `metadata` is a mapping. - `metadata.openclaw` is a mapping. - `metadata.openclaw.requires` is a mapping. - `metadata.openclaw.requires.bins` exists and is a list. - Every list element is a non-empty string with an expected binary-name format. 3. Reject malformed YAML and incorrect data types instead of treating them as absent or valid. 4. If the standard-library-only requirement must be retained, implement an indentation-aware parser for this exact hierarchy that ignores comments and quoted occurrences. Do not use an unanchored search across the complete frontmatter block. 5. Add regression tests covering: - `# bins: []` in a comment. - Top-level `bins: []`. - `bins: []` under an unrelated mapping. - Missing `metadata`, `openclaw`, or `requires` mappings. - Scalar, mapping, and null values in place of a list. - Correct inline and block-list declarations at the required hierarchy. 6. Ensure the final validation gate fails closed whenever the frontmatter cannot be parsed unambiguously. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Ae1

High
Category
analysis-evasion
Content
`SKILL.md` passed *every* check below — nothing more, nothing less.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Vague Triggers

Medium
Confidence
91% confidence
Finding
The listed natural-language triggers include phrases like "check my skill before publishing" and "validate this SKILL.md," which are fairly broad and do not define clear activation boundaries or exclusions. The file does not provide negative examples or narrower scope constraints for when these phrases should or should not invoke the skill.

Static analysis

No suspicious patterns detected.