T09 · Insecure Skill Coding Practices
- Location
SKILL.md:93- Finding
Configuration Mutation and Repair Execution Bypass the Documented Confirmation Policy
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 93-100 and 134-140
Vulnerability Type: Automatic execution of medium-risk configuration changes
Risk Level: MediumVulnerable Code
powershell param( [switch]$Auto, # 自动模式(低风险操作) [switch]$DryRun, # 仅预览,不执行 [string]$BackupDir = "~\.openclaw\backups" ) $ErrorActionPreference = "Stop" $ConfigPath = "~\.openclaw\openclaw.json"powershell # 4. 保存变更 if ($migrated -and -not $DryRun) { $config | ConvertTo-Json -Depth 10 | Set-Content $ConfigPath Write-Host "[OK] Config updated" -ForegroundColor Green # 验证 openclaw doctor --fix }Technical Analysis
The script declares an
$Autoswitch but never evaluates it. Consequently, omitting-DryRunis sufficient to authorize both a configuration rewrite and execution ofopenclaw doctor --fix.This contradicts the skill's documented risk policy, which classifies configuration field updates as medium risk and states that they require user confirmation. The
--fixcommand is also a mutation-oriented operation rather than a read-only validation step. Its complete effects are not constrained or reviewed by the shown script.Although the code appears as an embedded script example in
SKILL.mdrather than as a standalone executable file, an agent or user following the skill would perform these operations with the privileges of the invoking OpenClaw process.Attack Path
- A legacy
gateway.authTokenfield is present in~\.openclaw\openclaw.json. - An agent or user invokes the documented script without
-DryRun, but without explicitly selecting or approving an automatic mutation mode. - The migration sets
$migratedto true. - The script serializes and overwrites the configuration file.
- It then invokes
openclaw doctor --fix, which may perform additional repairs not individually confirmed by the user. - The OpenClaw environment is altered despite the documented requirement fo ...[truncated 526 chars]
- A legacy
- Remediation
View remediation
Remediation Suggestions
- Require an explicit authorization switch before performing any mutation:
powershell if (-not $DryRun -and -not $Auto) { throw "Configuration changes require explicit confirmation or -Auto." }- Do not permit
$Autoto authorize medium-risk changes unless the documented policy is revised and the user explicitly opts into that behavior. - Separate validation from repair. Run a read-only diagnostic first, display the proposed repairs, and request confirmation before invoking
openclaw doctor --fix. - Present a change diff containing all fields that will be added, changed, or removed.
- Validate the generated configuration against the documented schema before replacing the active file.
- Check the exit status and postconditions of every repair operation, and automatically restore the backup if validation fails.
