Back to skill

Security audit

token-slim

Security checks for vulnerabilities and agentic risk

Overview

This skill has a real token-saving purpose, but it also makes persistent agent-behavior changes and can install unpinned software, so it needs careful review before use.

Install only if you are comfortable with a token-cleanup skill that can alter your workspace files and persistent agent instructions. Review proposed changes before approving batch mode or brutal mode, prefer dry-run/offline use first, and avoid running the bundled installer unless you accept unpinned third-party package installation and tokenizer cache/network behavior.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:81
Finding

Persistent Agent Behavior Modification Through Workspace Configuration

Content
View full analysis
` anchor 2. If absent → append the full template (incl. brutal mode section — see `references/mode-a-onboarding.md` Step 8) 3. If present → replace the whole block with the full template 4. Reply: "🔥 Brutal mode enabled — concise outputs, no preamble." **Disable flow:** 1. Find the block `` … `` in the agent config 2. Replace the brutal-mode section with just a header placeholder: ``` ### 🔥 Brutal Mode (max output efficiency) ``` 3. Reply: "✅ Brutal mode disabled — back to normal." **First-time use (after Mode A Step 8 completes):** Proactively offer: > "🔥 Want to enable **brutal mode**? When on, the agent gives results only — no > step-by-step narration. Saves tokens and reading time. Say 'enable brutal mode' > to toggle (can be turned off anytime)." ``` Related mandatory persistence instructions also appear in `references/mode-a-onboarding.md:70-87` and `references/mode-a-onboarding.md:109-149`. ### Technical Analysis The Skill directs the executing agent to append or replace an instruction block in the workspace agent configuration. Such configuration is intended to be loaded in future sessions, so the modification remains effective after the original Skill invocation ends. The injected behavior changes how the agent responds, including suppressing preambles and step-by-step narration. The onboarding workflow characterizes these configuration writes as mandatory rather than treating them as an isolated preference for the current invocation. Replacing the entire anchored block also means previously configured content within those anchors can be ove ...[truncated 1343 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/install_tiktoken.py:99
Finding

Unpinned User-Level Package Installation From Multiple External Indexes

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/scan_workspace.py:88
Finding

Dry-Run Mode Can Create Files and Initiate an Outbound Download

Content
View full analysis
$TOKEN_SLIM_WORKSPACE > CWD workspace = ...[truncated 2243 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (29)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill markets itself as guided token optimization, but its instructions include operational behaviors with materially different risk, including package installation from remote sources, cache writes, and modification of agent configuration for 'brutal mode'. This mismatch can mislead users and orchestrators into invoking a skill with higher-privilege side effects than its declared purpose suggests, reducing informed consent and weakening security review.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

Forcing a Chinese-language user-facing prompt without checking user preference can mislead users about the meaning of consent or backup actions. In a workflow that performs file modifications, language mismatch increases the risk of uninformed approval and operational mistakes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Injecting Chinese-language session-discipline text into workspace configuration without user opt-in creates persistent behavior changes that may be unreadable or misleading to the user or collaborators. This is more dangerous than a transient message because the text remains active in future sessions and may be interpreted as authoritative policy.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill writes Chinese-language token-habit rules and completion messages into persistent config, including a default 'brutal mode' behavior that changes response style in later sessions. Without language opt-in and explicit consent to that behavior change, users may inherit hidden or poorly understood defaults that affect agent outputs and decision-making quality.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill supports a 'just do it all' batch mode that executes changes without per-item confirmation, but the workflow does not require a clear warning that files will be modified. Because the skill operates on a writable workspace, this creates a meaningful risk of unintended bulk edits, content movement, or destructive cleanup from an ambiguous or overly-trusted user prompt.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/install_tiktoken.py (reported line 152)May include surrounding context.

python
print(f"  → Fetching BPE vocab via tiktoken (cache → {cache_dir}) ...")

    env = os.environ.copy()
    env["TIKTOKEN_CACHE_DIR"] = str(cache_dir)

    code = (

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/install_tiktoken.py (reported line 179)May include surrounding context.

python
print(f"  → Fetching BPE vocab via tiktoken (cache → {cache_dir}) ...")

    env = os.environ.copy()
    env["TIKTOKEN_CACHE_DIR"] = str(cache_dir)

    code = (

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README emphasizes dry-run safety but does not prominently warn that the skill may modify workspace files and agent configuration after preview/confirmation. In the context of an agent skill that targets MEMORY.md, AGENTS.md, memory directories, and a 'brutal mode' config toggle, omission of an explicit modification warning can mislead users about operational risk and cause them to authorize the skill without informed consent.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill advertises broad natural-language trigger phrases like 'scan my workspace' and 'optimize tokens', which increases the chance of accidental invocation during ordinary conversation. Because this skill is designed to inspect workspace files and may guide or perform cleanup actions, unintended activation could lead to unnecessary scanning or modification-oriented workflows being initiated without clear user intent.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill describes and directly instructs use of file modification, shell execution, environment-dependent path resolution, and network-backed package installation, yet it declares no explicit tool scope or permission boundaries. In an agent runtime, that ambiguity can allow the skill to run with broader capabilities than users expect, increasing the chance of unsafe file edits or external fetches during normal use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list is very broad and includes common phrases like 'scan my workspace' and 'save tokens', making accidental activation plausible in ordinary conversation. Because the skill can lead to workspace scanning, config changes, and modification workflows, unintended invocation increases the risk of unnecessary disclosure or disruptive edits.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Using generic phrases like 'just do it' or '全部做' to enter batch mode is unsafe because those phrases commonly appear in unrelated conversations and would authorize multiple changes without per-item review. In this skill, batch mode removes an important safety barrier for destructive or configuration-altering actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger condition is vague enough that the onboarding flow may run when the user only asks for general token advice rather than consenting to a guided, file-modifying setup. In context, this is risky because the skill performs scanning and potentially persistent workspace changes, so ambiguous activation increases the chance of unauthorized or unexpected modifications.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The backup instructions are inconsistent: one section makes backups conditional on user confirmation, while the undo section says backups must always be created before any modification. In a file-modifying skill, this inconsistency can lead to irreversible edits or a false sense that rollback is available when it may not be.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The onboarding flow goes beyond token cleanup and persistently alters the workspace agent configuration, including behavioral rules that affect future sessions. This creates an integrity risk because a maintenance-oriented skill is silently expanding its authority to shape agent behavior long-term, which can surprise users and enable policy drift across the workspace.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The document instructs persistent modification of workspace configuration without a clear upfront warning that long-lived files will be edited. Because these changes affect future sessions, users may not realize they are consenting to more than a temporary cleanup, making this a meaningful transparency and integrity issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Replacing an entire existing config block without warning can overwrite prior customized content the user may rely on. In a persistent agent-config context, this can silently destroy user intent, alter behavior, and make recovery difficult if backups were not consistently created.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The re-scan trigger language is intentionally broad and includes common conversational phrases like 'scan again' and 'what else can I optimize', which can cause the skill to activate during ordinary discussion rather than from explicit consent to run workspace-scanning behavior. In a skill that can inspect and potentially modify files, accidental invocation increases the chance of unintended analysis or follow-on file operations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The installer makes outbound network connections to multiple package indexes and an external blob host, but the skill description emphasizes workspace token optimization rather than software installation and network retrieval. In an agent runtime, this expands the trust boundary: running the skill can fetch remote content and metadata from third parties, creating supply-chain and privacy exposure not obvious from the high-level capability description.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/install_tiktoken.py (reported line 53)May include surrounding context.

python
def _run(cmd, **kwargs):
    try:
        return subprocess.run(cmd, **kwargs)
    except (OSError, subprocess.SubprocessError) as e:
        result = subprocess.CompletedProcess(cmd, returncode=1)
        result.stdout = ""

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code installs software by invoking pip against remote indexes, which is a privileged capability compared with simple workspace analysis. Even without malicious intent, dynamic package installation can introduce arbitrary third-party code into the environment if indexes are compromised, package resolution changes, or dependency chains are unexpected.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The scanner silently initializes tiktoken in a way that may trigger a network fetch of tokenizer assets on first use. In an agent skill that is expected to scan local workspace content, undeclared outbound network activity expands the trust boundary, can violate sandbox or privacy expectations, and may leak operational metadata such as timing, host access, or that the scan was performed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Even if the tokenizer download is functionally legitimate, the code does not disclose to users that running the scan may require network access. In agent environments, hidden network dependencies are dangerous because they can break least-surprise guarantees, bypass operator expectations for local-only analysis, and create compliance issues in restricted or sensitive workspaces.

Content

No source excerpt is available for this finding.

Tainted flow: 'HISTORY_FILE' from os.environ.get (line 774, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/scan_workspace.py (reported line 391)May include surrounding context.

python
try:
        HISTORY_FILE.parent.mkdir(parents=True, exist_ok=True)
        history = history[-HISTORY_MAX:]
        with open(HISTORY_FILE, "w") as f:
            json.dump(history, f, ensure_ascii=False, indent=2)
    except Exception:
        # History write failure should not crash the scan report