Back to skill

Security audit

Text Compressor

Security checks for vulnerabilities and agentic risk

Overview

The advertised text-compression skill includes unrelated packaging scripts, including one that executes code from a hard-coded external workspace path if run.

Review this before installing. The text compression script itself is simple local file processing, but the package includes unrelated packaging helpers, one of which can execute Python code from an external user-specific OpenClaw workspace path. Only use it if you trust the publisher and remove or ignore the packaging scripts; keep backups because higher compression levels and decompression are lossy/approximate.

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

T07 · Tool Hijacking and Spoofing

Warning
Location
pack.py:1
Finding
External Module Execution Through a Hard-Coded Import Path## Vulnerability Details **File Location**: `pack.py`, lines 1-4 **Vulnerability Type**: Untrusted Python module resolution and execution **Risk Level**: Medium ```python import sys sys.path.insert(0, r'C:\Users\funky\.openclaw\workspace\skills\skill-creator\scripts') import package_skill package_skill.main() ``` ### Technical Analysis The script prepends a hard-coded, external workspace directory to Python's module search path. It then imports `package_skill` from that preferred location and immediately invokes its `main()` function. Because `package_skill.py` is not included in the audited project, its behavior and integrity cannot be verified as part of this Skill. Python executes module-level code during import, meaning arbitrary code can run even before the explicit `package_skill.main()` call. If another party can create or replace the module in the referenced directory, the legitimate-looking packaging script becomes an execution channel for that party's code. ### Attack Path 1. An attacker obtains write access to: `C:\Users\funky\.openclaw\workspace\skills\skill-creator\scripts` 2. The attacker creates or replaces `package_skill.py` with a malicious implementation. 3. The user runs `pack.py`, believing it to be a benign packaging utility. 4. `sys.path.insert(0, ...)` gives the external directory precedence during module resolution. 5. Python imports the attacker-controlled module and executes its top-level statements. 6. The script subsequently calls the attacker's `main()` function. ### Impact Assessment Successful exploitation permits arbitrary Python code execution with the same operating-system privileges as the user running `pack.py`. The resulting scope can include reading or modifying files available to that account, accessing process environment data, launching child processes, and performing other actions allowed by the user's permissions. Exploitation requires write access to the hard-co ...[truncated 199 chars]
Remediation
## Remediation Suggestions - Remove the hard-coded external directory insertion from `sys.path`. - Bundle the packaging implementation within the project and import it through an explicit project-relative package path. - Prefer a direct entry point whose implementation is included in the reviewed artifact. - If an external component is unavoidable, load it from a trusted, administrator-controlled location and verify its cryptographic hash or signature before execution. - Restrict write permissions on any directory containing executable Python modules. - Avoid executing substantive behavior automatically at import time. - Add an explicit `if __name__ == "__main__":` entry-point guard and invoke only a locally verified implementation.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
Packaging a skill directory into a ZIP archive, reading metadata, and traversing the filesystem are materially different capabilities from compressing a single text file for readability. If hidden behind broad activation phrases, this could be abused to collect and bundle unrelated local files or internal project contents for later exfiltration.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Packaging a skill directory into a ZIP archive, reading metadata, and traversing the filesystem are materially different capabilities from compressing a single text file for readability. If hidden behind broad activation phrases, this could be abused to collect and bundle unrelated local files or internal project contents for later exfiltration.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
Packaging a skill directory into a ZIP archive, reading metadata, and traversing the filesystem are materially different capabilities from compressing a single text file for readability. If hidden behind broad activation phrases, this could be abused to collect and bundle unrelated local files or internal project contents for later exfiltration.

Description-Behavior Mismatch

High
Confidence
97% confidence
Finding
The file does not implement any text compression or decompression logic; instead, it alters Python's import path and invokes an external packaging script from a different skill workspace. This mismatch between the advertised purpose and the actual behavior is dangerous because it can conceal unrelated or unauthorized code execution behind an innocuous skill description, increasing the risk of supply-chain abuse or covert repackaging actions.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The script packages every file under the skill directory into a distributable .skill archive, which is behaviorally broader than the declared purpose of a text compression skill. This creates a supply-chain risk because arbitrary embedded files, helper scripts, secrets, or unexpected payloads can be bundled and redistributed without restriction or review.

Lp3

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding
The skill advertises file-processing behavior but does not declare any explicit tool scope or permissions, which weakens containment and reviewability. In an agent environment, undocumented file read/write capability increases the chance that the skill is invoked with broader filesystem access than users or orchestrators expect.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases are broad enough to match routine requests like 'clean up,' 'optimize,' or 'reduce' text, which increases the likelihood of unintended invocation. In combination with the other mismatched behaviors, broad triggering makes the skill more dangerous because hidden file or packaging actions could run in contexts where the user only expected minor text editing.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The script imports and executes package_skill.main() from an external path under another workspace, which is unrelated to text compression and creates a direct code-execution dependency on out-of-scope local files. This is dangerous because the runtime behavior depends on mutable external code that can package, modify, or access files unexpectedly, making the skill capable of performing hidden actions not disclosed by its manifest.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The code defines paths and output behavior for creating a skill archive, which is not justified by the advertised text compression/decompression functionality. In context, this expands the skill's capability into repackaging and redistribution, increasing the chance of covert payload inclusion or misuse as an unauthorized packaging tool.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
At L128 the function is documented as "Reverse compression - restore original text," which implies faithful recovery of prior content. The very next comment at L129 admits full restoration is not possible, and the loop at L160-L161 repeatedly assigns replacements from the original content rather than the evolving result, so the behavior does not match the stated intent.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The code explicitly states that decompression "can't fully restore originals" and later writes the result to disk. Although the script prints completion messages, there is no user-facing warning before or at write time that this operation may produce lossy output, which could affect user data integrity.

Static analysis

No suspicious patterns detected.