Back to skill

Security audit

Commit Message Validation

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent commit-message helper, but its included Git hook can run validator code from repository-controlled paths when commits are made.

Review the hook before installing it. The core SKILL.md guidance and standalone validator are ordinary commit-message tooling, but avoid copying the provided hook into .git/hooks unless it is changed to call a trusted, fixed validator path and fail closed when missing.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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)

T07 · Tool Hijacking and Spoofing

Error
Location
scripts/commit-msg-hook.sh:8
Finding
Repository-Controlled Validator Allows Arbitrary Code Execution During Git Commits<![CDATA[ ## Vulnerability Details **File Location**: `scripts/commit-msg-hook.sh`, lines 8–22 **Vulnerability Type**: Repository-controlled tool hijacking **Risk Level**: High ```bash VALIDATOR="" for candidate in \ "$SCRIPT_DIR/../../skills/commit-message-writing/scripts/validate_commit_message.py" \ "$SCRIPT_DIR/../skills/commit-message-writing/scripts/validate_commit_message.py" \ "skills/commit-message-writing/scripts/validate_commit_message.py"; do if [ -f "$candidate" ]; then VALIDATOR="$candidate" break fi done if [ -z "$VALIDATOR" ]; then echo "Warning: validate_commit_message.py not found, skipping validation" exit 0 fi python3 "$VALIDATOR" --message "$MSG" exit $? ``` ### Technical Analysis The Git commit hook searches several paths for `validate_commit_message.py` and executes the first matching file with Python. At least one candidate, `skills/commit-message-writing/scripts/validate_commit_message.py`, is resolved relative to the current working directory and can reside in the repository working tree. The other candidate paths may also resolve to mutable skill directories, depending on where the hook is installed. Repository content changes when branches are checked out and is generally controlled by repository contributors. The hook performs no canonical-path validation, ownership check, permission check, or cryptographic integrity verification before executing the selected Python file. Consequently, a malicious branch can place attacker-controlled Python code at an expected location and cause the hook to execute it when the developer attempts a commit. The hook also fails open if no validator is found. Although this does not itself provide code execution, it silently disables the validation control and may conceal installation or path-resolution errors. ### Attack Path 1. A developer installs the hook as documented by copying `scripts/commit-msg-hook.sh` into `.git/hooks/commit-msg`. 2. An attacker creates or modifi ...[truncated 1232 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Install a trusted copy of the validator outside the repository working tree, preferably alongside the installed hook under `.git/hooks`, and invoke only that fixed location. 2. Resolve the validator path from the hook's canonical installation directory rather than from the current working directory or branch-controlled content. 3. Reject the commit if the trusted validator is missing instead of returning success: ```bash if [ ! -f "$VALIDATOR" ]; then echo "Error: trusted commit-message validator not found" >&2 exit 1 fi ``` 4. If the validator must be loaded from another directory, canonicalize the path and verify that it remains under an administrator- or user-controlled trusted directory. 5. Pin and verify the validator's integrity with a trusted cryptographic digest or signed release before execution. 6. Ensure the trusted validator and its parent directories are not writable by untrusted users or modified through repository branch checkouts. 7. Add integration tests that install the hook in a temporary repository and verify that repository-provided validators are never selected. 8. Document the trust boundary and provide an installation script that atomically installs both the hook and its trusted validator. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (2)

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill instructs the agent to run shell commands and inspect repository state (`git status`, `git diff`, and a Python validator), but it does not declare any explicit tool scope such as allowed tools or permissions. That creates an authorization gap where an orchestrator may permit broader command execution than intended, and shell/file access in a developer workflow can expose repository contents or enable unintended command use if the skill is invoked in the wrong context.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The activation description is broad enough to match many routine development moments, including planning branches, reviewing PRs, staging changes, and finishing implementation units. Because the skill also directs shell and repository inspection actions, over-broad triggering can cause the agent to invoke this skill outside narrow commit-message assistance, unnecessarily expanding opportunities for repo inspection or command execution.

Static analysis

No suspicious patterns detected.