Back to skill

Security audit

OpenClaw故障排除工具

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real troubleshooting tool, but its repair paths can automatically install software and loosen permissions across the OpenClaw workspace without clear user confirmation.

Review this skill before installing on a shared or sensitive machine. Use diagnostic commands first, avoid quick_start.py and fix all unless you have reviewed the exact effects, back up the OpenClaw workspace, and prefer running dependency repairs in an isolated virtual environment rather than allowing system or user-level pip changes.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (2)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/openclaw_troubleshooting.py:291
Finding
Recursive Permission Repair Exposes the Entire OpenClaw Workspace<![CDATA[ ## Vulnerability Details **File Location**: `scripts/openclaw_troubleshooting.py`, lines 291–302 **Vulnerability Type**: Excessive recursive permission modification **Risk Level**: High ### Vulnerable Code ```python def fix_permissions(self): """Fix permissions issues""" try: # Fix workspace permissions if os.path.exists(self.workspace_dir): subprocess.check_output(['chmod', '-R', '755', self.workspace_dir]) # Fix custom skills directory permissions custom_skills_dir = os.path.join(self.workspace_dir, 'custom-skills') if os.path.exists(custom_skills_dir): subprocess.check_output(['chmod', '-R', '755', custom_skills_dir]) ``` The quick-start example can invoke this operation automatically when its permission check reports a warning: ```python permissions_status = diagnosis.get('permissions', {}).get('status', 'warning') if permissions_status == 'warning': print("🔐 发现权限问题,正在修复...") troubleshooter.fix_issue('permissions') ``` ### Technical Analysis The permission repair function executes `chmod -R 755` against the complete OpenClaw workspace. This recursively assigns owner read, write, and execute permissions and group/other read and execute permissions to every directory and regular file below the workspace. The workspace is expected to include `custom-skills`, `projects`, and `memory`. These directories may contain private project files, agent state, user information, configuration data, or credentials. Applying mode `755` recursively therefore violates least privilege by making all such files readable by every local account. It also unnecessarily marks regular files as executable. The implementation does not: - Determine which individual path has a permission problem. - Preserve existing restrictive permissions. - Distinguish directories from regular files. - Check effective access using `os.access`. - Request confirmation before recursively changing the ...[truncated 1943 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the recursive `chmod -R 755` operation. 2. Diagnose effective permissions with `os.access(path, os.R_OK | os.W_OK)` rather than checking only owner mode bits. 3. Change only the specific paths for which a permission defect has been confirmed. 4. Apply restrictive defaults: - Workspace and private directories: `0700`. - Private regular files: `0600`. - Executable files: add execute permission only when execution is required. 5. Distinguish directories from regular files while repairing permissions. 6. Preserve existing permission bits unless a specific change is necessary. 7. Require explicit user confirmation before any recursive permission operation. 8. Display every affected path and its old and proposed modes before applying changes. 9. Avoid following symbolic links and ensure resolved targets remain inside the intended workspace. 10. Record prior modes so that changes can be rolled back if the repair fails. 11. Do not automatically invoke permission repair from the quick-start example; provide diagnosis and an explicit remediation command instead. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/openclaw_troubleshooting.py:256
Finding
Runtime Installation of Unpinned Packages Through Untrusted Pip Configuration<![CDATA[ ## Vulnerability Details **File Location**: `scripts/openclaw_troubleshooting.py`, lines 256–281 **Vulnerability Type**: Unpinned runtime dependency installation and package-index trust **Risk Level**: Medium ### Vulnerable Code ```python def fix_dependencies(self): """Fix missing dependencies""" try: missing_packages = self.check_dependencies()['missing'] if not missing_packages: print("✅ 所有依赖项已安装") return True print(f"📦 安装缺少的依赖项: {', '.join(missing_packages)}") # Try to install with --break-system-packages flag try: for package in missing_packages: subprocess.check_output([sys.executable, '-m', 'pip', 'install', package, '--break-system-packages']) print("✅ 依赖项安装完成") return True except Exception as e1: print(f"❌ 安装失败: {e1}") print("🔄 尝试使用用户模式安装") # Try to install with --user flag try: for package in missing_packages: subprocess.check_output([sys.executable, '-m', 'pip', 'install', package, '--user']) print("✅ 依赖项安装完成") return True except Exception as e2: print(f"❌ 用户模式安装失败: {e2}") return False ``` The package constraints are also open-ended: ```text requests>=2.31.0 beautifulsoup4>=4.12.2 lxml>=5.1.0 json5>=0.9.14 python-dotenv>=1.0.1 ``` ### Technical Analysis The repair function installs packages at runtime using bare package names and the environment's existing pip configuration. It does not pin exact versions, verify cryptographic hashes, enforce a trusted package index, or create an isolated virtual environment. Pip may obtain packages from an index selected through global configuration, user configuration, environment variables, or command-line defaults. A compromised or attacker ...[truncated 3068 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove dependencies that are not required by the runtime. 2. Do not install packages automatically as part of a repair operation. Report missing dependencies and require explicit user approval. 3. Create and use a dedicated virtual environment instead of modifying the system or user Python installation. 4. Remove `--break-system-packages`. 5. Pin each dependency to an exact, reviewed version. 6. Generate a lock file and require cryptographic hashes, such as with pip's `--require-hashes`. 7. Enforce a trusted HTTPS package index rather than inheriting arbitrary pip index configuration. 8. Review transitive dependencies and maintain a repeatable dependency update process. 9. Show the selected index, exact versions, and proposed installation command before execution. 10. Run vulnerability and provenance checks on dependency artifacts before publishing updates. 11. Prefer installation during a controlled deployment phase rather than dynamically during skill execution. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (44)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The documented purpose is troubleshooting and optimization, but the detected behavior includes modifying skill metadata/files, running version upgrade flows, invoking external subprocesses for publishing, and publishing skills to ClawHub. That is a substantial privilege and behavior expansion beyond user-expected troubleshooting, creating a risk of unauthorized code/package changes or supply-chain actions under the guise of repair. A description-behavior mismatch is especially dangerous because it defeats informed consent and makes risky actions easier to hide.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The document repeatedly promotes 'automatic diagnosis, repair, and optimization' and later acknowledges 'data loss risk' and other high-risk outcomes, but it does not warn users to review changes, take backups, or require explicit confirmation before impactful actions. In a troubleshooting skill, this omission is dangerous because users are primed to trust automated fixes that may alter system state, permissions, dependencies, or files without informed consent.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The documentation advertises automatic repair capabilities such as dependency installation, permission repair, and workspace optimization without clearly warning that these actions may modify the local environment, install software, or alter filesystem permissions. In a troubleshooting skill, users are likely to trust and run these actions directly, which increases the chance of unintended system changes or data loss.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The listed commands include broad fix operations such as 'fix all', 'fix dependencies', and 'fix permissions' with no visible caution, scope limitation, or backup advice. Commands that alter dependencies or permissions can have security and availability consequences if run blindly, especially in a developer workstation context.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The README advertises automatic diagnosis and repair actions such as installing dependencies, fixing permissions, and repairing paths/workspace state, but it does not warn users that these actions can change their system or require confirmation. In a troubleshooting skill, undocumented modification behavior increases the risk of unintended package installs, permission changes, or filesystem alterations triggered by a user seeking simple diagnostics.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The invocation example uses a broad natural-language trigger ('我遇到了OpenClaw的问题,帮我诊断一下') that is close to an ordinary support request rather than a clearly scoped command. In an agent environment, this can cause the skill to activate unexpectedly during general conversation and potentially lead into automated troubleshooting or repair flows with side effects.

Lp3

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding
The skill advertises automated diagnosis, repair, optimization, and reporting, which strongly implies use of powerful capabilities such as shell, filesystem, environment access, and possibly network access. However, the manifest does not declare any tool scope or permissions boundaries, so users and the platform cannot verify or constrain what the skill may do at runtime. In a troubleshooting skill that may modify configs, install dependencies, and clear caches, missing scope declarations materially increases the risk of overreach or unintended destructive actions.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill promises automated repairs, dependency installation, path/permission fixes, and cache cleanup without warning that these actions may change system state. In a troubleshooting context, such actions can alter environments, remove cached data, or affect other applications, so omission of warnings increases the chance of accidental disruption and unsafe user trust. The danger is amplified because 'automatic fix' language encourages execution without careful review.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
Log analysis and report generation can process sensitive information such as file paths, usernames, tokens, hostnames, stack traces, and proprietary content. Without any privacy or data-handling notice, users may unknowingly expose sensitive data to storage, summaries, or external transmission, particularly if reports are shared or uploaded. In a troubleshooting skill, this is a real confidentiality risk because logs commonly contain secrets and operational details.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This code file contains user-facing natural-language strings and docstrings exclusively in Chinese, including the module description and runtime output. The policy requires flagging language or locale constraints when the skill forces a specific language without user opt-in, and no alternative language option or justification is provided here.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
machine = platform.machine()
            
            if system == 'Darwin':
                mac_version = subprocess.check_output(['sw_vers', '-productVersion'], text=True).strip()
                return {
                    "system": system,
                    "version": mac_version,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
"full_version": platform.version()
                }
            elif system == 'Linux':
                distro = subprocess.check_output(['lsb_release', '-d'], text=True).strip().split(':')[1].strip()
                return {
                    "system": system,
                    "version": version,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
try:
            version = platform.python_version()
            interpreter = sys.executable
            pip_version = subprocess.check_output([sys.executable, '-m', 'pip', '--version'], text=True).strip()
            
            return {
                "version": version,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
missing_packages = []
        
        try:
            pip_output = subprocess.check_output([sys.executable, '-m', 'pip', 'list'], text=True)
            
            for package in required_packages:
                if re.search(rf'\b{re.escape(package)}\b', pip_output, re.IGNORECASE):
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
missing_packages = []
        
        try:
            pip_output = subprocess.check_output([sys.executable, '-m', 'pip', 'list'], text=True)
            
            for package in required_packages:
                if re.search(rf'\b{re.escape(package)}\b', pip_output, re.IGNORECASE):
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Context-Inappropriate Capability

Medium
Confidence
99% confidence
Finding
The skill modifies the Python environment by automatically running package installs, including forced system-level installs with `--break-system-packages`. This is dangerous because it can execute unreviewed package code, break managed environments, and create persistence or dependency-confusion risk under the guise of troubleshooting.

Missing User Warnings

Medium
Confidence
99% confidence
Finding
Automatic package installation without warning or confirmation removes an important safety checkpoint before executing code-fetching and environment-modifying operations. In a troubleshooting skill, this raises the chance that users will trigger risky changes unintentionally while expecting safe diagnostics.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# Try to install with --break-system-packages flag
            try:
                for package in missing_packages:
                    subprocess.check_output([sys.executable, '-m', 'pip', 'install', package, '--break-system-packages'])
                
                print("✅ 依赖项安装完成")
                return True
Confidence
98% confidence
Finding
This installs Python packages automatically and even uses `--break-system-packages`, which can modify protected system environments and override package-management safeguards. In a troubleshooting skill, this is more dangerous because users may run it expecting diagnostics, but it can perform high-impact environment changes that destabilize the host or introduce unreviewed code from package repositories.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# Try to install with --user flag
                try:
                    for package in missing_packages:
                        subprocess.check_output([sys.executable, '-m', 'pip', 'install', package, '--user'])
                    
                    print("✅ 依赖项安装完成")
                    return True
Confidence
96% confidence
Finding
This fallback path still performs automatic package installation, albeit in user mode. While less severe than system-level installation, it still executes package-management changes without review and can pull arbitrary third-party code into the runtime environment.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
The skill recursively changes filesystem permissions over the workspace and skills directories. Broad recursive permission changes can unintentionally expose data, weaken local access controls, and damage the integrity of project files, especially when the path is derived from relative directory traversal.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
The recursive chmod operation changes permissions without explicit safety messaging or confirmation. That is dangerous because permission changes are high-impact, potentially irreversible at scale, and may weaken confidentiality or integrity protections across the workspace.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
try:
            # Fix workspace permissions
            if os.path.exists(self.workspace_dir):
                subprocess.check_output(['chmod', '-R', '755', self.workspace_dir])
            
            # Fix custom skills directory permissions
            custom_skills_dir = os.path.join(self.workspace_dir, 'custom-skills')
Confidence
95% confidence
Finding
This recursively changes permissions on the computed workspace directory to `755`, which can broaden access to all files and subdirectories under that tree. In a troubleshooting skill, automatically mass-changing permissions is dangerous because it may expose sensitive workspace contents or alter security assumptions without confirmation.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# Fix custom skills directory permissions
            custom_skills_dir = os.path.join(self.workspace_dir, 'custom-skills')
            if os.path.exists(custom_skills_dir):
                subprocess.check_output(['chmod', '-R', '755', custom_skills_dir])
            
            print("✅ 权限修复完成")
            return True
Confidence
95% confidence
Finding
This performs another recursive `chmod 755` on the `custom-skills` directory, potentially making skill contents broadly readable and executable. If that directory contains private code, tokens, or configuration files, the permission widening can create unintended exposure or facilitate tampering by local users.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
This code presents its top-level description in Chinese and consistently emits Chinese user-facing status/error messages throughout the script, indicating a fixed language choice. The file provides no opt-in, locale selection, or justification that this is a region-specific tool, which conflicts with the policy against forcing a specific language without user choice.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The script launches external test and publishing subprocesses that are unrelated to end-user troubleshooting scope, broadening the behavior of the skill package beyond its stated purpose. This increases attack surface and trust risk because users or reviewers expecting diagnostic tooling may inadvertently run release-oriented commands with network or account implications.

Static analysis

No suspicious patterns detected.