T09 · Insecure Skill Coding Practices
- Location
scripts/example.py:42- Finding
Destructive Agent Deletion Bypasses the Required Confirmation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/example.py, lines 42–43 and 65–66
Vulnerability Type: Missing authorization-style confirmation for a destructive operation
Risk Level: MediumVulnerable Code
python p_delete = sub.add_parser("delete") p_delete.add_argument("name")python elif args.action == "delete": result = run(["openclaw", "agents", "delete", args.name])The required safety policy appears in
SKILL.md, lines 40–42 and 55:markdown - Delete: - Require explicit confirmation in the same turn for destructive action. - Then run: `openclaw agents delete <name>`markdown - Treat `agent delete` as destructive: confirm before running.Technical Analysis
The Skill documentation explicitly requires same-turn confirmation before deleting an agent. However, the deterministic helper accepts only the agent name for its
deletesubcommand and immediately invokesopenclaw agents delete. It has no confirmation option, matching-token check, or interactive confirmation mechanism.Consequently, the documented safeguard is enforced only through natural-language instructions and can be bypassed whenever the helper is invoked directly or mistakenly called without prior user confirmation. Although
subprocess.runreceives an argument array and does not introduce shell-command injection here, safe process invocation does not prevent unauthorized or accidental execution of the destructive operation.Attack Path
- An attacker, automation error, or misunderstood request causes the helper to be invoked as
scripts/example.py delete <agent-name>. - The argument parser accepts the target name without requesting confirmation.
- The delete branch constructs
["openclaw", "agents", "delete", args.name]. - The helper immediately executes that command.
- If the caller has sufficient local OpenClaw permissions, the selected agent is d ...[truncated 743 chars]
- An attacker, automation error, or misunderstood request causes the helper to be invoked as
- Remediation
View remediation
Remediation Suggestions
Enforce confirmation inside the executable helper rather than relying solely on Skill instructions:
- Add an explicit confirmation argument, such as
--confirm-delete <agent-name>. - Require the confirmation value to exactly match the deletion target.
- Refuse execution with a nonzero exit status when confirmation is absent or mismatched.
- Ensure the calling agent obtains explicit confirmation from the user in the same turn before supplying the flag.
- Where appropriate, first verify that the target exists and display the exact target to be deleted.
- Add automated tests proving that unconfirmed and mismatched deletion requests cannot invoke
openclaw.
Example hardening pattern:
python p_delete = sub.add_parser("delete") p_delete.add_argument("name") p_delete.add_argument("--confirm-delete", required=True) # ... elif args.action == "delete": if args.confirm_delete != args.name: parser.error("Deletion confirmation must exactly match the agent name") result = run(["openclaw", "agents", "delete", args.name])- Add an explicit confirmation argument, such as
