T09 · Insecure Skill Coding Practices
- Location
skill_cleaner.py:161- Finding
Cleanup Logic Can Forcibly Uninstall Healthy Skills
- Content
View full analysis
str: logs = [] for skill in invalid_skills: name = skill["name"] if action == "disable": cmd = ["openclaw", "skills", "disable", name] elif action == "uninstall": cmd = ["openclaw", "skills", "uninstall", name, "--force"] else: continue output = run_cli(cmd) logs.append(f"[{name}] {output}") return "\n".join(logs) def main(): if len(sys.argv) > 1 and sys.argv[1] == "clean": if len(sys.argv) < 4: print( "用法: python skill_cleaner.py clean " ) return action = sys.argv[2] skill_list = [s.strip() for s in sys.argv[3].split(",")] diagnostics = [diagnose_skill({"name": name}) for name in skill_list] print(perform_cleanup(diagnostics, action)) return ``` ### Technical Analysis The cleanup command diagnoses each requested skill but passes every diagnostic result directly to `perform_cleanup()`. It does not verify that the resulting status is invalid before executing a destructive operation. Consequently, a skill for which `diagnose_skill()` returns `SkillStatus.VALID` is still disabled or forcibly uninstalled. The parameter name `invalid_skills` does not enforce any security property. The use of `--force` further removes opportunities for the underlying OpenClaw command to request confirmation. This contradicts the documented workflow, which states that invalid skills should be presented to the user and cleaned only after confirmation. The subprocess call uses an argument list rather than a shell command, so this is ...[truncated 1249 chars]- Remediation
View remediation
