Back to skill

Security audit

ClawDef

Security checks for vulnerabilities and agentic risk

Overview

ClawDef is a coherent local OpenClaw cost dashboard, but it has material review concerns around sensitive transcript storage, admin setup, provider credential handling, and overprivileged service guidance.

Review this carefully before installing. Run it only as the intended OpenClaw user on a trusted machine, avoid the root systemd service as written, initialize the admin account immediately, treat the SQLite database as sensitive because it may contain tool arguments, and avoid custom provider URLs unless you trust the destination with the associated API key.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
Findings (6)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/server.js:641
Finding

Unauthenticated First-Run Administrator Takeover

Content
View full analysis
res.json({ needs: !isSetupDone() }) ); app.post('/api/auth/setup', (req, res) => { if (isSetupDone()) return res.status(400).json({error:'Admin already configured'}); const { password } = req.body; if (!password || password.length < 6) return res.status(400).json({ error:'Password must be at least 6 characters' }); db.prepare( 'UPDATE admin_users SET password_hash=? WHERE username=?' ).run(bcrypt.hashSync(password,10),'admin'); console.log('[clawdef] ✅ Admin password set via setup page'); res.json({success:true}); }); ``` ### Technical Analysis The first-run setup endpoint assigns the password of the pre-created administrator account without authenticating the caller. It does not require a setup secret, terminal confirmation, operating-system identity verification, or proof that the caller launched the service. Binding the application to `127.0.0.1` reduces remote exposure but does not provide an authentication boundary. Other users, compromised applications, browser extensions, or malicious local processes can access localhost. The unauthenticated `/api/auth/setup-needed` endpoint also reveals whether the takeover opportunity is available. The operation is race-based: whichever caller reaches `/api/auth/setup` first controls the administrator account. ### Attack Path 1. The operator launches ClawDef for the first time. 2. The database contains the `admin` account with an empty password hash. 3. An untrusted local process polls `/api/auth/setup-needed`. 4. When setup is available, it sends a JSON POST request to `/api/auth/set ...[truncated 902 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/server.js:357
Finding

Sensitive Tool Arguments Persisted Without Redaction

Content
View full analysis
{ const { from, to, skill, tool, limit=100 } = req.query; let sql=`SELECT * FROM tool_calls WHERE 1=1`; const params=[]; if(from){sql+=' AND timestamp>=?';params.push(from);} if(to){sql+=' AND timestamp<=?';params.push(to);} if(skill){sql+=' AND skill_name=?';params.push(skill);} if(tool){sql+=' AND tool_name=?';params.push(tool);} sql+=' ORDER BY timestamp DESC LIMIT ?'; params.push(+limit); res.json({ data:db.prepare(sql).all(...params) }); }); ``` ### Technical Analysis ClawDef needs token counts, model identifiers, and tool names for its declared monitoring functionality. It does not need complete serialized tool arguments. Tool arguments can contain: - API keys, bearer tokens, and passwords. - File contents or filesystem paths. - Private prompts and personal information. - Command arguments. - Document contents. - Internal URLs and business data. The collector copies these values into `clawdef.db` without field allowlisting, recursive secret redaction, encryption, or a retention policy. This creates an additional persistent copy of sensitive session data. The `/api/tools` route uses authentication but no role restriction, meaning Viewer accounts c ...[truncated 1182 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
public/index.html:510
Finding

Stored DOM Cross-Site Scripting Through Provider and Model Data

Content
View full analysis
' + '
' + '
'+k+ (isActive?' Active':'')+ '
' + '
' + '⚡' + '✏️' + '🗑️' + '
' + '
' + '
'+v.baseUrl+'
' + '
'+ (v.models||[]).map(function(m){ return ''+ (typeof m==='string'?m:m.id)+ ''; ...[truncated 2630 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/server.js:463
Finding

Arbitrary Provider Health-Check Destination Receives Stored API Credentials

Content
View full analysis
{ const { name, baseUrl, apiKey, api, models } = req.body; if (!name || !baseUrl) return res.status(400).json({error:'name and baseUrl required'}); const cfg = getOpenClawConfig(); if(!cfg.models) cfg.models={providers:{},mode:'merge'}; if(!cfg.models.providers) cfg.models.providers={}; const existing = cfg.models.providers[name] ...[truncated 2762 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:88
Finding

Documented Persistent Service Runs as Root by Default

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/install.sh:25
Finding

Non-Reproducible Dependency Installation With Lifecycle-Script Exposure

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
Findings (41)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The skill describes itself as a local dashboard, but the documented behavior includes administrative account management, config mutation, skill enable/disable control, chat proxying, provider configuration, and outbound health checks. This is materially more powerful than a passive dashboard and the privacy claim that 'no data is sent to any third-party server' is undermined by user-configured provider communications, creating a misleading trust boundary for users.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill describes itself as a local dashboard, but the documented behavior includes administrative account management, config mutation, skill enable/disable control, chat proxying, provider configuration, and outbound health checks. This is materially more powerful than a passive dashboard and the privacy claim that 'no data is sent to any third-party server' is undermined by user-configured provider communications, creating a misleading trust boundary for users.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

bash
# Stop service if using systemd
sudo systemctl stop clawdef && sudo systemctl disable clawdef
# Delete files
rm -rf /opt/openclaw-monitor

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

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

Stop service if using systemd

sudo systemctl stop clawdef && sudo systemctl disable clawdef

Delete files

rm -rf /opt/openclaw-monitor

text

## Supported Providers

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

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

Stop service if using systemd

sudo systemctl stop clawdef && sudo systemctl disable clawdef

Delete files

rm -rf /opt/openclaw-monitor

text

## Supported Providers

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · public/index.html (reported line 168)May include surrounding context.

html
</div>
  </div>
  <div class="main">
    <!-- Dashboard -->
    <div class="page active" id="page-dashboard">
      <div class="ph"><h2>💰 <span data-i18n="n_dash">省钱总览</span></h2><div class="act"><button class="btn btn-g btn-sm" onclick="loadDash()">🔄</button></div></div>
      <div class="sg">

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The frontend renders full stored provider API keys in the provider management view, exposing highly sensitive secrets to anyone with dashboard access or shoulder-surfing/screenshot access. In a tool advertised as privacy-focused and local, secret disclosure in cleartext is especially dangerous because it enables full compromise of connected model accounts and billing.

Content

No source excerpt is available for this finding.

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · public/index.html (reported line 243)May include surrounding context.

html
<div class="sg"><div class="sc"><div class="lb">今日已用</div><div class="vl" id="bu-d">-</div><div class="sb" id="bu-dc"></div></div><div class="sc"><div class="lb">本月已用</div><div class="vl" id="bu-m">-</div><div class="sb" id="bu-mc"></div></div></div>
      <div id="buCards"></div>
    </div>
    <!-- Chat -->
    <div class="page" id="page-chat">
      <div class="ph"><h2>💬 <span data-i18n="n_chat">AI 对话</span></h2></div>
      <div class="chat-c"><div class="chat-msgs" id="chatMsgs"><div class="chat-m sys">通过此界面直接与 OpenClaw Agent 对话</div></div>

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The provider management code explicitly displays v.apiKey in the page, which means stored secrets are exposed in the DOM without masking or warning. Any XSS, browser extension, shared workstation, screen capture, or unauthorized dashboard access would immediately leak reusable credentials for third-party providers.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill metadata explicitly claims it 'does not send user data to third parties', yet the code supports configuring and health-checking external providers and can route prompts to provider APIs. This is a security-relevant trust violation because operators may deploy it under a false assumption about data locality, causing sensitive prompts, model selections, and API-linked metadata to leave the host.

Content

No source excerpt is available for this finding.

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

md
- `/tmp/openclaw/*.log` — Gateway logs (for request tracking)
- `~/.openclaw/workspace/skills/*/SKILL.md` — Installed skill metadata

### Read + Write
- `~/.openclaw/openclaw.json` — Writes to `agents.defaults.model.primary` (model switching) and `skills.entries` (skill enable/disable). No other fields are modified.
- `<install_dir>/data/clawdef.db` — Local SQLite database for monitoring data, user accounts, and optimization logs

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding

The skill declares capabilities that clearly involve network access, local file manipulation, and shell-based installation/startup steps, but does not declare any explicit tool scope or permissions boundary. That omission weakens reviewability and can cause users or orchestration systems to underestimate the skill's real authority, especially because it can modify OpenClaw configuration and start a local service.

Content

No source excerpt is available for this finding.

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

md
CLAWDEF_DIR=/opt/openclaw-monitor   # or any directory you prefer
SKILL_DIR=~/.openclaw/workspace/skills/clawdef

mkdir -p "$CLAWDEF_DIR/data" "$CLAWDEF_DIR/public/lib"
cp "$SKILL_DIR/scripts/server.js" "$CLAWDEF_DIR/server.js"
cp "$SKILL_DIR/scripts/package.json" "$CLAWDEF_DIR/package.json"
cp "$SKILL_DIR/public/index.html" "$CLAWDEF_DIR/public/index.html"

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

The install script copies files only. To run as a persistent service, create a systemd unit manually:

bash
sudo tee /etc/systemd/system/clawdef.service << EOF
[Unit]
Description=ClawDef Token Optimizer
After=network.target

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

The install script copies files only. To run as a persistent service, create a systemd unit manually:

bash
sudo tee /etc/systemd/system/clawdef.service << EOF
[Unit]
Description=ClawDef Token Optimizer
After=network.target

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

The install script copies files only. To run as a persistent service, create a systemd unit manually:

bash
sudo tee /etc/systemd/system/clawdef.service << EOF
[Unit]
Description=ClawDef Token Optimizer
After=network.target

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

The install script copies files only. To run as a persistent service, create a systemd unit manually:

bash
sudo tee /etc/systemd/system/clawdef.service << EOF
[Unit]
Description=ClawDef Token Optimizer
After=network.target

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

The instructions establish persistence via 'systemctl enable --now clawdef', causing the software to auto-start on boot. Persistence is expected for a dashboard service, but it still increases attack surface because a compromised or vulnerable local web service will remain continuously available and restart automatically.

Content

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

EOF

sudo systemctl daemon-reload sudo systemctl enable --now clawdef

text

## File Access

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The UI includes a general-purpose AI chat interface that directly talks to the OpenClaw agent, which materially expands the skill from a token dashboard into an agent interaction surface. This increases exposure to prompt injection, data disclosure, and unintended agent actions, especially because it is embedded in an administrative console rather than clearly isolated as a separate feature.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The dashboard exposes restart and emergency shutdown controls for the gateway, giving the web UI operational control over backend availability. This is broader than the described optimization role and creates a denial-of-service capability if the UI or session is compromised.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The settings page exposes user administration, account creation, deletion, and password management features that go well beyond a simple token optimization dashboard. This broadens the attack surface into identity and privilege management; any authorization weakness elsewhere would have more severe consequences because an attacker could create or alter users.

Content

No source excerpt is available for this finding.

Unbounded Output

Medium
Category
Output Handling
Confidence
75% confidence
Finding

Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Content

Scanner excerpt · public/lib/chart.min.js (reported line 13)May include surrounding context.

js
* https://github.com/kurkle/color#readme
 * (c) 2023 Jukka Kurkela
 * Released under the MIT License
 */function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function zt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function Ft(t,e,i){return zt(Lt,t,e,i)}function Vt(t){return(t%360+360)%360}function Bt(t){const e=Tt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?vt(+e[5]):Mt(+e[5]));const n=Vt(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return zt(Rt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return zt(Et,t,e,i)}(n,o,a):Ft(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const Wt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg"
...[truncated 28 chars]

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill manifest says this skill is a local token-optimization dashboard for OpenClaw focused on token usage, cost estimation, model switching, provider setup, budget control, and waste detection. In contrast, the package description states "OpenClaw skill monitoring and security management system," which indicates a materially different product scope centered on monitoring/security rather than token optimization.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The top-level descriptive text presents the platform identity and core messaging only in Chinese for key behavior descriptions, and later user-facing strings are also predominantly Chinese. This can constitute a language/locale policy violation because the skill does not offer a language choice or document that it is intentionally region-specific.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/server.js (reported line 188)May include surrounding context.

js
openai: {
    name: 'OpenAI',
    icon: '🇺🇸',
    baseUrl: 'https://api.openai.com/v1',
    api: 'openai-completions',
    models: ['gpt-4o', 'gpt-4o-mini', 'o3-mini'],
    keyHint: '前往 https://platform.openai.com/api-keys 获取 API Key',

Static analysis

Detected: suspicious.destructive_delete_command

Documentation contains a destructive delete command without an explicit confirmation gate.

Warn
Code
suspicious.destructive_delete_command
Location
SKILL.md:146