Back to skill

Security audit

Trunkate AI

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent context-compression purpose, but enabling it creates an always-on hook that can send conversation history to an external API, rewrite session history, and has a relative-path execution flaw.

Review carefully before installing. Only enable the hooks if you are comfortable sending redacted conversation history to Trunkate's service and allowing the returned summary to replace session history. Avoid setting TRUNKATE_API_URL except in a controlled development environment, protect TRUNKATE_API_KEY, and do not enable the hook in untrusted workspaces until the relative-path execution issue is fixed.

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

T07 · Tool Hijacking and Spoofing

Error
Location
hooks/openclaw/pre_request.py:11
Finding

Working-directory-relative hook path allows execution of a spoofed activator script

Content
View full analysis
/scripts/activator.py` will satisfy the check and be executed by the trusted Python interpreter. The code does not resolve the path using `__file__`, validate that the resulting path remains under the installed Skill root, or verify the script's identity. The environment whitelist limits exposure to unrelated environment variables, but the spoofed script still receives all `TRUNKATE_*` and `OPENCLAW_*` variables. These can include `TRUNKATE_API_KEY`, `OPENCLAW_HISTORY_PATH`, token metadata, and error information. The spoofed Python process also retains the filesystem and network privileges of the hook process. ### Attack Path 1. An attacke ...[truncated 1440 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/trunkate.py:7
Finding

Unrestricted API URL override can disclose credentials and session history to an attacker-controlled endpoint

Content
View full analysis
str: """Optimizes a prompt using the private Trunkate AI API.""" api_url = os.environ.get("TRUNKATE_API_URL", API_URL).rstrip("/") api_key = os.environ.get("TRUNKATE_API_KEY") if not api_key: print("Error: TRUNKATE_API_KEY required.", file=sys.stderr) return prompt payload = {"text": prompt, "budget": budget, "model": model} headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"} try: response = requests.post(f"{api_url}/optimize", json=payload, headers=headers, timeout=10) response.raise_for_status() return response.json().get("optimized_text", prompt) except Exception as e: print(f"Error optimizing prompt: {e}", file=sys.stderr) return prompt ``` From `scripts/activator.py:118-132`: ```python with open(history_path, "r") as f: history = f.read() # 4. Filter Sensitive Content LOCALLY before external transmission filtered_history, protected_blocks = _filter_sensitive_content(history) # 5. Invoke Semantic Pruner with safe, filtered text optimized_filtered = optimize_prompt(filtered_history, budget=target_budget) # 6. Restore Sensitive Content optimized = _restore_sensitive_content(optimized_filtered, protected_blocks) # 7. Emit state update directive if optimized and optimized != history: print(f"OPENCLAW_ACTION:SET_HISTORY={optimized}") ``` ### Technical Analysis `TRUNKATE_API_URL` is accepted without validating its scheme, hostname, port, or destination. The client attaches the bearer API key a ...[truncated 3089 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
Findings (26)

Tainted flow: 'headers' from os.environ.get (line 19, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/trunkate.py (reported line 22)May include surrounding context.

python
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
    
    try:
        response = requests.post(f"{api_url}/optimize", json=payload, headers=headers, timeout=10)
        response.raise_for_status()
        return response.json().get("optimized_text", prompt)
    except Exception as e:

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · CHANGELOG.md (reported line 27)May include surrounding context.

md
* initial release of trunkate-ai skill for openclaw ([14432c9](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/14432c9aa06e4604fd1e14244e595882deda9148))
* initial release of trunkate-ai skill for openclaw ([04efc07](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/04efc07eda1aef9a0daf59ad5ab037e56d76e46d))
* inject GH_TOKEN into publish env to fix node rate limit ([aaacd85](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/aaacd85cd03c30bc7003bd1b0fcdade5d2627449))
* Modify skill markdown ([5ccb7f7](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/5ccb7f769a27adf2b14d5b0d924aaffc164d7236))
* pass GITHUB_TOKEN to publish step to fix GitHub API rate limit ([98978c3](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/98978c3f43e73c675d3a7c886742a3fffd09bf28))
* re-verify automated publishing with npm install -g ([32ccc26](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/32ccc267f7824d7c03f19d44c90aa58f7cebc439))
* re-verify automated publishing with npx ([eccb6c4](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/eccb6c418543ed31828c6cd5b01503d5a7007905))

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · CHANGELOG.md (reported line 134)May include surrounding context.

md
* initial release of trunkate-ai skill for openclaw ([14432c9](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/14432c9aa06e4604fd1e14244e595882deda9148))
* initial release of trunkate-ai skill for openclaw ([04efc07](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/04efc07eda1aef9a0daf59ad5ab037e56d76e46d))
* inject GH_TOKEN into publish env to fix node rate limit ([aaacd85](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/aaacd85cd03c30bc7003bd1b0fcdade5d2627449))
* Modify skill markdown ([5ccb7f7](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/5ccb7f769a27adf2b14d5b0d924aaffc164d7236))
* pass GITHUB_TOKEN to publish step to fix GitHub API rate limit ([98978c3](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/98978c3f43e73c675d3a7c886742a3fffd09bf28))
* re-verify automated publishing with npm install -g ([32ccc26](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/32ccc267f7824d7c03f19d44c90aa58f7cebc439))
* re-verify automated publishing with npx ([eccb6c4](https://github.com/Trunkate-AI/trunkate-ai-skills/commit/eccb6c418543ed31828c6cd5b01503d5a7007905))

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

A second mismatch is the claim of API-based context optimization versus behavior centered on redaction/restoration and placeholder handling without evidence of actual optimization. Misrepresentation of functionality is dangerous because users may rely on claimed privacy and compression guarantees while the real system performs different processing on sensitive context.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A second mismatch is the claim of API-based context optimization versus behavior centered on redaction/restoration and placeholder handling without evidence of actual optimization. Misrepresentation of functionality is dangerous because users may rely on claimed privacy and compression guarantees while the real system performs different processing on sensitive context.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
70% 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 · hooks/openclaw/pre_request.py (reported line 22)May include surrounding context.

python
# Whitelist specific environment variables to minimize blast radius
        # and comply with ClawHub security health requirements.
        safe_env = {
            k: v for k, v in os.environ.items() 
            if k.startswith("TRUNKATE_") or k.startswith("OPENCLAW_") or k == "PATH"
        }

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 · scripts/activator.py (reported line 12)May include surrounding context.

python
def _filter_sensitive_content(text: str):
    """
    Extracts sensitive content (System Prompts, .env blocks, [KEEP] tags, [PRIVATE] tags,
    and common secrets) LOCALLY and replaces them with indexed placeholders 
    to prevent data exfiltration. Private data never leaves the client.
    """

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 · scripts/activator.py (reported line 40)May include surrounding context.

python
def _filter_sensitive_content(text: str):
    """
    Extracts sensitive content (System Prompts, .env blocks, [KEEP] tags, [PRIVATE] tags,
    and common secrets) LOCALLY and replaces them with indexed placeholders 
    to prevent data exfiltration. Private data never leaves the client.
    """

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/trunkate.py (reported line 16)May include surrounding context.

python
if not api_key:
        print("Error: TRUNKATE_API_KEY required.", file=sys.stderr)
        return prompt
    
    payload = {"text": prompt, "budget": budget, "model": model}
    headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/trunkate.py (reported line 27)May include surrounding context.

python
if not api_key:
        print("Error: TRUNKATE_API_KEY required.", file=sys.stderr)
        return prompt
    
    payload = {"text": prompt, "budget": budget, "model": model}
    headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
97% confidence
Finding

The skill declares executable scripts, environment-variable requirements, file/history access, shell installation, and network use to a private API, but does not define an explicit tool scope or permissions boundary in machine-readable form. That creates a trust gap where an agent platform may grant broader capabilities than users expect, especially for an always-on hook that can read session history and send it externally.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Configuring a PreRequest hook to run on every model call creates broad, automatic invocation with access to live conversation state. In this context, that is risky because it can silently process or transmit all sessions, magnifying privacy exposure and making failures systemic rather than isolated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill describes emergency history wipes on error without a strong user-facing warning about context loss or potential deletion of valuable session state. Even if intended for recovery, an automatic destructive response can erase auditability, user work product, or safety-critical instructions at exactly the moment something has already gone wrong.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Although the document mentions that enabling the PreRequest hook transmits session history to a private API, the disclosure is not prominent enough for a background, always-on data export feature. This is dangerous because users may follow setup steps without appreciating that their ongoing conversations could be continuously sent to a third party.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger guidance uses vague internal-state signals such as confusion, repetition, or hallucination as reasons to invoke truncation. Ambiguous conditions can cause unpredictable or excessive activation, increasing the chance that sensitive or important context is pruned or sent to an API without a clear, auditable threshold.

Content

No source excerpt is available for this finding.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Content

Scanner excerpt · SKILL.md (reported line 257)May include surrounding context.

md
To comply with OpenClaw automated health/safety grades:

* **Safety Boundaries**: When performing shell execution (`exec`) to run local Python scripts (such as `activator.py` or `.openclaw` hooks), the skill is strictly restricted to semantic compression and logging. The hook execution environment is whitelisted (minimized) to only pass necessary `TRUNKATE_*` and `OPENCLAW_*` variables, preventing unauthorized access to other workspace secrets. It contains safety boundaries to ensure it does not execute unknown payloads, access external network resources (other than api.trunkate.ai for optimization), or execute arbitrary code. **Privacy**: Content wrapped in `[PRIVATE]…[/PRIVATE]` tags is automatically extracted locally and replaced with `__PRIVATE_N__` placeholders before any API call — the original private data never leaves your machine. Additionally, `[KEEP]` blocks, `<system>` tags, `.env` markdown blocks, and regex-detected secrets are also stripped locally. Note that the regex-based auto-detection may not catch all generalized secrets; use explicit `[PRIVATE]` tags for guaranteed protection.
* **Permissions**: This skill **does not** require "Human-in-the-loop" approval because it does not perform destructive actions (like deleting tickets or pushing code). It operates purely on localized context and data streams.

---

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file claims the skill operates purely on localized context and data streams, but elsewhere says the hook automatically transmits session history to the Trunkate API. Contradictory safety documentation can mislead users into enabling external data transfer they would otherwise reject, undermining informed consent and privacy review.

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 · hooks/openclaw/pre_request.py (reported line 26)May include surrounding context.

python
if k.startswith("TRUNKATE_") or k.startswith("OPENCLAW_") or k == "PATH"
        }
        
        subprocess.run(
            [sys.executable, script_path], 
            env=safe_env, 
            check=True

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation directs users to register automatic hook scripts that will execute inside the agent environment, but it does not clearly warn that these hooks run commands automatically with the agent's available permissions. In an agent ecosystem, auto-executed hooks materially increase attack surface because users may enable them without understanding that every request or error path can trigger code execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The guide requires an API key and documents transmission to a remote optimization service, but it does not warn users that agent context/history may be sent off-host to a third-party API. Because this skill is specifically for context optimization, the transmitted data may include sensitive prompts, file contents, secrets, or operational metadata, making the omission security-relevant.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

Referencing an external API endpoint is not inherently malicious, but in this skill it is coupled with behavior that POSTs full prompt/history and then injects the returned content back into agent memory. That makes the integration security-relevant: sensitive context is exfiltrated to a third party, and the agent becomes dependent on untrusted transformed content from an external service.

Content

Scanner excerpt · references/openclaw-integration.md (reported line 12)May include surrounding context.

md
## 2. API Endpoint Specification

- **URL**: `https://api.trunkate.ai/optimize` (Configurable via `TRUNKATE_API_URL`).
- **Method**: `POST`.
- **Auth**: `Authorization: Bearer <TRUNKATE_API_KEY>`.
- **Payload Schema**:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document explicitly states that the full prompt or history text is sent to an external optimization API, but it provides no user warning, consent flow, data minimization guidance, or privacy controls. In an agent context, prompt/history commonly contains sensitive user data, secrets, system prompts, or proprietary content, so silent transmission materially increases confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: requests==2.31.0 — 6 advisory(ies): CVE-2024-47081 (Requests vulnerable to .netrc credentials leak via malicious URLs); CVE-2024-35195 (Requests `Session` object does not verify requests after making first request wi); CVE-2026-25645 (Requests has Insecure Temp File Reuse in its extract_zipped_paths() utility func) +3 more

Medium
Category
Supply Chain
Confidence
96% confidence
Finding

The file pins requests to 2.31.0, which is identified by the provided static analysis as having multiple published advisories. Using a known vulnerable dependency is a real supply-chain risk because any code path in the skill or its transitive tooling that performs affected HTTP operations could expose credentials, weaken TLS/session verification, or trigger other dependency-specific flaws. Given this skill sends large text/context to an external API, HTTP client safety is directly relevant and increases the practical risk.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

This skill is explicitly designed to send supplied text to an external API, which creates a real data exfiltration surface even if it is intended functionality. Because the skill semantically optimizes context history, the transmitted data may include highly sensitive prior messages, credentials, internal prompts, or personal data, making the context more dangerous than ordinary outbound telemetry.

Content

Scanner excerpt · scripts/trunkate.py (reported line 22)May include surrounding context.

python
headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
    
    try:
        response = requests.post(f"{api_url}/optimize", json=payload, headers=headers, timeout=10)
        response.raise_for_status()
        return response.json().get("optimized_text", prompt)
    except Exception as e:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The function transmits the full prompt text to a third-party API without any explicit user-facing notice or consent mechanism at the point of use. In an agent skill focused on context history and pruning, prompts may contain sensitive conversation history, secrets, or proprietary data, so silent transmission materially increases privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.