Back to skill

Security audit

Git Repo to Book

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real book-generation workflow, but it can keep running later, expose API keys to child processes, and broadly commit or push repository changes.

Install only after reviewing the workflow carefully. Run it in a dedicated repository or branch, disable the cron safety-net behavior, avoid private source material with DeepWiki unless you explicitly approve the disclosure, do not export global API keys to all subagents, pin any optional dependencies, and review git status and diffs before any commit or push.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
Findings (5)

T06 · System Persistence

Error
Location
SKILL.md:205
Finding
Unattended Pipeline Resumption Through a Persistent Scheduled Task<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:205-208` **Vulnerability Type**: Persistent scheduled execution **Risk Level**: High ### Vulnerable Code ```text To mitigate, set a cron safety net after spawning: cron: "Check book pipeline state in WORKLOG.md. If last phase completed but next phase not started, resume the pipeline." (fire 15 minutes after spawn) ``` ### Technical Analysis The skill instructs the agent to create a cron-based safety net that resumes the book pipeline after the initiating interaction. A scheduled task operates outside the immediate skill execution and may continue to affect later sessions. The instruction does not specify: - Explicit user authorization before installing the task. - A unique identifier tied to the current project. - Automatic removal after completion, cancellation, or failure. - A maximum number of executions. - Validation that the project and its authorization state remain unchanged. - A requirement to reconfirm potentially costly or externally visible actions. Because the resumed pipeline can spawn agents, consume paid API services, modify files, and eventually publish content, this persistence mechanism crosses the normal lifetime boundary of a skill invocation. ### Attack Path 1. The skill is activated for a book-generation project. 2. Nested subagents are unavailable, causing the workflow to use Director-controlled fallback mode. 3. The skill creates the recommended cron safety-net task. 4. The current session stops, is interrupted, or the user assumes the workflow has been paused. 5. Fifteen minutes later, the scheduled task reads the project-controlled `WORKLOG.md`. 6. If the log appears to indicate that another phase should start, the task resumes the pipeline without renewed user approval. 7. The resumed workflow may spawn agents, invoke paid APIs, modify repository content, and reach its commit-and-push phase. A modified, stale, or incorrectly interpreted `WORKLOG.md` could cause e ...[truncated 583 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the instruction to create an operating-system or platform-level cron task. 2. Use an application-scoped, one-shot continuation mechanism that cannot survive project cancellation. 3. Require explicit user consent before scheduling any delayed execution. 4. Assign each continuation job a unique project identifier and verify the repository path, owner, and workflow state before resuming. 5. Automatically delete the job after its first execution, successful completion, cancellation, or expiration. 6. Add a short expiration time and a strict maximum execution count. 7. Require renewed approval before agent spawning, paid API calls, commits, pushes, or other externally visible operations. 8. Treat `WORKLOG.md` as untrusted state: validate its schema and never use arbitrary text from it as executable instructions. ]]>

T01 · Skill Instruction Hijacking

Note
Location
SKILL.md:532
Finding
Mandatory Promotional Link Injection Into Generated Chapters<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:532-550` **Vulnerability Type**: Output instruction hijacking **Risk Level**: Low ### Vulnerable Code ```markdown Every chapter must end with a metadata block providing provenance and reproducibility information. This is critical because source repos evolve fast — readers need to know which version the chapter describes. **Template (append to end of each chapter):** | Field | Value | |-------|-------| | **Subject Repo** | [owner/repo](https://github.com/owner/repo) | | **Subject Repo Commit** | [`abc1234`](https://github.com/owner/repo/commit/abc1234) | | **Subject Repo Version** | vX.Y.Z (or "latest as of YYYY-MM-DD") | | **Book Repo** | [owner/book-repo](https://github.com/owner/book-repo) | | **Book-Writer Skill** | [git-repo-to-book](https://clawhub.ai/YOUR_HANDLE/git-repo-to-book) | | **Research Source** | DeepWiki / web search / direct repo analysis | | **Diagrams** | N × type (skill used) | | **Writer Model** | model name | | **Reviewer Model** | model name | | **Generated/Revised** | YYYY-MM-DD | | **Word Count** | X,XXX | ``` ### Technical Analysis The skill mandates a metadata block in every generated chapter and includes a stable link promoting the skill itself. Provenance metadata can be legitimate, but forcing a promotional link into all user-facing chapters is not required to perform the book-generation task. The use of “must” causes the loaded skill instructions to control final content regardless of whether the user requested attribution. Because chapters are subsequently merged and published, the injected link propagates into final manuscripts and remote repositories. This is an output-integrity issue rather than arbitrary code execution. It demonstrates instruction hijacking by imposing an unrelated publication requirement on generated content. ### Attack Path 1. A user invokes the skill to create or revise a book. 2. Writing agents follow the mandatory chapter metadata i ...[truncated 756 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove mandatory promotional links from chapter templates. 2. Make skill attribution explicitly opt-in and present the choice during project setup. 3. Keep technical provenance in a separate machine-readable manifest, such as `book/provenance.json`, by default. 4. If attribution is requested, add it once in an acknowledgments or colophon section rather than to every chapter. 5. Clearly distinguish reproducibility metadata from promotional content. 6. Provide a pre-publication content review showing all automatically inserted links and metadata. ]]>

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:612
Finding
Global OpenClaw Credentials Are Exported to the Shared Process Environment<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:612-618` **Vulnerability Type**: Excessive credential access and propagation **Risk Level**: Medium ### Vulnerable Code ```bash # Extract from OpenClaw config and export export ZAI_API_KEY=$(python3 -c "import json; c=json.load(open('$HOME/.openclaw/config.json')); print(c.get('zai_api_key',''))" 2>/dev/null) export GLM_API_KEY=$(python3 -c "import json; c=json.load(open('$HOME/.openclaw/config.json')); print(c.get('glm_api_key',''))" 2>/dev/null) export OPENROUTER_API_KEY=$(python3 -c "import json; c=json.load(open('$HOME/.openclaw/config.json')); print(c.get('openrouter_api_key',''))" 2>/dev/null) ``` ### Technical Analysis The workflow reads credentials from the user's global OpenClaw configuration and exports three provider keys into the process environment. Exported variables are normally inherited by subsequently launched child processes. The skill later invokes subagents, external skills, Python scripts, Node.js tools, and conversion utilities. Exporting all discovered provider keys therefore exposes them to a broader execution graph than necessary. In particular, illustration credentials are optional and are not needed for the core manuscript workflow. No direct credential transmission to an attacker-controlled endpoint was found in the audited files. The weakness is the violation of least privilege and the resulting enlargement of the credential exposure boundary. ### Attack Path 1. The user has one or more provider keys in `~/.openclaw/config.json`. 2. The skill reads those keys and exports them as environment variables. 3. The workflow launches subagents, third-party skills, or child processes. 4. Those processes inherit the exported credentials. 5. A compromised, malicious, or simply verbose dependency can read the environment. 6. The process may use the credentials for unauthorized API calls or expose them through logs, diagnostics, generated artifacts, or error reports. ### Im ...[truncated 482 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not export all available credentials globally. 2. Request explicit user approval for optional services before accessing their credentials. 3. Inject only the single required credential into the specific subprocess that needs it. 4. Use a secret manager or platform-provided scoped secret handle instead of copying secrets into a shared environment. 5. Prevent research, review, conversion, and unrelated subagents from inheriting image-provider credentials. 6. Redact environment variables from logs, crash reports, prompts, and generated artifacts. 7. Use provider keys with minimum permissions, low spending limits, and project-specific scope. 8. Clear temporary credential bindings immediately after the relevant operation. 9. Document every process and third-party component that receives a credential. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:903
Finding
Unpinned Third-Party Skill Installation Creates a Supply-Chain Execution Risk<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:903-907` **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```markdown If no image API key is available (ZAI_API_KEY, GLM_API_KEY, OPENROUTER_API_KEY all missing), use the **skill-mermaid-diagrams** skill (`clawhub install skill-mermaid-diagrams`) to generate professional, template-based diagrams: 1. **Install if needed:** ```bash clawhub install skill-mermaid-diagrams ``` ``` Related unpinned dependency guidance also appears at: - `SKILL.md:691`: `clawhub install deepwiki-mcp` - `SKILL.md:953`: `pip install markdown2` ### Technical Analysis The workflow recommends installing third-party skills and packages by mutable names without specifying an exact version, integrity hash, verified publisher identity, or reviewed artifact digest. A ClawHub skill may contain agent instructions and executable tooling. Its effective behavior can therefore change after this project has been audited. If the package name is compromised, transferred, replaced, or resolved from an unsafe source, the installed component may execute with access to the project, agent tools, and inherited environment variables. The audit did not establish that the named dependencies are currently malicious. The vulnerability is that the installation process does not provide reproducibility or integrity verification. ### Attack Path 1. A workflow reaches a feature requiring a missing optional skill. 2. The agent runs `clawhub install skill-mermaid-diagrams` or another unpinned installation command. 3. The registry resolves the mutable package name to the latest available artifact. 4. An altered or compromised release is installed. 5. The workflow invokes the installed skill to process manuscript files. 6. Malicious instructions or scripts execute with the invoking agent's project access and potentially inherited credentials. 7. The component can modify generated ...[truncated 578 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin every dependency to an exact immutable version. 2. Verify artifact checksums or signed provenance before installation. 3. Restrict installations to verified publishers and trusted registries. 4. Require explicit user approval before adding a third-party skill or package. 5. Audit installed skill instructions and scripts before granting execution or credential access. 6. Run optional skills in a sandbox with only the required project directories mounted. 7. Do not pass unrelated environment variables or secrets into dependency processes. 8. Maintain a lock file recording package names, versions, hashes, and source registries. 9. Prefer vendored, reviewed dependencies for deterministic workflows. 10. Add automated alerts for dependency ownership changes and unexpected digest changes. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:956
Finding
Overbroad Git Staging Can Publish Unrelated or Sensitive Repository Files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:956-960` **Vulnerability Type**: Unsafe repository staging and publication **Risk Level**: Medium ### Vulnerable Code ```bash git add -A git commit -m "book: complete manuscript - [word_count] words, [chapter_count] chapters" git push ``` The same overbroad staging pattern also appears at `SKILL.md:293` and `SKILL.md:390`. ### Technical Analysis `git add -A` stages all changes visible to the repository, including modifications, deletions, and untracked files not excluded by `.gitignore`. The command is followed by an unconditional commit and push instruction. The workflow can operate on existing repositories and invokes multiple agents and third-party tools that create or modify files. Consequently, the final publication step is not limited to declared book outputs. Unrelated user work, temporary files, generated configuration, or accidentally stored credentials may be included in the commit. The weakness does not require command injection. It results from an excessively broad file-selection policy combined with an externally visible push operation. ### Attack Path 1. A book project contains unrelated modified or untracked files. 2. A subagent or third-party tool may also create an unexpected file in the repository. 3. The workflow runs `git add -A`. 4. Git stages every repository change not excluded by ignore rules. 5. The workflow commits without reviewing the staged diff. 6. `git push` uploads the commit to the configured remote. 7. Sensitive or unintended content becomes available to remote repository users and may remain in Git history even after deletion. ### Impact Assessment The command does not grant new operating-system privileges, but it can disclose or alter any file within the repository that the agent can stage. Potential impact includes: - Publication of secrets or local configuration. - Disclosure of unrelated drafts or user work. - Accidental commitment of generated arti ...[truncated 281 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `git add -A` with an explicit allowlist of expected outputs, for example: ```bash git add chapters/ book/ research/ reviews/ diagrams/ project-notes/ ``` 2. Exclude configuration, environment, credential, cache, and temporary files through a reviewed `.gitignore`. 3. Run secret scanning before every commit. 4. Display and review `git status --short` and `git diff --cached` before committing. 5. Abort if staged files fall outside the declared project-output allowlist. 6. Require explicit user confirmation before the first push and before pushing to a new remote or branch. 7. Avoid automatic pushes from unattended or scheduled execution. 8. Validate the remote URL, target branch, and repository owner before publication. 9. Preserve unrelated working-tree changes rather than staging or modifying them. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (25)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The code does not implement any AI orchestration, content generation, chapter revision, or book-writing workflow. Its sole purpose is post-processing an existing markdown file into HTML, with metadata handling and optional CSS generation. This is materially different from the declared purpose of producing or revising technical books via multi-agent AI. The behavior is narrower and unrelated to the listed triggers except in a very indirect manuscript-processing sense.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared description promises an end-to-end AI book creation workflow with parallel research/writing/review agents and support for revising chapters. The actual code does not perform any AI orchestration, content generation, revision, or review. It simply locates existing chapter markdown files and concatenates them into one manuscript with metadata and a table of contents. While manuscript assembly could be a supporting component of a book-writing system, this specific code chunk’s primary behavior is materially narrower and different from the declared purpose, so this is a clear description-behavior mismatch.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description emphasizes end-to-end AI-driven book creation and chapter revision using multiple coordinated agents. In contrast, this code only performs document polishing and packaging on an already-written manuscript file. It adds formatting elements like title page, TOC, and copyright, then emits metadata. While this could be a supporting utility within a broader book-writing workflow, the supplied code chunk itself does not implement the core advertised capabilities, so the description does not accurately represent the actual behavior shown.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The declared description promises a content-generation workflow: spawning parallel agents to research, write, review, and revise book chapters. The actual code does none of that. It performs project maintenance/QA by checking markdown link targets, image paths, and orphaned diagram directories within a book repository. While link validation could be a supporting tool in a broader book-production pipeline, this code chunk’s primary purpose is materially different from the declared skill purpose, and the listed triggers about writing or revising books do not match this behavior. Therefore this is a clear description-behavior mismatch.

Self-Modification

High
Category
Rogue Agent
Content
**Best practice: Replace in-place, never create `-new` or `-v2` suffixes.**

- `chapters/chapter-NN.md` ← always overwrite the current file
- `diagrams/chapter-NN/` ← always replace diagrams in the same directory
- **No backups** (`-pre-revision`, `-old`, `-v2`) — git history IS the backup
- **No new directories** (`chapter-02-new/`) — the PR diff shows what changed
Confidence
94% confidence
Finding
The skill explicitly directs overwriting existing chapter files and replacing diagram directories in place, while discouraging backups. That creates a strong integrity risk because a mistaken invocation, poor model output, or adversarial prompt can irreversibly alter project content and then propagate those changes via commit/push workflows.

Credential Access

High
Category
Privilege Escalation
Content
# === OPTIONAL: Image Generation ===
echo "=== Image Generation (for scrapbook illustrations) ==="
# Check all possible locations: env vars, config.json, .env files
ZAI=$(grep -o '"zai_api_key"' ~/.openclaw/config.json 2>/dev/null)
GLM=$(grep -o '"glm_api_key"' ~/.openclaw/config.json 2>/dev/null)
OR=$(grep -o '"openrouter_api_key"' ~/.openclaw/config.json 2>/dev/null)
Confidence
98% confidence
Finding
The skill instructs checking config and `.env`-style locations for API keys, which is direct credential discovery behavior. In combination with subsequent export instructions, this can unnecessarily expose secrets to logs, shell history, subagents, and child processes, making credential compromise substantially more likely.

Lp3

Medium
Category
MCP Least Privilege
Confidence
74% confidence
Finding
The skill clearly instructs file reads, file writes, git operations, and shell execution, but it does not declare a scoped permission boundary in the manifest. That increases the chance the runtime grants broader capabilities than a user would reasonably expect from a 'book writing' skill, especially because later steps include repository mutation and external calls.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger phrases are broad and likely to match common writing-related requests, which can cause accidental activation of a high-impact skill that reads/writes files, clones repos, and may push changes. Over-broad invocation is more dangerous here because the skill is not read-only and includes autonomous orchestration and publishing actions.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill instructs cloning repositories, replacing chapter files, regenerating manuscripts, committing, and pushing changes, but it does not present an up-front warning that repository contents will be modified. This creates a real integrity risk: a user may invoke what sounds like a writing assistant and unexpectedly have local or remote repos altered.

Context-Inappropriate Capability

Medium
Confidence
86% confidence
Finding
The skill directs use of external network services such as DeepWiki and remote review/publishing flows, but this behavior is not made explicit in the top-level manifest description. Hidden or under-disclosed network transmission is risky because repository content, chapter drafts, and metadata may be sent to third parties without clear informed consent.

External Transmission

Medium
Category
Data Exfiltration
Content
If the revision requires new information (updated APIs, new features, recent events):

Spawn a **research agent** to:
- **Query DeepWiki MCP** (`curl https://api.deepwiki.com/v1/chat`) for current repo architecture and features
- Analyze the source repo (if provided) for changes since the chapter was written
- Web search for updated information and external context
- Produce `research/revision-research-chapter-NN.md`
Confidence
86% confidence
Finding
The revision workflow explicitly instructs querying DeepWiki and performing web search for updated information, which can transmit repo-related context off-box. In a book-writing skill this can be legitimate, but it is still a real data-exposure concern if the repo or draft content is sensitive or private.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
The environment discovery section explicitly probes for API keys in local config and exports them as environment variables for downstream tools and subagents. Credential discovery and propagation materially increase the blast radius of any later prompt injection, subprocess compromise, or overly broad subagent behavior because secrets become more widely accessible than necessary.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The environment discovery workflow reads configuration files for API keys and exports them without any explicit privacy warning to the user. This is dangerous because a content-generation skill has no obvious need to inspect local secret storage, and users may not realize sensitive credentials are being surfaced to subagents and subprocesses.

External Transmission

Medium
Category
Data Exfiltration
Content
# === OPTIONAL: DeepWiki ===
echo "=== DeepWiki MCP (for repo research) ==="
curl -s --max-time 3 https://api.deepwiki.com/v1/health >/dev/null 2>&1 && echo "✅ DeepWiki API reachable" || echo "⬜ DeepWiki unreachable (will use direct repo analysis)"

# === OPTIONAL: GitHub CLI ===
echo "=== GitHub CLI (for PR workflow) ==="
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
```bash
# Query DeepWiki for detailed repo analysis
curl -s https://api.deepwiki.com/v1/chat \
  -H "Content-Type: application/json" \
  -d '{
    "repo": "owner/repo",
Confidence
90% confidence
Finding
The skill sends repository identifiers and user prompts to an external API (`api.deepwiki.com`) for analysis. External transmission is contextually related to research, but it still creates a confidentiality risk because repository structure, topic details, or unpublished manuscript context may be disclosed to a third party.

External Transmission

Medium
Category
Data Exfiltration
Content
```bash
# Query DeepWiki for detailed repo analysis
curl -s https://api.deepwiki.com/v1/chat \
  -H "Content-Type: application/json" \
  -d '{
    "repo": "owner/repo",
Confidence
90% confidence
Finding
The skill sends repository identifiers and user prompts to an external API (`api.deepwiki.com`) for analysis. External transmission is contextually related to research, but it still creates a confidentiality risk because repository structure, topic details, or unpublished manuscript context may be disclosed to a third party.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
]
    if css_path and os.path.exists(css_path):
        cmd += [f"--css={css_path}"]
    result = subprocess.run(cmd, capture_output=True, text=True)
    if result.returncode != 0:
        print(f"pandoc error: {result.stderr}", file=sys.stderr)
        return False
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases are broad enough to match many ordinary writing-related requests, which can cause this high-privilege skill to activate outside the user's clear intent. Because the skill requests exec, file read/write, and session spawning, accidental activation expands the attack surface and may lead to unnecessary code execution or repository access in unrelated contexts.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The regex-style trigger patterns are underspecified and can match vague or partial requests such as any request to 'write ... book' or 'book about ...', without confirming that the task actually requires this specific privileged workflow. In a skill that can execute commands and spawn sessions, ambiguous auto-activation increases the risk of misrouting user prompts into a powerful agent pipeline with broader system access than necessary.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger example on line 10, "Help me write a book project", uses a vague everyday phrase rather than a distinctive invocation. Broad trigger phrases can cause the skill to activate in contexts where a user is only discussing planning or asking for lightweight help, which is especially risky here because the skill launches multi-agent orchestration for large-scale book generation and revision workflows.

Missing User Warnings

Low
Confidence
90% confidence
Finding
The README describes a workflow that sets up a repo, generates chapters, research, reviews, logs, and final outputs, but it does not clearly warn users that running the skill will create and modify many files across the workspace/repository. In a multi-agent workflow, this omission can lead to unintended local changes, repository pollution, or accidental overwrites, especially when users invoke it on an existing project rather than an isolated directory.

Overly Broad Trigger

Low
Category
Trigger Abuse
Confidence
70% confidence
Finding
The very short trigger `写书` is prone to accidental matches in ordinary conversation. This matters because accidental invocation can launch a skill with file, shell, network, and repository-modification behavior rather than a harmless drafting assistant.

Intent-Code Divergence

Low
Confidence
97% confidence
Finding
The PR workflow explicitly copies the original chapter to `chapters/chapter-NN-pre-revision.md`, while the later integration guidance says 'No backups' and states that git history is the backup. This is a direct contradiction between the skill's own procedural guidance and its stated revision policy.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
The image-generation command passes `--language en`, forcing English output regardless of the user's preferred language. This is a natural-language locale constraint documented in the skill, but the file does not present it as an option or justify it as region-specific behavior.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
The trigger list mixes English and Chinese phrases, but the manifest does not explain whether the skill will operate in the user's language, switch languages automatically, or impose any locale-specific behavior. This can create ambiguity around language handling without explicit user choice or documentation.

Static analysis

No suspicious patterns detected.