Back to skill

Security audit

OpenClaw Policy Check

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent local repository scanner, but it can read files outside the chosen scan root through symlinks and can print detected secrets verbatim in JSON output.

Install only if you are comfortable with a local scanner reading the target tree. Avoid running it on untrusted repositories that may contain symlinks, and avoid --json on codebases that may contain real credentials unless the output is kept private and handled as sensitive.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/policy_check.py:154
Finding
Scan-Root Escape Through Symbolic Links<![CDATA[ ## Vulnerability Details **File Location**: `scripts/policy_check.py:154-170` **Vulnerability Type**: Improper symbolic-link handling and unauthorized file access **Risk Level**: Medium ### Vulnerable Code ```python def should_scan_file(path: Path) -> bool: if not path.is_file(): return False if path.stat().st_size > 1024 * 1024: return False if path.suffix.lower() in TEXT_EXTENSIONS: return True if path.name in {"Dockerfile", "Makefile"}: return True return path.suffix == "" def iter_files(target: Path) -> Iterable[Path]: if target.is_file(): if should_scan_file(target): yield target return for root, dirs, files in os.walk(target): dirs[:] = [d for d in dirs if d not in DEFAULT_IGNORE_DIRS] root_path = Path(root) for filename in files: candidate = root_path / filename if should_scan_file(candidate): yield candidate ``` The resulting path is subsequently read without a containment check: ```python def scan_file(path: Path, root: Path) -> List[Dict[str, object]]: findings: List[Dict[str, object]] = [] try: text = path.read_text(encoding="utf-8", errors="ignore") except OSError: return findings ``` ### Technical Analysis `Path.is_file()`, `Path.stat()`, and `Path.read_text()` follow symbolic links. The scanner does not reject symbolic links or resolve each candidate and verify that the resolved path remains beneath the requested scan root. Consequently, an untrusted repository can contain a file symlink whose name has a permitted text extension but whose target is outside the repository. The scanner will treat the symlink as an ordinary file and read the external target. This exceeds the least privilege required for the declared repository-scanning functionality: scanning a selected repository does not require access to arbitrary files elsewhere on the host. ### A ...[truncated 1361 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Reject symbolic links before inspecting or reading candidates: ```python if path.is_symlink(): return False ``` 2. Resolve the scan root and each candidate, then enforce containment: ```python root_resolved = root.resolve() candidate_resolved = candidate.resolve() try: candidate_resolved.relative_to(root_resolved) except ValueError: continue ``` 3. Where supported, open files with operating-system options that prevent symbolic-link following, reducing time-of-check/time-of-use race exposure. 4. Catch `OSError` around `is_file()`, `stat()`, `resolve()`, and containment checks so broken or inaccessible links do not terminate the scan. 5. Add regression tests covering: - Symlinks to files outside the scan root. - Symlinks to directories outside the scan root. - Broken symlinks. - Symlink chains. - A symlink replaced between validation and reading. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/policy_check.py:176
Finding
Detected Secrets Can Be Disclosed Through Raw JSON Snippets<![CDATA[ ## Vulnerability Details **File Location**: `scripts/policy_check.py:176-184, 238-250` **Vulnerability Type**: Sensitive information exposure in scanner output **Risk Level**: Medium ### Vulnerable Code The scanner stores up to 200 characters from every matching line: ```python for line_no, line in enumerate(text.splitlines(), start=1): for rule in RULES: if rule.pattern.search(line): findings.append( { "severity": rule.severity, "rule_id": rule.rule_id, "path": rel_path, "line": line_no, "snippet": line.strip()[:200], "reason": rule.reason, } ) ``` JSON mode then emits the complete finding objects, including raw snippets: ```python if args.json: print( json.dumps( { "target": str(target), "total_findings": len(findings), "severity_breakdown": summarize(findings), "findings": findings, }, indent=2, ) ) ``` Relevant rules intentionally identify sensitive material, including: ```python Rule( "aws-secret-key", "high", r"AKIA[0-9A-Z]{16}", "Potential AWS access key detected.", ), Rule( "private-key-block", "high", r"-----BEGIN\s+(RSA|EC|OPENSSH|PRIVATE)\s+PRIVATE\s+KEY-----", "Private key material detected.", ), Rule( "dotenv-secret", "medium", r"(api[_-]?key|secret|token|password)\s*=\s*[\"']?[A-Za-z0-9_\-\/+=]{12,}", "Possible embedded secret in configuration or code.", ), ``` ### Technical Analysis The scanner's purpose requires identifying possible credentials, but it does not require reproducing their raw values. Every matching line is retained in the `snippet` field without masking. In JSON mode, this field is printed directly. As a result, credentials originally confined to source or ...[truncated 1540 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not include raw matching lines in findings by default. 2. Return only metadata such as rule identifier, severity, file path, line number, and reason. 3. If contextual output is necessary, mask the matched portion before storing it: ```python match = rule.pattern.search(line) if match: redacted = ( line[:match.start()] + "[REDACTED]" + line[match.end():] ).strip()[:200] ``` 4. For assignment-style secret rules, redact the complete value rather than only the substring matched by a broad expression. 5. Make raw snippets an explicit, clearly warned local opt-in rather than the default JSON behavior. 6. Document that scan output may contain sensitive metadata and should not be committed, uploaded, or retained in public CI logs. 7. Add tests confirming that AWS keys, tokens, passwords, and private-key content never appear verbatim in default text or JSON output. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Credential Access

High
Category
Privilege Escalation
Content
".yml",
    ".toml",
    ".json",
    ".env",
    ".ini",
    ".cfg",
    ".sql",
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
Rule(
        "hardcoded-local-credential-path",
        "low",
        r"(\.aws/credentials|id_rsa|\.ssh/config|\.env\.production)",
        "Reference to sensitive local credential path.",
    ),
]
Confidence
90% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill instructs the agent to read files, inspect repositories, and execute a Python script, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates an authorization gap where an orchestrator may permit broader file, environment, or shell access than intended, which is risky for a security-scanning skill that operates on arbitrary user-supplied paths.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The description uses broad activation language like scanning repositories for risky patterns and handling suspicious code triage or unsafe commands, which can overlap with many generic security-review requests. Without clearer activation boundaries, the skill may be invoked in contexts broader than intended, increasing the chance it runs shell-backed scanning on untrusted or overly broad targets.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The default prompt contains a broad natural-language trigger phrase ('run a preflight scan on this repo and summarize risky findings') while the policy explicitly allows implicit invocation. That combination can cause the skill to activate on ordinary security-review or repo-analysis requests without clear user intent, which expands the skill’s reach and may route sensitive repository contents into an automated scanning workflow unexpectedly.

Static analysis

No suspicious patterns detected.