Back to skill

Security audit

git-version-control

Security checks for vulnerabilities and agentic risk

Overview

This skill is coherent Git checkpoint guidance, but it normalizes broad commits and destructive rollbacks over core OpenClaw configuration and memory files.

Install only if you are comfortable with an agent creating Git commits over your OpenClaw configuration directory. Before using it, replace broad `git add -A` with explicit file allowlists, review staged diffs, scan for secrets, and treat `git reset --hard` as a last-resort action requiring clear confirmation and a backup branch or tag.

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
SKILL.md:58
Finding
Overbroad Git Staging May Persist Sensitive Agent Data## Vulnerability Details **File Location**: `SKILL.md`, lines 58–64 **Vulnerability Type**: Overbroad staging of potentially sensitive files **Risk Level**: Medium ### Vulnerable Code ```bash cd ~/.openclaw # Check current status git status # Add all tracked files (respecting .gitignore) git add -A # Create commit with descriptive message git commit -m "checkpoint: {description of pending change}" ``` The associated denylist at lines 143–172 only excludes selected sensitive file names and formats: ```gitignore # Session logs (volatile) *.jsonl *.jsonl.lock *.jsonl.reset.* # Databases (volatile) *.sqlite *.sqlite-journal # Credentials (sensitive) credentials/ *.pem *.key # Temporary files *.tmp *.temp .DS_Store # Logs logs/ # Delivery queue delivery-queue/ ``` ### Technical Analysis The skill directs the agent to execute `git add -A` in `~/.openclaw`. This stages every new, modified, and deleted file within the repository unless a matching ignore rule applies. The proposed `.gitignore` is a denylist and excludes only a limited set of credential formats and directories. It does not account for common sensitive artifacts such as `.env` files, token files, cloud-provider credentials, authentication configuration, or secrets embedded in `openclaw.json`, memory files, and other configuration documents. Moreover, `.gitignore` does not protect sensitive files that Git already tracks. Once sensitive content is committed, deleting it in a later commit does not remove it from prior Git history. The content can remain recoverable through ordinary Git commands and may be disclosed if the repository is copied, backed up, shared, or connected to a remote. ### Attack Path 1. A credential, token, private user information, or another secret is written to an unignored file under `~/.openclaw`. 2. The user requests a checkpoint, or the agent creates one before a sensitive operation ...[truncated 1277 chars]
Remediation
## Remediation Suggestions 1. Replace `git add -A` with an explicit allowlist of files intended for each checkpoint, such as: ```bash git add -- workspace/SOUL.md workspace/AGENTS.md ``` 2. Require inspection of the staged patch before every commit: ```bash git diff --cached --stat git diff --cached ``` 3. Add a secret-scanning step and abort the commit when credentials, private keys, tokens, or high-entropy secrets are detected. 4. Expand ignore rules to cover environment files, token stores, cloud credentials, authentication configuration, backups, and other project-specific sensitive artifacts. 5. Verify whether sensitive files are already tracked with `git ls-files`; `.gitignore` alone does not protect tracked files. Remove such files from the index and purge existing secrets from history where necessary. 6. Exclude memory and general configuration files by default unless their contents have been reviewed and are known not to contain secrets or private information. 7. Verify the repository root with `git rev-parse --show-toplevel` before staging so that the command cannot unintentionally operate over a broader repository. 8. Prevent accidental publication by confirming that no unauthorized Git remote is configured and by applying restrictive filesystem permissions to the local repository.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
|--------|---------|--------|
| Soft reset | `git reset --soft HEAD~1` | Undo commit, keep changes staged |
| Mixed reset | `git reset --mixed HEAD~1` | Undo commit, keep changes unstaged |
| Hard reset | `git reset --hard HEAD~1` | Completely undo commit and changes |

**Recommended default**: `--hard` for full rollback
Confidence
94% confidence
Finding
Recommending `git reset --hard` as the default rollback mechanism is dangerous because it irreversibly discards uncommitted changes and can destroy legitimate user data. In an agent context, a destructive default materially increases the chance of unintended loss if the command is triggered from ambiguous user input or poor operator judgment.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
"Rollback to commit X? This will discard: {list changes}"
   
3. Execute rollback
   git reset --hard {commit-hash}
   
4. Report result
   "✓ Rolled back to commit abc1234"
Confidence
91% confidence
Finding
The skill instructs execution of `git reset --hard {commit-hash}`, a destructive command that can permanently remove working tree changes. Although the surrounding text includes confirmation, the pattern still exposes a hazardous tool invocation path whose misuse could lead to irreversible configuration or data loss.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
git log --oneline -5
  # Show: abc1234 checkpoint: before skill install
  #       def5678 previous config
  git reset --hard abc1234
Output: "✓ Rolled back to 'before skill install' (abc1234)"
```
Confidence
89% confidence
Finding
This example normalizes use of `git reset --hard` in a routine recovery flow, which can lead operators or downstream agents to treat destructive reset as standard practice. The danger is contextual: this skill manages core OpenClaw configuration files, so a mistaken reset could wipe important local changes across critical system state.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
| Action | Command | Alias |
|--------|---------|-------|
| SAVE checkpoint | `git add -A && git commit -m "checkpoint: {desc}"` | `save` |
| ROLLBACK | `git reset --hard HEAD~1` | `rollback` |
| View history | `git log --oneline -10` | `history` |
| Check status | `git status` | `status` |
| Compare diff | `git diff HEAD` | `diff` |
Confidence
95% confidence
Finding
Listing `git reset --hard HEAD~1` as the quick-reference rollback alias makes a destructive action easy to invoke without adequate context, review, or safeguards. Quick-reference sections are especially risky because they encourage shortcut usage and bypass the more careful confirmation workflow described elsewhere.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
"Rollback to abc1234? This will remove the newly installed skill."
     
  3. Execute
     $ git reset --hard abc1234
     ✓ Rolled back successfully
```
Confidence
88% confidence
Finding
The example session culminates in `git reset --hard abc1234`, reinforcing destructive rollback as an expected operational pattern. Even with a confirmation prompt, embedding this command in a reusable agent skill increases the risk that future implementations automate it unsafely or apply it to the wrong target commit.

Session Persistence

Medium
Category
Rogue Agent
Content
## Core Operations

### 1. SAVE - Create Checkpoint

Create a git commit before making sensitive changes. This provides a recovery point.
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
---

### 2. ROLLBACK - Restore Previous State

Revert to a previous commit when issues occur.
Confidence
55% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
### ❌ Avoid

1. **Don't rollback without confirmation**
   - Hard reset destroys uncommitted changes
   - Always warn user about data loss
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.