Back to skill

Security audit

Git Sync

Security checks for vulnerabilities and agentic risk

Overview

This git helper is mostly coherent, but it can push or pull configured repositories using the user's Git credentials with only a command-line flag as confirmation.

Install only if you are comfortable with an agent running git status, fetch, pull, and push on the configured repositories. Before using write operations, inspect ~/.config/git-sync/repos.json, keep it limited to repositories you intend to manage, and require your workflow or agent runtime to ask you explicitly before adding --confirm, because the script itself cannot verify that 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
scripts/git_ctrl.py:140
Finding
Write-operation confirmation is enforced only through a caller-controlled flag<![CDATA[ ## Vulnerability Details **File Location**: `scripts/git_ctrl.py`, lines 140–148 **Vulnerability Type**: Insufficient authorization and confirmation enforcement **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument("--confirm", action="store_true") parser.add_argument("-n", type=int, default=10) parser.add_argument("--json", action="store_true") args = parser.parse_args() repos = load_repos() if args.command in WRITE_COMMANDS and not args.confirm: print(f"⚠️ '{args.command}' modifies the repo. Add --confirm to proceed.", file=sys.stderr) ``` ### Technical Analysis The skill states that write operations require explicit confirmation, but the implementation treats the presence of the caller-controlled `--confirm` command-line flag as proof that authorization was obtained. There is no independent confirmation prompt, approval token, trusted interaction state, or binding between the approval and the repository and operation being authorized. Consequently, any process or agent capable of invoking the script can add `--confirm` itself and immediately execute `pull` or `push`. The check therefore prevents accidental invocation without the flag but does not establish that the user knowingly approved the operation. This is especially relevant in an agent environment, where generated tool arguments may be influenced by misunderstood requests or malicious content. The affected operations can communicate with configured Git remotes. A push may transmit committed repository content, while a pull may modify the local working tree. Such network access is necessary for the declared synchronization functionality, but it should occur only after trustworthy authorization. ### Attack Path 1. An attacker influences an agent or another process that is permitted to execute the skill. 2. The influenced caller invokes a write operation and supplies the confirmation flag directly, for example: ```bash python3 scripts/git_ctrl.py push the ...[truncated 1563 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not treat a freely supplied Boolean command-line flag as proof of user consent. - Require confirmation through a trusted interaction channel that the invoking agent cannot synthesize on its own. - If non-interactive execution is required, issue a short-lived, single-use approval token from a trusted controller after explicit user confirmation. - Bind each approval to: - The exact command (`push` or `pull`). - The canonical repository path. - The remote and branch involved. - A short expiration time. - A nonce to prevent replay. - Before approval, display the exact operation and relevant consequences. For pushes, show the remote URL, branch, and commits to be transmitted. For pulls, show the remote branch and warn that the working tree may change. - Consider separating read-only and write-capable operations into different entry points or capabilities so routine status checks cannot silently transition into writes. - Canonicalize and revalidate the repository path immediately before execution. - Record authorization and execution events without logging credentials, tokens, or sensitive repository content. - Retain the current prohibition on destructive and forced operations, but document that remote Git operations necessarily use the current user's configured credentials and can transfer repository data. ]]>
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (5)

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill advertises shell-based operational capability via `python3 scripts/git_ctrl.py ...` but does not declare any explicit tool scope such as `permissions` or `allowed-tools`. Without a restrictive tool declaration, an agent runtime may grant broader shell access than intended, increasing the chance that a prompt-injection or implementation bug could execute unintended commands beyond the documented git workflow.

Session Persistence

Medium
Category
Rogue Agent
Content
- git CLI (https://git-scm.com)
description: >
  Manage whitelisted git repositories from chat. Status, log, diff, pull, push
  with security controls — only approved repos, write commands need confirmation.
  Repo list configurable via ~/.config/git-sync/repos.json (overrides defaults).
  Triggers on "git status", "repo status", "push thesis", "pull polito",
  "check repo", "uncommitted changes", "commit recenti".
Confidence
87% confidence
Finding
The skill allows persistent configuration from `~/.config/git-sync/repos.json`, which lets behavior be altered by external state across sessions. If that file is modified by another process or user, the whitelist of repositories could be expanded or redirected to sensitive paths, undermining the stated security model and potentially causing the agent to operate on unintended repositories.

Session Persistence

Medium
Category
Rogue Agent
Content
#!/usr/bin/env python3
"""Secure git repository manager for whitelisted repos.

Read-only commands run freely. Write commands require --confirm flag.
Repo list loaded from config file or defaults.

Usage:
Confidence
79% confidence
Finding
The script persists trust and authority across sessions by loading the allowed repository list from ~/.config/git-sync/repos.json without integrity checks or ownership validation. If that file is modified by another local process, compromised agent context, or social-engineered user action, later invocations may treat attacker-chosen paths as whitelisted and enable confirmed write operations like pull and push against unintended repositories.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def run_git(repo_path: str, args: list[str], timeout: int = 30) -> dict:
    cmd = ["git", "-C", repo_path] + args
    try:
        result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
        return {"returncode": result.returncode, "stdout": result.stdout.strip(), "stderr": result.stderr.strip()}
    except subprocess.TimeoutExpired:
        return {"error": f"Command timed out ({timeout}s)"}
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Description-Behavior Mismatch

Low
Confidence
89% confidence
Finding
The manifest describes the skill as supporting status, log, diff, pull, and push for whitelisted repositories, but the code also exposes branch listing and fetch operations. These are real user-facing capabilities not mentioned in the manifest, so the implementation exceeds the described behavior even though they are related to git management.

Static analysis

No suspicious patterns detected.