Back to skill

Security audit

File share

Security checks for vulnerabilities and agentic risk

Overview

This skill is a file uploader whose main behavior is disclosed, but its workspace-only safety claim is not reliably enforced and it can expose files through an external share URL.

Review carefully before installing. Only use this skill for files you intentionally want to send to transfer.whalebone.io, avoid sensitive or regulated data unless encrypted first, and do not rely on the current workspace-only validation as a security boundary.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/file_transfer.py:14
Finding

Workspace Path Validation Bypass Allows Unauthorized File Upload

Content
View full analysis

Vulnerability Details

File Location: scripts/file_transfer.py:14-21 (validation), with the validated path used at scripts/file_transfer.py:76-92
Vulnerability Type: Improper path containment validation and symlink traversal
Risk Level: High

Vulnerable Code

python
def is_safe_path(path_str, workspace_root):
    """
    Check if the given path is within the workspace root to prevent directory traversal.
    """
    try:
        # Convert to absolute paths and resolve any symlinks or '..'
        abs_path = os.path.abspath(path_str)
        abs_workspace = os.path.abspath(workspace_root)
        # Ensure the path starts with the workspace root
        return abs_path.startswith(abs_workspace)
    except Exception:
        return False

The result of this check is subsequently trusted when selecting a file for upload:

python
# Security check: ensure the path is within the workspace
if not is_safe_path(input_path, workspace_root):
    print("Error: Access denied. The file must be within the OpenClaw workspace.", file=sys.stderr)
    sys.exit(1)

# Check if the file exists
if not os.path.isfile(input_path):
    print(f"Error: File not found: {input_path}", file=sys.stderr)
    sys.exit(1)

# Perform the upload
output, error = run_upload(input_path)

Technical Analysis

The implementation uses a lexical string-prefix comparison to determine whether a file is inside /home/ubuntu/.openclaw/workspace. A string prefix does not enforce a filesystem directory boundary. For example, the following external path passes the check because its text begins with the workspace path:

text
/home/ubuntu/.openclaw/workspace-private/secret.txt

In addition, os.path.abspath() normalizes relative path components but does not resolve symbolic links, despite the source comment claiming that it does. A path lexically located under the workspace can therefore be a sy ...[truncated 2608 chars]

Remediation
View remediation

Remediation Suggestions

  1. Resolve both the workspace and candidate path to canonical filesystem paths before comparing them:

    python
    from pathlib import Path
    
    def get_safe_file(path_str, workspace_root):
        try:
            workspace = Path(workspace_root).resolve(strict=True)
            candidate = Path(path_str).resolve(strict=True)
    
            if not candidate.is_relative_to(workspace):
                return None
            if not candidate.is_file():
                return None
    
            return candidate
        except (OSError, RuntimeError):
            return None
    
  2. For Python versions without Path.is_relative_to(), use os.path.commonpath() rather than startswith():

    python
    if os.path.commonpath([str(candidate), str(workspace)]) != str(workspace):
        return None
    
  3. Explicitly reject symbolic links when links are not required. Validate every relevant path component or use descriptor-based filesystem operations that do not follow links.

  4. Reduce validation/use race conditions by securely opening the validated file first and uploading from that already-open descriptor where supported. On Linux, consider os.open() with O_NOFOLLOW and verify the opened file using fstat().

  5. Pass the canonical validated path—not the original untrusted path—to the upload function.

  6. Add regression tests for:

    • Sibling-prefix paths such as workspace-private/file.
    • .. traversal.
    • Symlinks targeting files outside the workspace.
    • Broken and recursively resolving symlinks.
    • Replacement of a validated file or link before upload.
  7. Update SKILL.md so its security guarantees accurately reflect the implemented controls and any remaining limitations.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly enables uploading arbitrary workspace files to an external third-party service, but the user-facing description does not prominently warn about the data leaving the local/OpenClaw environment or the confidentiality implications. In an agent setting, understated disclosure increases the risk of accidental exfiltration of logs, memory files, reports, or other sensitive workspace artifacts to an unauthenticated public file-sharing endpoint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document instructs users to upload files to a public file-sharing service and emphasizes convenience, but it does not prominently warn that uploaded content becomes accessible via a shareable URL and may be disclosed to unintended parties. Although it briefly suggests encrypting sensitive files later in the notes, the warning is not clear or front-loaded enough for a workflow that could lead users to expose confidential data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill uploads file contents from the local workspace to an external host (transfer.whalebone.io) without any explicit confirmation, consent prompt, or prominent warning at execution time. In an agent skill context, this creates a clear data-exfiltration risk because sensitive workspace files may be transmitted off-system with minimal user awareness.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/file_transfer.py (reported line 50)May include surrounding context.

python
command = ["curl", "--upload-file", rel_path, url]
    
    try:
        result = subprocess.run(
            command,
            capture_output=True,
            text=True,