Back to skill

Security audit

ctx-shrink

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-aligned but should be reviewed because it asks agents to run an externally installed, unpinned code-scanning tool over local projects.

Install only after verifying the upstream `ctx-shrink` source or using a pinned release with checksums. Run it with least privilege on the intended project only, review the generated `AI-CONTEXT.md` for sensitive filenames, endpoints, commit metadata, or architecture details before sharing it with any AI service, and avoid scanning repositories containing live credentials unless isolated.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
README.md:34
Finding

Execution of an Unpinned External Tool from a Mutable Upstream Source

Content
View full analysis
- Always read the output file after running ``` ### Technical Analysis The documented installation procedure clones and executes the mutable default branch of an external GitHub repository. It does not pin an immutable commit or release and does not require verification through a cryptographic checksum or signature. The skill package itself contains no `ctx-shrink` executable or implementation that can be reviewed as part of this audit. The operational instructions instead invoke `ctx-shrink` by its bare command name, causing the shell to resolve whichever executable appears first in `PATH`. Therefore, the code ultimately executed is not cryptographically tied to the artifact that was audited. The tool is intended to scan entire project directories, including potentially sensitive source code, environment files, private keys, certificates, endpoints, and configuration data. A substituted or compromised executable would consequently receive access to all files readable by the invoking user within the target project. The instruction prohibiting blind `curl` or `wget` installation reduces one class of remote-execution risk, but it does not eliminate the mutable-source ...[truncated 1583 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 91)May include surrounding context.

md
| File              | Size | Risk        |
|-------------------|------|-------------|
| .env.production   | 2.1 KB| 🔴 CRITICAL |
| config/secrets.yml| 145 B | 🔴 CRITICAL |

### 🔧 Quick Fix

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 97)May include surrounding context.

md
| File              | Size | Risk        |
|-------------------|------|-------------|
| .env.production   | 2.1 KB| 🔴 CRITICAL |
| config/secrets.yml| 145 B | 🔴 CRITICAL |

### 🔧 Quick Fix

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 92)May include surrounding context.

md
| File              | Size | Risk        |
|-------------------|------|-------------|
| .env.production   | 2.1 KB| 🔴 CRITICAL |
| config/secrets.yml| 145 B | 🔴 CRITICAL |

### 🔧 Quick Fix
Add these to your `.gitignore`:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 98)May include surrounding context.

md
| File              | Size | Risk        |
|-------------------|------|-------------|
| .env.production   | 2.1 KB| 🔴 CRITICAL |
| config/secrets.yml| 145 B | 🔴 CRITICAL |

### 🔧 Quick Fix
Add these to your `.gitignore`:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document asserts 'No packaging safety issues detected' while the same report notes missing basic repository hygiene such as the absence of a .gitignore file. This can create false assurance for users or downstream agents, causing them to trust a safety claim that may overlook packaging or publication mistakes and potentially expose unintended files or metadata.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file explicitly encourages feeding the project map to 'any AI agent' without warning that repository structure, filenames, commit metadata, and analysis summaries may be sensitive. In an AI-agent context, this increases disclosure risk because users may paste or upload context maps to third-party systems, exposing internal project information beyond what is necessary.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 41)May include surrounding context.

Option 2: Add to your PATH (user directory)

bash
mkdir -p ~/.local/bin
ln -sf "$(pwd)/ctx-shrink" ~/.local/bin/ctx-shrink
# Ensure ~/.local/bin is on PATH (e.g. in ~/.profile)