Back to skill

Security audit

Unfuck My Git State

Security checks for vulnerabilities and agentic risk

Overview

This Git recovery skill is mostly coherent, but it saves detailed Git diagnostics that can include secrets into a repository folder without redaction or private-permission safeguards.

Review before installing. Use this only on repositories where you are comfortable creating local diagnostic snapshots, and inspect or delete .git-state-snapshots before committing, uploading logs, or sharing the repo. Avoid using it on repos with tokens embedded in remote URLs unless the snapshot script is changed to redact secrets and create owner-only files.

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/snapshot_git_state.sh:21
Finding
Plaintext Capture of Potentially Credential-Bearing Git Remote URLs## Vulnerability Details **File Location**: `scripts/snapshot_git_state.sh`, lines 21–22 and 55 **Vulnerability Type**: Plaintext sensitive-data exposure and insufficient file-permission hardening **Risk Level**: Medium ```bash OUT_DIR="$TOPLEVEL/.git-state-snapshots/$STAMP" mkdir -p "$OUT_DIR" ``` ```bash run_capture remote_verbose git -C "$TARGET" remote -v ``` ### Technical Analysis The snapshot script executes `git remote -v` and writes its complete output to `remote_verbose.txt` through `run_capture`. Git remote URLs can contain embedded usernames, passwords, personal access tokens, or other authentication data, particularly in HTTPS URLs using user-information syntax. Neither the snapshot directory nor its files are assigned restrictive permissions. Their effective permissions depend on the invoking user's `umask`; under a common `022` configuration, the directory and captured files may be readable by other local users. The snapshots are also created inside the repository worktree under `.git-state-snapshots/`, creating an additional risk that they may be staged, committed, archived, uploaded as build artifacts, or collected by backup systems. ### Attack Path 1. A user configures a Git remote whose URL contains an embedded password or access token. 2. The user follows the documented workflow and runs `scripts/snapshot_git_state.sh`. 3. The script invokes `git remote -v` and stores the complete remote URL in `.git-state-snapshots/<timestamp>/remote_verbose.txt`. 4. Because the script does not enforce private permissions or redact credentials, another local account or an artifact-collection process can read the snapshot. 5. Alternatively, the snapshot directory may be accidentally staged or archived with the repository. 6. The exposed credential can then be used against the services and repositories authorized for that credential, subject to its configured privileges. ### Impact Assessment An attacker can obtain credentials embedded in Git re ...[truncated 576 chars]
Remediation
## Remediation Suggestions 1. Set a restrictive process mask before creating any diagnostic output: ```bash umask 077 ``` 2. Explicitly create the snapshot directory with owner-only permissions: ```bash mkdir -m 700 -p "$OUT_DIR" ``` 3. Do not persist complete remote URLs. Record only remote names and sanitized hosts, or redact URL user-information and sensitive query parameters before writing output. 4. If full URLs are operationally necessary, replace passwords and tokens with a fixed marker such as `[REDACTED]`. 5. Store snapshots outside the repository worktree by default. If worktree-local storage remains supported, add `.git-state-snapshots/` to an appropriate exclusion mechanism and warn users not to commit or upload it. 6. Ensure every generated file is owner-readable and owner-writable only, for example with `chmod 600 "$out"` after creation. 7. Document that snapshots created by older versions may contain secrets and should be reviewed, securely deleted, or sanitized. Credentials found in existing snapshots should be rotated.
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (9)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
I’ve used git almost every day for 24 years, and it still humbles me with its unfathomable complexity. A week still does not go by without me learning one more 'neat trick' or one more way it can literally FUCK my entire day.

I don't care who you are - "oh you're that NASA flight engineer who wrote the navigational algorithm and tweaked the assembly code that landed the Curiosity robot on Mars?" - even you’ve had that moment after git reset --hard where your brain goes: “Did I just vaporize $134M in history… or am I just having a normal day?” Then you run git reflog and its literally more complex than the firehose of black box telemetry data from a Boeing crash.

Git: "You did *what* now? Oh, I gotchu. <prints you a wall of trickling Matrix runes> Hey, you have fun with that buddy!"
Confidence
65% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The script aligns with the diagnostic portion of the description: it gathers Git metadata useful for investigating broken HEAD/worktree/ref situations and explicitly advises diagnosis before making changes. However, the declared purpose says the skill will 'diagnose and recover' broken Git state with a recovery flow, while this code chunk only snapshots state and runs read-only inspection commands. There are no actions to fix refs, remove locks, prune orphaned worktrees, recreate missing refs, or otherwise recover repository state. This is a material description-behavior mismatch in primary capability, even though the diagnostic intent is consistent.

Ae1

High
Category
analysis-evasion
Content
bash scripts/guided_repair_plan.sh --repo .
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
bash scripts/guided_repair_plan.sh --repo .
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
bash scripts/guided_repair_plan.sh --repo .
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
bash scripts/guided_repair_plan.sh --repo .
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The README positions the skill as a Git recovery aid but does not prominently and explicitly warn that some recovery actions in the referenced playbooks may be destructive or irreversible. In a high-stress recovery context, users may follow linked workflows quickly and assume safety, increasing the chance of accidental data loss if later steps include commands like ref deletion, checkout/reset operations, or metadata cleanup.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The script creates a snapshot directory and later writes multiple files containing repository state, refs, remotes, reflog entries, and worktree details. There is a final informational message after capture completes, but no confirmation prompt, pre-execution warning, or inline disclosure before collecting and storing this potentially sensitive data.

Vague Triggers

Low
Confidence
88% confidence
Finding
This manifest provides only a display name and general description of the skill's purpose, but does not define when it should or should not be invoked. For a manifest file, the absence of explicit trigger phrases, scope limits, or exclusion conditions can make activation boundaries ambiguous.

Static analysis

No suspicious patterns detected.