T06 · System Persistence
- Location
SKILL.md:76- Finding
Persistent Git hooks execute scanners across future repository operations
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:76-80andSKILL.md:170-174
Vulnerability Type: Persistent Git hook installation
Risk Level: LowVulnerable Code
bash # git-secrets cd your-repo git secrets --install git secrets --register-awsbash # Add to .git/hooks/pre-commit #!/bin/bash gitleaks protect --stagedTechnical Analysis
The instructions install a Git pre-commit hook that remains in the repository after the current scanning session and runs during subsequent commits. This persistence directly supports the declared secret-scanning purpose and is transparently documented, so it is not evidence of a hidden backdoor.
Nevertheless, installing a persistent hook exceeds the privileges and duration required for a one-time repository scan. The hook relies on a
gitleaksexecutable resolved through the future user's environment. If that executable, the hook itself, or relevant configuration is later replaced, future commits could trigger unauthorized code under the committing user's account.Attack Path
- A user follows the documentation and installs the pre-commit hook.
- The hook persists in
.git/hooks/pre-commit. - An attacker with an independent ability to modify the hook, replace the resolved
gitleaksexecutable, or influence its configuration introduces malicious behavior. - The user later runs
git commit. - Git automatically executes the modified component with the user's permissions.
This path requires a separate compromise or modification capability; the supplied instructions do not themselves contain a malicious payload.
Impact Assessment
Exploitation could execute commands with the privileges of the user performing the commit. The practical scope includes files, credentials, repositories, and network access available to that user. The hook does not independently provide root access or cross-repository persistence.
- Remediation
View remediation
Remediation Suggestions
- Present hook installation as an explicit, optional alternative to one-time scanning.
- Explain that the hook persists and runs during future commits.
- Provide removal instructions, such as reviewing and deleting the generated
.git/hooks/pre-commitfile. - Resolve the scanner through a trusted absolute path rather than relying solely on
PATH. - Pin and verify the scanner version before configuring automatic execution.
- Ensure the generated hook is writable only by the repository owner.
- Prefer centrally reviewed CI enforcement when persistent local hooks are unnecessary.
