Back to skill

Security audit

opencli-autofix

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent repair purpose, but it should be reviewed because it edits local adapter code and can submit unredacted diagnostic text through an unsafe GitHub command pattern.

Install only if you are comfortable with an agent editing OpenCLI adapter files on disk. Review any adapter diff before keeping it, and do not approve upstream issue filing unless the draft is redacted and the command uses a safe body-file or equivalent argument-passing method rather than interpolating diagnostic text into shell syntax.

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

Error
Location
SKILL.md:205
Finding
Unsafe interpolation and publication of untrusted diagnostic content in GitHub issue command<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 205–241 **Vulnerability Type**: Command injection and sensitive information disclosure **Risk Level**: High ### Vulnerable Code ```markdown 1. Prepare the issue content from the RepairContext you already have: - **Title:** `[autofix] <site>/<command>: <error_code>` (e.g. `[autofix] zhihu/hot: SELECTOR`) - **Body** (use this template): ```markdown ## Summary OpenCLI autofix repaired this adapter locally, and the retry passed. ## Adapter - Site: `<site>` - Command: `<command>` - OpenCLI version: `<version from opencli --version>` ## Original failure - Error code: `<error_code>` ~~~ <error_message> ~~~ ## Local fix summary ~~~ <1-2 sentence description of what you changed and why> ~~~ _Issue filed by OpenCLI autofix after a verified local repair._ ``` 2. **Ask the user before filing.** Show them the draft title and body. Only proceed if they confirm. 3. If the user approves and `gh auth status` succeeds: ```bash gh issue create --repo jackwener/OpenCLI \ --title "[autofix] <site>/<command>: <error_code>" \ --body "<the body above>" ``` ``` ### Technical Analysis The Skill instructs the agent to place values from `RepairContext`, including `<error_message>`, `<site>`, `<command>`, and `<error_code>`, directly into a shell command. These diagnostic values may originate from an untrusted website, API response, page content, or adapter failure. The generated issue body is embedded in a double-quoted Bash argument. The instructions do not require shell-safe encoding or use of a non-interpreted input channel. If an agent constructs the command by substituting the values into the command text, shell syntax in a malicious diagnostic message—such as command substitutions, embedded quotes, backticks, or control operators—can alter how the shell interprets the resulting command. The issue body can also contain sensitive diagnostic information. Error messages may expose authentica ...[truncated 2529 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Do not interpolate issue content into executable shell text.** - Write the issue body to a securely created temporary file. - Pass it with `gh issue create --body-file <path>`. - Supply the title and other values as separately escaped arguments rather than constructing a shell command through textual substitution. 2. **Use a safe argument-passing mechanism.** - Prefer direct process execution with an argument array when supported. - If Bash must be used, place dynamic values in environment variables or positional parameters and quote every expansion. - Do not use `eval`, command-string concatenation, or generated shell syntax. 3. **Redact diagnostics before displaying or submitting them.** - Remove authorization headers, cookies, API keys, access tokens, session identifiers, signed URLs, query parameters, email addresses, and other personal data. - Replace detected sensitive values with explicit placeholders such as `[REDACTED_TOKEN]`. - Include only the minimum error details required to reproduce the adapter defect. 4. **Treat all `RepairContext` fields as untrusted.** - Reject or encode control characters, embedded NULs, command substitutions, backticks, and unexpected newlines. - Validate the site, command, and error-code fields against restrictive allowlists before using them in a title or command argument. 5. **Strengthen user review.** - Show the final redacted title and body exactly as they will be submitted. - Warn the user that the issue may be public. - Require confirmation after redaction and immediately before network submission. 6. **Use a safer documented command pattern**, for example: ```bash tmp_body="$(mktemp)" trap 'rm -f "$tmp_body"' EXIT chmod 600 "$tmp_body" cat >"$tmp_body" <<'SAFE_ISSUE_BODY' <redacted and safely prepared issue body> SAFE_ISSUE_BODY gh issue create \ --repo jackwener/OpenCLI \ --title "$SAFE_TITLE" \ --body-file "$tmp_body" ``` ...[truncated 245 chars]
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • 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)

Session Persistence

Medium
Category
Rogue Agent
Content
---
name: opencli-autofix
description: Automatically fix broken OpenCLI adapters when commands fail. Load this skill when an opencli command fails — it guides you through diagnosing the failure via OPENCLI_DIAGNOSTIC, patching the adapter, retrying, and filing an upstream GitHub issue after a verified fix. Works with any AI agent.
allowed-tools: Bash(opencli:*), Bash(gh:*), Read, Edit, Write
---

# OpenCLI AutoFix — Automatic Adapter Self-Repair
Confidence
83% confidence
Finding
The skill grants persistent write capabilities via Read/Edit/Write and then instructs the agent to modify adapter source files, including paths that may live under the user's home directory. Because the adapter path is taken from diagnostic output and treated as authoritative, a compromised or malformed diagnostic source could steer the agent into persisting unintended code changes on disk.

Missing User Warnings

Low
Confidence
88% confidence
Finding
The skill instructs the agent to redirect stderr to `diagnostic.json`, which creates or overwrites a local file, and later directs it to patch the adapter source at `RepairContext.adapter.sourcePath`. Although the document describes the workflow, it does not explicitly warn the user that local files will be written and code will be modified on disk as part of execution.

Static analysis

No suspicious patterns detected.