Back to skill

Security audit

Git高级操作免费版

Security checks for vulnerabilities and agentic risk

Overview

This is a Git command helper, but it gives an agent broad activation wording and destructive repository commands without enough safety checks.

Review this skill before installing if your agent can execute commands. Only use it inside repositories you intend to modify, ask the agent to run git status and create a backup branch before destructive Git operations, and treat reset --hard, rebase history edits, and forced worktree removal as actions requiring explicit approval.

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:215
Finding

Predictable Temporary File Enables Symlink-Based File Overwrite

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 215–220
Vulnerability Type: Unsafe temporary-file handling
Risk Level: Medium

Vulnerable Code:

bash
cat > /tmp/test-for-bug.sh << 'EOF'
#!/bin/sh
npm test -- --grep "login should redirect" 2>/dev/null
EOF
chmod +x /tmp/test-for-bug.sh
git bisect run /tmp/test-for-bug.sh

Technical Analysis

The skill instructs the agent to create and overwrite a script at the fixed, predictable path /tmp/test-for-bug.sh. On multi-user Unix-like systems, /tmp is generally shared and writable by unprivileged users.

Shell output redirection follows symbolic links. If another local process creates /tmp/test-for-bug.sh as a symbolic link before these instructions are executed, cat > /tmp/test-for-bug.sh may overwrite the symlink target. The subsequent chmod +x may also modify that target's permissions.

No exclusive file creation, symlink validation, private temporary directory, restrictive initial permissions, or cleanup mechanism is used.

Attack Path

  1. A local attacker predicts the documented path /tmp/test-for-bug.sh.
  2. The attacker creates a symbolic link at that path pointing to a file writable by the account running the agent.
  3. The agent follows the skill and performs shell redirection to the predictable path.
  4. The operating system follows the symbolic link, causing the linked file to be overwritten with the test script.
  5. The documented chmod +x command may additionally grant executable permissions to the target.
  6. The resulting damage depends on which files the agent account can modify.

Impact Assessment

Successful exploitation can cause file corruption and unintended permission changes within the privileges of the account executing the skill. It does not independently provide privilege escalation: the target must already be writable by that account. However, overwriting a security-relevant user-controlle ...[truncated 294 chars]

Remediation
View remediation

Remediation Suggestions

Replace the predictable shared path with a securely created private temporary directory, apply restrictive permissions, quote all path expansions, and guarantee cleanup:

bash
tmpdir="$(mktemp -d)" || exit 1
chmod 700 "$tmpdir" || exit 1
trap 'rm -rf -- "$tmpdir"' EXIT HUP INT TERM

script="$tmpdir/test-for-bug.sh"
cat > "$script" <<'EOF'
#!/bin/sh
npm test -- --grep "login should redirect" 2>/dev/null
EOF

chmod 700 "$script" || exit 1
git bisect run "$script"

Additional hardening measures:

  • Do not reuse a fixed filename in a globally writable directory.
  • Fail immediately if temporary-directory creation or permission assignment fails.
  • Keep the script accessible only to the executing user.
  • Remove temporary resources on normal completion and interruption.
  • Where practical, create the test script inside a trusted project-controlled directory with validated ownership and permissions.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

Vague Triggers

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The description includes broad usage language that encourages invocation whenever AI-model calling or agent orchestration is involved, not just when Git help is needed. Because the skill is allowed to use exec, overbroad routing materially increases the chance of accidental or context-inappropriate repository modifications.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger condition says the skill should be used for broad AI-model, intelligent dialogue, agent orchestration, and LLM application scenarios, which is far wider than a Git workflow assistant. In an agent environment with exec access, such ambiguous activation can lead to unintended command execution in repositories or workspaces unrelated to the user’s immediate task.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill recommends git reset --hard as a recovery step without a prominent warning that it irreversibly discards uncommitted working-tree and index changes. In a tool-using agent context, users may follow or allow execution of this command believing it is safe recovery, causing destructive data loss beyond the intended rollback.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

git reset --hard HEAD@{2} is a destructive state-changing command presented as a normal recovery action. In a skill with exec capability, normalizing hard resets without confirmation, backup, or cleanliness checks creates a direct data-loss hazard if executed automatically or copied blindly.

Content

Scanner excerpt · SKILL.md (reported line 240)May include surrounding context.

md
git reflog --date=relative

# 恢复到指定状态
git reset --hard HEAD@{2}      # 回到 2 步之前的状态
git reset --hard ghi789        # 回到指定提交

# 恢复误删的分支

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

git reset --hard ghi789 is another direct destructive reset that can wipe local modifications while moving HEAD to an arbitrary commit. The danger is amplified because the skill is positioned as a reusable agent instruction set and may be executed without the user fully understanding the consequences.

Content

Scanner excerpt · SKILL.md (reported line 241)May include surrounding context.

md
# 恢复到指定状态
git reset --hard HEAD@{2}      # 回到 2 步之前的状态
git reset --hard ghi789        # 回到指定提交

# 恢复误删的分支
git branch recovered-branch abc123

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

This recovery example again uses git reset --hard as the primary solution for lost commits, reinforcing unsafe destructive behavior. Repetition of the pattern across the skill increases the likelihood that an agent or user will treat hard reset as routine rather than as a last-resort operation with data-loss implications.

Content

Scanner excerpt · SKILL.md (reported line 349)May include surrounding context.

bash
git reflog                        # 找到丢失的提交哈希
git reset --hard abc123           # 恢复到该提交

Q6:樱桃挑选冲突如何处理?

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill metadata and description broaden the trigger scope from Git-specific workflows to generic AI/LLM/Agent orchestration scenarios. That mismatch can cause the skill to be invoked outside its domain, increasing the chance an agent executes repository-affecting commands in unrelated contexts where the user did not intend Git operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The force-removal worktree instruction omits a warning that git worktree remove --force can discard uncommitted changes in that worktree. In an agent-assisted workflow, users may apply it mechanically during cleanup and lose ongoing emergency-fix work.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

At L381 the file states the tool is '纯 Markdown 指令驱动,无需额外 API Key', which implies no direct credentialed external API usage. However, L419-L421 introduce API-key leakage prevention and HTTPS/SSL network communication guidance, contradicting the stated operating model and suggesting capabilities not actually present in the described Git command workflow.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

L040-L058 describe a generic input/output/config framework supporting '创建/查询/修改/删除', '导入', and '导出/保存/转换' operations. This actively conflicts with the rest of the file, which is a Git command cookbook rather than a parameterized CRUD-style tool, indicating templated documentation that misrepresents the actual intent and operation model.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.