Back to skill

Security audit

RTK Rewrite

Security checks for vulnerabilities and agentic risk

Overview

The plugin is openly designed to rewrite shell commands, but it does so automatically through an external PATH-resolved tool and includes unsafe install and logging patterns that deserve review before use.

Review before installing. Use only in an environment where you trust the exact rtk binary resolved by the OpenClaw gateway PATH, avoid the curl-to-sh installer, and consider keeping audit logging disabled unless logs are protected and you accept that commands may contain secrets. Be aware that enabling this plugin can automatically alter exec commands across OpenClaw agents.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
Findings (3)

T03 · Remote Payload Retrieval and Execution

Error
Location
README.md:17
Finding

Unverified Mutable Remote Script Is Piped Directly to a Shell

Content
View full analysis
Remediation
View remediation
install.sh" | sha256sum -c - less install.sh sh install.sh ``` 4. Document the files, directories, and executables created by the installer and explicitly warn users not to run it with unnecessary elevated privileges. ]]>

T07 · Tool Hijacking and Spoofing

Error
Location
index.ts:11
Finding

PATH-Resolved RTK Executable Can Replace Every Intercepted Shell Command

Content
View full analysis
}) => { if (event.toolName !== "exec") return; const command = event.params?.command; if (typeof command !== "string") { appendAudit(auditPath, "skip:non_string", "-"); return; } const result = tryRewrite(command); if (!result.rewritten) { appendAudit(auditPath, result.action, command); return; } const rewritten = result.rewritten; appendAudit(auditPath, "rewrite", command, rewritten); if (verbose) { console.log(`[rtk-rewrite] ${command} → ${rewritten}`); } return { params: { ...event.params, command: rewritten } }; }, { priority: 10 }, ); ``` ### Technical Analysis The plugin invokes `rtk` by executable name rather than by a trusted, administrator-configured absolute path. The operating system consequently resolves the executable using the OpenClaw process's `PATH`. The plugin then treats the executable's standard output as a complete replacement shell command without i ...[truncated 2091 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
index.ts:47
Finding

Audit Logs Persist Unredacted Commands and Allow Record Injection

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (8)

Chaining Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

Piping curl output directly to sh removes any opportunity for inspection and turns remote content into immediate code execution. In this plugin’s context, that is especially risky because the software modifies how an agent intercepts and rewrites shell commands, so compromise could lead to persistent execution of malicious logic in future agent workflows.

Content

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

bash
brew install rtk-ai/tap/rtk
# or
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

Install the plugin

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 27)May include surrounding context.

bash
# Copy the plugin to OpenClaw's extensions directory
mkdir -p ~/.openclaw/extensions/rtk-rewrite
cp openclaw/index.ts openclaw/openclaw.plugin.json ~/.openclaw/extensions/rtk-rewrite/

# Enable in OpenClaw config

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 · SKILL.md (reported line 2)May include surrounding context.

md
---
name: rtk-rewrite
version: "0.15.3"
author: "luw2007"
repository: "https://github.com/rtk-ai/rtk"

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

When auditing is enabled, the plugin writes full original and rewritten exec commands to a persistent log file on disk. Exec commands commonly contain secrets, file paths, tokens, hostnames, or other sensitive operational data, so this creates an unintended data-retention and disclosure risk beyond the plugin's stated rewrite role.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest advertises transparent, automatic rewriting of shell commands without defining any trigger boundaries, exclusions, or safety conditions. In a plugin that intercepts exec tool calls, this can silently alter command semantics, expand scope unexpectedly, or bypass user/operator expectations, increasing the chance of unsafe execution or policy evasion.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The plugin supports verbose logging and hook-style audit logs of rewrite decisions, which can create persistent records of commands, arguments, file paths, or other sensitive session data. If these logs are stored insecurely or enabled in sensitive environments, they may expose operational details or secrets long after the session ends.

Content

Scanner excerpt · openclaw.plugin.json (reported line 20)May include surrounding context.

json
"verbose": {
        "type": "boolean",
        "default": false,
        "description": "Log rewrite decisions to console for debugging"
      },
      "audit": {
        "type": "boolean",

External Script Fetching

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The README recommends fetching and executing an install script directly from a remote GitHub URL with no integrity verification or version pinning. If the upstream repository, branch, network path, or hosting account is compromised, users could execute attacker-controlled code immediately on their system.

Content

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

bash
brew install rtk-ai/tap/rtk
# or
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh

Install the plugin

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

A rewrite plugin would be expected to invoke the rewrite engine, but consulting RTK_AUDIT_DIR and HOME introduces ambient environment access tied to an auxiliary logging feature. Because the manifest only describes rewrite delegation, this environment-variable-based path resolution is not clearly justified by the declared purpose.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.