T09 · Insecure Skill Coding Practices
- Location
src/tool.ts:65- Finding
Unredacted Sensitive Content Is Persisted in Audit Logs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent security-guard plugin, but it can persist sensitive message and tool contents in a local audit log without redaction.
Review this before installing in environments where prompts, tool parameters, or outgoing messages may contain API keys, private tokens, or sensitive business data. The plugin is not malicious, but its audit log can become a local store of the very secrets it is meant to protect; use a private audit path with restrictive permissions and prefer a version that redacts audit previews centrally before deployment.
src/tool.ts:65Unredacted Sensitive Content Is Persisted in Audit Logs
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).
# OpenClaw IronClaw Security Guard
Defense-in-depth guardrails for OpenClaw: block dangerous tool calls, detect prompt-injection patterns, redact secrets before outgoing messages, and keep an audit trail.
For Chinese docs, see [README.zh-CN.md](./README.zh-CN.md).
## Why this exists
Open-source and local-model workflows often fail in the same ways:
- destructive shell commands run too early
- sensitive paths or credentials leak into tool calls
- untrusted content tries to override system behavior
- agents forward secrets into chats, webhooks, or third-party tools
`ironclaw-security-guard` adds a lightweight security layer at OpenClaw's plugin hook surface without pretending to be a full sandbox or container runtime.
## What it adds
- dangerous shell command blocking
- sensitive path protection
- prompt-injection pattern detection
- outbound secret leak prevention
- secret redaction before
This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.
- destructive shell commands run too early
- sensitive paths or credentials leak into tool calls
- untrusted content tries to override system behavior
- agents forward secrets into chats, webhooks, or third-party tools
`ironclaw-security-guard` adds a lightweight security layer at OpenClaw's plugin hook surface without pretending to be a full sandbox or container runtime.
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
再跑一次手动安全扫描示例:
node --input-type=module -e "import('./src/config.ts').then(async ({ normalizeSecurityConfig }) => { const { createSecurityScanTool } = await import('./src/tool.ts'); const writes = []; const tool = createSecurityScanTool({ config: normalizeSecurityConfig({}), audit: { write: async (event) => writes.push(event) } }); const result = await tool.execute('demo', { toolName: 'shell', content: 'rm -rf /tmp/demo', redactPreview: true }); console.log(result.content[0].text); })"
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
再跑一次手动安全扫描示例:
node --input-type=module -e "import('./src/config.ts').then(async ({ normalizeSecurityConfig }) => { const { createSecurityScanTool } = await import('./src/tool.ts'); const writes = []; const tool = createSecurityScanTool({ config: normalizeSecurityConfig({}), audit: { write: async (event) => writes.push(event) } }); const result = await tool.execute('demo', { toolName: 'shell', content: 'rm -rf /tmp/demo', redactPreview: true }); console.log(result.content[0].text); })"
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
## 典型能力
- 拦截 `rm -rf`、`git reset --hard`、`curl ... | sh` 等危险模式
- 标记 `.env`、SSH key、`.pypirc`、`.npmrc`、云凭据等敏感路径
- 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成 `[REDACTED:...]`
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
## 典型能力
- 拦截 `rm -rf`、`git reset --hard`、`curl ... | sh` 等危险模式
- 标记 `.env`、SSH key、`.pypirc`、`.npmrc`、云凭据等敏感路径
- 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成 `[REDACTED:...]`
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
## 典型能力
- 拦截 `rm -rf`、`git reset --hard`、`curl ... | sh` 等危险模式
- 标记 `.env`、SSH key、`.pypirc`、`.npmrc`、云凭据等敏感路径
- 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成 `[REDACTED:...]`
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
## 典型能力
- 拦截 `rm -rf`、`git reset --hard`、`curl ... | sh` 等危险模式
- 标记 `.env`、SSH key、`.pypirc`、`.npmrc`、云凭据等敏感路径
- 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成 `[REDACTED:...]`
This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.
- 拦截 `rm -rf`、`git reset --hard`、`curl ... | sh` 等危险模式
- 标记 `.env`、SSH key、`.pypirc`、`.npmrc`、云凭据等敏感路径
- 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成 `[REDACTED:...]`
- 可选地只允许访问 allowlist 中的外部 host
This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.
- 拦截 `rm -rf`、`git reset --hard`、`curl ... | sh` 等危险模式
- 标记 `.env`、SSH key、`.pypirc`、`.npmrc`、云凭据等敏感路径
- 识别 “ignore previous instructions” 这类注入模式
- 在发消息前把敏感 token 替换成 `[REDACTED:...]`
- 可选地只允许访问 allowlist 中的外部 host
The code chunk only exports advisory prompt text; it does not implement enforcement, detection, redaction, or logging. While the guidance text mentions avoiding destructive commands, prompt injection, and secret leakage, it is descriptive/instructional rather than an actual guardrail mechanism. The declared description claims concrete protective capabilities such as blocking commands, detecting injections, redacting secrets, and audit logging, none of which are implemented in this code.
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
{
"toolName": "bash",
"content": "rm -rf /Users/dawei/.ssh && cat ~/.pypirc",
"redactPreview": true
}
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
{
"toolName": "bash",
"content": "rm -rf /Users/dawei/.ssh && cat ~/.pypirc",
"redactPreview": true
}
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
{
"toolName": "bash",
"content": "rm -rf /Users/dawei/.ssh && cat ~/.pypirc",
"redactPreview": true
}
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
```json
{
"toolName": "bash",
"content": "rm -rf /Users/dawei/.ssh && cat ~/.pypirc",
"redactPreview": true
}
```
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
{
"toolName": "bash",
"content": "rm -rf /Users/dawei/.ssh && cat ~/.pypirc",
"redactPreview": true
}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"\\.ssh(?:/|\\\\)",
"id_rsa",
"id_ed25519",
"/etc/shadow",
"/etc/sudoers",
"Library/Keychains",
"\\.openclaw/openclaw\\.json",
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"id_ed25519",
"/etc/shadow",
"/etc/sudoers",
"Library/Keychains",
"\\.openclaw/openclaw\\.json",
"\\.git/config",
"\\.npmrc",
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"Library/Keychains",
"\\.openclaw/openclaw\\.json",
"\\.git/config",
"\\.npmrc",
"\\.pypirc",
"\\.aws/credentials",
];
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"Library/Keychains",
"\\.openclaw/openclaw\\.json",
"\\.git/config",
"\\.npmrc",
"\\.pypirc",
"\\.aws/credentials",
];
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"Library/Keychains",
"\\.openclaw/openclaw\\.json",
"\\.git/config",
"\\.npmrc",
"\\.pypirc",
"\\.aws/credentials",
];
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"\\.git/config",
"\\.npmrc",
"\\.pypirc",
"\\.aws/credentials",
];
const DEFAULT_BLOCKED_COMMAND_PATTERNS = [
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
severity: "high",
},
{
label: "reveal system prompt",
regex: /\b(reveal|show|print|dump)\s+(the\s+)?(system prompt|developer message|hidden prompt)\b/gi,
severity: "high",
},
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
severity: "high",
},
{
label: "reveal system prompt",
regex: /\b(reveal|show|print|dump)\s+(the\s+)?(system prompt|developer message|hidden prompt)\b/gi,
severity: "high",
},
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
severity: "high",
},
{
label: "reveal system prompt",
regex: /\b(reveal|show|print|dump)\s+(the\s+)?(system prompt|developer message|hidden prompt)\b/gi,
severity: "high",
},