Back to skill

Security audit

OpenClaw Refactoring

Security checks for vulnerabilities and agentic risk

Overview

This refactoring skill is not clearly malicious, but it can rewrite or restore files in ways that are broader and less safe than its documentation says.

Review before installing. Use only on a backed-up Git working tree, run dry-run commands first, avoid broad roots, and do not use undo with any backup ID you did not verify. Treat the advertised extract/inline/move/batch features and safety claims as unreliable until the implementation is fixed.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/rename.py:93
Finding

Incorrect AST Source Offsets Can Corrupt Files During Rename Operations

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:46
Finding

Destructive Rename Is the Default Despite Documentation Claiming Default Preview

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/rename.py:251
Finding

Unvalidated Backup Identifier Allows Restoration from Arbitrary Directories

Content
View full analysis
Dict[str, Any]: """Undo a refactoring operation""" if backup_id is None: # Find most recent backup if not self.backup_dir.exists(): return {'success': False, 'message': 'No backups found'} backups = sorted(self.backup_dir.iterdir(), key=lambda x: x.stat().st_mtime, reverse=True) if not backups: return {'success': False, 'message': 'No backups found'} backup_path = backups[0] else: backup_path = self.backup_dir / backup_id if not backup_path.exists(): return {'success': False, 'message': f'Backup {backup_id} not found'} # Restore files from backup restored = 0 for backup_file in backup_path.rglob('*'): if backup_file.is_file(): rel_path = backup_file.relative_to(backup_path) target_path = self.root / rel_path target_path.parent.mkdir(parents=True, exist_ok=True) shutil.copy2(backup_file, target_path) restored += 1 return { 'success': True, 'message': f'Restored {restored} files from backup {backup_path.name}' } ``` ### Technical Analysis The caller-controlled `backup_id` is joined directly to `self.backup_dir` without format validation or a containment check. Python `pathlib` permits traversal components such as `..`; an absolute path can also replace the intended base path during path composition. The resulting path is accepted whenever it exists. The method recursively enumerates every file under that directory and copies it into the project root. It does not verify that the path represents a backup created by this tool, consult a trusted manifest, reject symbolic links, or restrict restored fi ...[truncated 1778 chars]
Remediation
View remediation
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

This finding indicates the skill may only implement a narrow rename workflow while claiming to be a broad, safe refactoring assistant with suggestions, batch support, and multiple transformation types. Such overstatement can mislead operators into relying on automation that lacks the promised analysis and safety checks, causing widespread incorrect edits across a codebase.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

This finding indicates the skill may only implement a narrow rename workflow while claiming to be a broad, safe refactoring assistant with suggestions, batch support, and multiple transformation types. Such overstatement can mislead operators into relying on automation that lacks the promised analysis and safety checks, causing widespread incorrect edits across a codebase.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding indicates the skill may only implement a narrow rename workflow while claiming to be a broad, safe refactoring assistant with suggestions, batch support, and multiple transformation types. Such overstatement can mislead operators into relying on automation that lacks the promised analysis and safety checks, causing widespread incorrect edits across a codebase.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises and documents operations that read and modify project files, but it declares no explicit tool scope or permissions boundary. In an agent environment, missing scope metadata can allow the skill to be invoked with broader-than-expected file access, increasing the chance of unintended or unsafe repository modifications.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code proceeds from preview directly to executing a multi-file rename operation once the command is run without --dry-run. Although it prints the planned changes, there is no interactive confirmation prompt or equivalent user acknowledgment immediately before the irreversible write phase, and the operation modifies user code across the project.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The skill content switches into Chinese for core usage instructions and feature descriptions, but does not state that the skill is Chinese-only or offer an alternative language/locale choice. This can violate the language/locale policy when users are implicitly forced into a specific language without opt-in.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.