Back to skill

Security audit

bloat-detector

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent code-bloat audit guide, but some scan commands can silently overwrite or delete fixed files while inspecting a repository.

Review the commands before use, especially on untrusted repositories. Treat all DELETE or Safe to remove recommendations as review candidates only, and replace fixed scratch files with mktemp/private cache paths before running the snippets.

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 (4)

T09 · Insecure Skill Coding Practices

Warning
Location
modules/ai-generated-bloat.md:64
Finding

Predictable temporary package inventory file permits symbolic-link clobbering

Content
View full analysis
/tmp/installed.txt grep -rh "^import \|^from " --include="*.py" . | \ sed 's/^import //;s/^from //;s/ import.*//' | \ sort -u | while read pkg; do root=$(echo $pkg | cut -d. -f1) grep -q "^$root" /tmp/installed.txt || echo "HALLUCINATED?: $pkg" done ``` ### Technical Analysis The command writes package inventory data to the fixed, publicly predictable path `/tmp/installed.txt`. Shell redirection opens this path with truncation and ordinarily follows symbolic links. On a shared system, another local user can create `/tmp/installed.txt` as a symbolic link to another file writable by the account running the Skill. When the analysis command is executed, `pip freeze` can truncate and replace the target's contents. Concurrent Skill runs can also overwrite each other's package inventories, causing incorrect dependency findings and exposing environment package metadata to other local processes. Exploitation requires local access sufficient to create entries in the shared temporary directory and a target file writable by the victim account. ### Attack Path 1. An attacker predicts that the Skill will use `/tmp/installed.txt`. 2. The attacker creates a symbolic link at that path pointing to a file writable by the victim. 3. The victim runs the hallucinated-dependency analysis. 4. Shell redirection follows the symbolic link and truncates the target. 5. The output of `pip freeze` is written into the target file. 6. Subsequent package checks consume attacker-influenced or corrupted temporary data. ### Impact Assessment The attacker does not gain privileges beyond those of the invoking account. However, the vulnerability can overwrite or corrupt any file that the invoking ...[truncated 209 chars]
Remediation
View remediation
"$installed_file" grep -rh "^import \|^from " --include="*.py" . | \ sed 's/^import //;s/^from //;s/ import.*//' | \ sort -u | while IFS= read -r pkg; do root=$(printf '%s\n' "$pkg" | cut -d. -f1) grep -q -- "^$root" "$installed_file" || printf 'HALLUCINATED?: %s\n' "$pkg" done ``` Additional hardening should include: - Never use fixed names in a shared temporary directory. - Apply `umask 077` so other users cannot read generated metadata. - Quote all path and variable expansions. - Use a cleanup trap so temporary data is removed on normal exit and interruption. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
modules/git-history-analysis.md:229
Finding

Predictable Git cache file permits symbolic-link clobbering and metadata exposure

Content
View full analysis
/tmp/git_cache.txt # Query cache instead of running git log repeatedly grep "path/to/file" /tmp/git_cache.txt ``` ### Technical Analysis The Git cache is stored at the fixed path `/tmp/git_cache.txt`. The redirection operator truncates an existing destination and follows symbolic links. A local attacker can therefore pre-create that path as a link to another victim-writable file. The generated cache may also contain commit hashes, author names, dates, changed-path statistics, and information from all local refs. Because no restrictive permissions are established, the cache can be readable by other local users depending on the process umask. Parallel scans also share the same cache path and can corrupt each other's results. ### Attack Path 1. A local attacker creates `/tmp/git_cache.txt` as a symbolic link to a file writable by the victim. 2. The victim invokes Git history analysis. 3. Shell redirection follows the link and truncates the target. 4. Git history and author metadata are written into the target. 5. Alternatively, an attacker monitors or modifies the predictable cache during analysis. 6. The Skill reads corrupted cache content and may produce inaccurate audit conclusions. ### Impact Assessment The direct file-system impact is limited to files writable by the account executing the Skill. Possible consequences include data corruption, loss of repository-adjacent configuration, disclosure of Git author and history metadata, and manipulation of audit results. This issue does not independently provide privilege escalation. ]]>
Remediation
View remediation
"$git_cache" grep -- "path/to/file" "$git_cache" ``` For reusable caches: - Place the cache under a user-owned cache directory with mode `0700`. - Generate a repository-specific filename using a trusted identifier. - Create files atomically with exclusive creation semantics. - Reject symbolic links and files not owned by the current user. - Apply mode `0600` to cache files containing repository metadata. - Avoid sharing one cache path between concurrent scans. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
modules/quick-scan.md:47
Finding

Quick scan overwrites and deletes a fixed repository file

Content
View full analysis
recent_files.txt git ls-files | while read f; do if ! grep -qxF "$f" recent_files.txt; then last_modified=$(git log -1 --format="%ai" -- "$f") echo "$last_modified $f" fi done | sort rm recent_files.txt ``` ### Technical Analysis The scan uses `recent_files.txt` in the current repository as an implicit scratch file. If a regular file with that name already exists, it is silently truncated and later deleted. If the path is a symbolic link, redirection follows the link and overwrites its target before `rm` removes the workspace link. This is especially relevant when scanning untrusted repositories. A repository can intentionally contain a symbolic link named `recent_files.txt` that points outside the repository. Running what appears to be a read-only audit then modifies a file outside the scan target. The command also does not use a cleanup trap. If execution stops before the final `rm`, the generated file remains in the repository. ### Attack Path 1. An attacker prepares a repository containing `recent_files.txt` as a regular file or symbolic link. 2. For symbolic-link exploitation, the link points to a file writable by the victim. 3. The victim runs the quick-scan commands from the repository root. 4. Redirection truncates the existing file or follows the link and truncates its target. 5. Git output replaces the target's original contents. 6. The final `rm recent_files.txt` removes the repository entry without confirming that it is a scratch file created safely by the current process. ### Impact Assessment A malicious repository can cause modification of files outside its directory when scanned. The affected scope is li ...[truncated 311 chars]
Remediation
View remediation
"$recent_file" git ls-files -z | while IFS= read -r -d '' f; do if ! grep -qxF -- "$f" "$recent_file"; then last_modified=$(git log -1 --format="%ai" -- "$f") printf '%s %s\n' "$last_modified" "$f" fi done | sort ``` Further hardening should: - Treat scanned repositories as untrusted input. - Avoid creating files in the repository during read-only analysis. - Never remove a path unless its safe creation by the current process is guaranteed. - Use NUL-delimited Git output where practical to handle unusual filenames safely. - Document every command that can modify the workspace. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
modules/git-history-analysis.md:17
Finding

Git history analysis silently clobbers fixed workspace report files

Content
View full analysis
recent.txt comm -13 recent.txt <(git ls-files | sort) > stale_files.txt ``` ```bash # Find files where primary author has no recent commits git log --format="%an" --since="6 months ago" | sort -u > active_authors.txt git ls-files | while read file; do primary_author=$(git log --format="%an" -- "$file" | sort | uniq -c | sort -rn | head -1 | awk '{$1=""; print $0}' | sed 's/^ //') if ! grep -qF "$primary_author" active_authors.txt; then echo "$file - Primary author inactive: $primary_author" fi done ``` ### Technical Analysis The analysis writes to three fixed names in the current working directory: - `recent.txt` - `stale_files.txt` - `active_authors.txt` Each redirection silently truncates an existing destination and follows symbolic links. A crafted repository can include these names as links to external files. Running the audit can consequently overwrite targets outside the repository. Unlike the quick-scan example, these commands do not remove their scratch files, leaving repository and author metadata in the workspace. Existing project files with matching names are permanently replaced unless recoverable through version control or backup. ### Attack Path 1. An attacker adds one or more specially named files or symbolic links to a repository. 2. A victim clones or opens the repository and runs Git history analysis. 3. The `recent.txt` redirection overwrites the existing file or linked target. 4. The `stale_files.txt` and `active_authors.txt` redirections repeat the same behavior. 5. Generated repository and author metadata remain in the working tree. 6. If the outputs are later trusted, an attacker may also in ...[truncated 455 chars]
Remediation
View remediation
"$recent" comm -13 "$recent" <(git ls-files | sort) > "$stale" git log --format="%an" --since="6 months ago" | sort -u > "$active_authors" ``` If `stale_files.txt` is intended as a persistent report: - Require the user to specify the output path. - Refuse to overwrite existing files unless an explicit force option is supplied. - Reject symbolic-link destinations. - Write to a temporary file and atomically rename it after successful completion. - Set restrictive permissions when reports contain author or repository metadata. ]]>
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (10)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list is broad enough to match common developer requests such as cleanup, optimization, and static-analysis, which increases the chance this skill is invoked in situations the user did not explicitly intend. That can cause unnecessary loading of skill instructions and analysis behavior, creating context pollution and possibly steering workflows away from the user's immediate task.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file describes the module's purpose broadly but does not specify when the skill should activate, what exact trigger phrases invoke it, or any exclusion conditions. For a markdown skill description, that ambiguity can cause unintended invocation in general discussions about AI coding or code quality.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes a skill for detecting codebase bloat via dead code, duplication, complexity, and documentation scans, which implies local static analysis. However, the JavaScript dependency check uses npm view against the network, introducing remote lookups that are not reflected in the stated description.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

A bloat-detector skill is expected to inspect repository contents, history, and documentation, but not to contact external services. Using npm view adds a network capability unrelated to the core declared purpose of scanning codebase bloat patterns, especially since similar checks could be scoped locally.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill manifest describes detecting codebase bloat via dead code, duplication, complexity, and documentation bloat scans. This module adds analysis of orphaned feature branches, which is repository hygiene/branch lifecycle management rather than codebase bloat detection, and that capability is not justified by the stated purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module presents deletion-oriented recommendations such as 'DELETE' and 'Safe to remove' based on heuristic signals without an explicit, prominent warning that these checks can misclassify important files. In an agent context, users or downstream automation may over-trust the recommendation and remove necessary code, documentation, or entry points, causing outages, regressions, or loss of functionality.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The manifest frames the skill as detecting bloat, which suggests analytical/read-only behavior. The documented next step to 'Create cleanup PR' extends beyond detection into change-management/remediation workflow, which is broader than the described scanning purpose.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The thresholds section states that Markdown files over 300 lines are part of the scan, but the actual find command only includes *.py, *.js, and *.ts files. This is an active documentation-to-code contradiction about what the module detects, not just an omitted detail.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This markdown file includes executable shell snippets that write recent_files.txt and later remove it, but the surrounding prose does not clearly warn the user that running the example will modify the working directory. For markdown files, omissions of warnings about behaviors that could affect user data or system state should be flagged when the behavior is not explicitly disclosed.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The performance section says the method uses parallel grep and cache reuse, but the bash snippets shown use ordinary sequential grep/find pipelines and only create a temporary recent_files.txt within a single run. That temporary file is not reusable scan caching as documented, so the documentation overstates implemented behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.