Back to skill

Security audit

Git Flow Helper

Security checks for vulnerabilities and agentic risk

Overview

This Git helper is mostly purpose-aligned, but its implementation exposes unsafe shell command execution and repo-changing operations without clear safeguards.

Review carefully before installing. Only use this skill in repositories you can recover, avoid untrusted branch or commit names, and require manual confirmation or code changes before allowing it to run mutating Git commands. The implementation should use argument-array process execution and validate Git refs before use.

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.yaml:14
Finding
OS Command Injection Through Unsanitized Git Operation Parameters## Vulnerability Details **File Location**: `skill.yaml`, lines 14-17 **Vulnerability Type**: OS command injection **Risk Level**: High The affected handlers directly interpolate caller-controlled parameters into shell commands: ```javascript 'create-branch': async (name) => exec(`git checkout -b ${name}`), 'merge': async (source, target) => exec(`git merge ${source} into ${target}`), 'rebase': async (branch) => exec(`git rebase ${branch}`), 'cherry-pick': async (commit) => exec(`git cherry-pick ${commit}`), ``` ### Technical Analysis The `name`, `source`, `target`, `branch`, and `commit` values are inserted into command strings passed to `exec()`. This API normally executes the supplied string through a system shell. No validation, escaping, or separation between executable arguments and shell syntax is performed. Consequently, a parameter containing shell metacharacters such as semicolons, command substitutions, pipes, or redirection operators can alter the intended command and append arbitrary shell operations. For example, a branch parameter shaped like `main; id` would result in a shell command equivalent to: ```bash git rebase main; id ``` The merge implementation has an additional correctness issue: it generates `git merge <source> into <target>`, which is not valid Git merge syntax. Moreover, the dispatcher passes only `options.params` to each handler, so the declared `target` parameter may remain undefined. These defects do not prevent injection through the interpolated `source` value. ### Attack Path 1. An attacker or untrusted caller invokes the Skill through one of its exposed Git operation triggers. 2. The caller selects a parameterized operation such as `create-branch`, `merge`, `rebase`, or `cherry-pick`. 3. The caller supplies an operation parameter containing shell syntax, such as `main; id`. 4. The handler inserts that value directly into a template literal. 5. `exec()` sends th ...[truncated 777 chars]
Remediation
## Remediation Suggestions 1. Replace shell-string `exec()` calls with a non-shell process API such as `execFile()` or `spawn()`, passing every Git argument as a separate array element: ```javascript execFile('git', ['checkout', '-b', name]); execFile('git', ['rebase', branch]); execFile('git', ['cherry-pick', commit]); ``` 2. Validate branch and reference names before execution. Prefer invoking `git check-ref-format --branch` without a shell, or enforce an equivalently strict validation policy. 3. Restrict cherry-pick input to an expected Git object identifier or validated revision expression. If only commit hashes are required, use a strict hexadecimal length policy and verify the object through Git. 4. Reject control characters, whitespace where unnecessary, shell metacharacters, option-like values beginning with `-`, and unexpected parameter types. Do not rely on shell escaping as the primary defense. 5. Redesign the merge handler and its input contract. A standard merge normally requires only the source reference in the currently checked-out target branch. If a target branch is supported, check it out separately using argument-array execution and then merge the validated source. 6. Add tests using hostile inputs containing semicolons, command substitution, pipes, redirections, newlines, and leading hyphens. Verify that such input is rejected and cannot create files or execute secondary commands. 7. Run the Skill with the least-privileged operating-system account required for repository access to reduce the impact of any future command-execution defect.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (8)

Missing User Warnings

High
Confidence
96% confidence
Finding
The skill performs destructive and history-rewriting Git operations, including branch deletion, rebase, and cherry-pick, but provides no warning about the risk of data loss, force-push requirements, or repository state corruption. In an assistant context, this omission is dangerous because users may invoke these operations casually without understanding irreversible consequences.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger phrases are very broad and map to ordinary Git help requests, which can cause this skill to activate in situations where a user only wanted general information rather than operational assistance. In a skill that suggests or performs repository-altering actions, overbroad invocation increases the chance of unintended destructive guidance being surfaced without sufficient confirmation or context.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill advertises destructive or irreversible Git operations such as rebase, cherry-pick, merge, and branch cleanup without any warning about data loss, history rewriting, or the need to verify branch state first. Users may follow these examples directly and accidentally delete branches, rewrite shared history, or create hard-to-recover repository states.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger pattern "git命令" is so broad that it can activate this skill for many generic Git-related requests, including cases where the user only wanted advice rather than command execution. In a skill that exposes branch deletion and history-rewriting operations, overbroad invocation increases the chance of unintended destructive actions.

Vague Triggers

Medium
Confidence
88% confidence
Finding
The trigger overlaps with a common term used in everyday developer conversation about branching strategy. Without scope limits or negative examples, the skill may activate when users are merely discussing Git Flow rather than requesting automated operations.

Context-Inappropriate Capability

Medium
Confidence
83% confidence
Finding
The description presents the skill as an intelligent Git assistant for handling branches, merges, and conflicts. The `clean-branches` operation goes beyond assistance and performs bulk deletion of local branches, which is a materially destructive capability not specifically indicated by the stated purpose.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The skill description and operation labels are presented entirely in Chinese, which implies a fixed language choice for interaction and documentation. There is no indication that the skill is region-specific or that users may opt into another language.

Intent-Code Divergence

Low
Confidence
91% confidence
Finding
The surrounding documentation says the skill helps with branch and merge operations, implying it performs actual Git merges correctly. However, the code issues `git merge ${source} into ${target}`, which does not match real Git merge semantics and therefore contradicts the documented intent of performing a merge operation.

Static analysis

No suspicious patterns detected.