Back to skill

Security audit

ClawHub发布工具

Security checks for vulnerabilities and agentic risk

Overview

This is a real ClawHub publishing tool, but it ships a hardcoded bearer token and can unintentionally upload more local data than the user may expect.

Review carefully before installing or running. Do not use this as-is with private skill directories, and treat the embedded ClawHub token as exposed. A safer version should remove the bundled token, require user-provided credentials, reject symlinks, show the exact files to be uploaded, and ask for confirmation before publishing.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
publish.py:10
Finding

Hard-Coded ClawHub Bearer Token Exposes Publishing Credentials

Content
View full analysis

Vulnerability Details

File Location: publish.py, lines 10-19; the same credential is also used at line 73
Vulnerability Type: Hard-coded authentication secret
Risk Level: High

python
TOKEN = "clh_[REDACTED]"
API_URL = "https://clawhub.ai/api/v1/skills"


def upload_file(filename, content_type="text/plain"):
    """获取上传URL并上传文件"""
    resp = requests.post(
        "https://clawhub.ai/api/cli/upload-url",
        headers={"Authorization": f"Bearer {TOKEN}"},
        json={"filename": filename, "contentType": content_type}
    )

The token value is redacted in this report to avoid further credential exposure. The source file contains the complete plaintext credential.

Technical Analysis

A reusable ClawHub bearer token is embedded directly in the source code and added to the Authorization header. The same token is also used by the publication request at line 73. Anyone able to download, inspect, copy, log, or redistribute the Skill package can recover the credential without authentication or technical exploitation.

Embedding an account credential is not required for the declared publishing functionality. Authentication should instead be supplied by the individual authorized user through a protected runtime mechanism. Because bearer tokens generally grant access based solely on possession, an attacker can replay the token directly against ClawHub APIs until it is revoked or expires.

Attack Path

  1. An attacker obtains the Skill package or access to its source code.
  2. The attacker reads the plaintext TOKEN value from publish.py.
  3. The attacker constructs requests with Authorization: Bearer <token>.
  4. The attacker sends authenticated requests to the ClawHub upload or publishing APIs.
  5. The attacker exercises any publishing or account capabilities granted to the token until the credential is revoked, expires, or is otherwise invalidated.

Impact Assessment

The ...[truncated 550 chars]

Remediation
View remediation

Remediation Suggestions

  1. Immediately revoke the exposed token and issue a replacement; removing it from the current source alone does not invalidate copies in package archives or source history.
  2. Remove all embedded credentials from the code and repository history.
  3. Obtain authentication from a protected environment variable, operating-system credential store, or official interactive ClawHub authentication flow.
  4. Fail securely when no credential is configured rather than falling back to a shared token.
  5. Use narrowly scoped, short-lived credentials restricted to only the publication operations required by the tool.
  6. Avoid printing tokens or including them in exceptions and HTTP debugging logs.
  7. Add automated secret scanning to development and release pipelines.
  8. Review ClawHub access and publication logs for unauthorized activity associated with the exposed credential.

T09 · Insecure Skill Coding Practices

Warning
Location
publish.py:38
Finding

Symlink Following Can Upload Files Outside the Selected Skill Directory

Content
View full analysis

Vulnerability Details

File Location: publish.py, lines 38-63
Vulnerability Type: Unrestricted symbolic-link traversal and unintended file disclosure
Risk Level: Medium

python
    files = []
    for f in os.listdir(skill_dir):
        if f.endswith(('.md', '.py', '.js', '.json', '.txt')) and not f.startswith('__'):
            filepath = os.path.join(skill_dir, f)
            if os.path.isfile(filepath):
                files.append((f, filepath))

    if not files:
        return {"error": "没有找到可发布文件"}

    print(f"准备发布 {len(files)} 个文件...")

    # 构建 payload
    payload = {
        "slug": slug,
        "displayName": name,
        "version": version,
        "changelog": changelog,
        "tags": ["latest"],
        "acceptLicenseTerms": True
    }

    # 构建文件上传
    file_data = []
    for filename, filepath in files:
        with open(filepath, 'rb') as f:
            content = f.read()
        file_data.append(('files', (filename, content, 'text/plain')))

Technical Analysis

The publisher enumerates top-level files with approved extensions and checks each path using os.path.isfile(). Both os.path.isfile() and the subsequent open() operation follow symbolic links by default.

Consequently, a directory entry such as credentials.txt can be a symbolic link to a file outside skill_dir. If the target is a regular file, the check succeeds, the external file is read, and its contents are included in the multipart publication request. The extension filter applies only to the symlink's displayed name, not its resolved target.

Uploading selected Skill source files to ClawHub is necessary for the declared functionality. Reading and uploading arbitrary files outside the selected Skill directory exceeds the minimum filesystem access needed for that purpose.

Attack Path

  1. An attacker prepares or modifies a Skill directory that a victim is expected to publis ...[truncated 1377 chars]
Remediation
View remediation

Remediation Suggestions

  1. Explicitly reject symbolic links with os.path.islink(filepath) before reading a file.
  2. Resolve the Skill root and each candidate using os.path.realpath(), then verify containment with os.path.commonpath():
    python
    root = os.path.realpath(skill_dir)
    candidate = os.path.realpath(filepath)
    
    if os.path.islink(filepath):
        continue
    if os.path.commonpath([root, candidate]) != root:
        continue
    
  3. Open files without following symlinks where supported, such as by using os.open() with os.O_NOFOLLOW, to reduce time-of-check/time-of-use race conditions.
  4. Verify the opened file descriptor is a regular file using os.fstat() before reading it.
  5. Prefer an explicit publication manifest rather than automatically uploading every top-level file with an allowed suffix.
  6. Display the resolved file list and require confirmation before network transmission, especially when invoked interactively.
  7. Add tests covering symlinks to files inside and outside the Skill root, broken links, and links changed between validation and opening.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • 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
Findings (9)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The documented purpose is generic publishing, but the associated behavior reportedly includes authenticated remote uploads and use of a hardcoded authentication token without declared permissions. Hardcoded credentials are a serious security risk because they can be extracted and abused, and the undeclared external upload behavior increases the chance of unintended data exfiltration.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill documentation declares no tool scope or permissions, yet the referenced publishing workflow inherently reads local files and sends data over the network. This creates an authorization and transparency gap: users and policy systems cannot accurately assess or constrain the skill's capabilities before use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The usage instructions tell users to publish a local skill directory to an external service but do not warn that local skill contents and metadata will be transmitted off-host. This omission can lead users to upload sensitive files, embedded secrets, or proprietary code without realizing the privacy and security implications.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · publish.py (reported line 17)May include surrounding context.

python
def upload_file(filename, content_type="text/plain"):
    """获取上传URL并上传文件"""
    resp = requests.post(
        "https://clawhub.ai/api/cli/upload-url",
        headers={"Authorization": f"Bearer {TOKEN}"},
        json={"filename": filename, "contentType": content_type}

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · publish.py (reported line 17)May include surrounding context.

python
def upload_file(filename, content_type="text/plain"):
    """获取上传URL并上传文件"""
    resp = requests.post(
        "https://clawhub.ai/api/cli/upload-url",
        headers={"Authorization": f"Bearer {TOKEN}"},
        json={"filename": filename, "contentType": content_type}

Tainted flow: 'upload_url' from requests.post (line 23, network input) → requests.put (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · publish.py (reported line 27)May include surrounding context.

python
if upload_url:
        # 上传文件内容
        requests.put(upload_url, data=content, headers={"Content-Type": content_type})
    
    return True

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The tool reads local files from the provided directory and uploads them to a remote service, but it does not clearly warn the user at runtime which files will be transmitted or require explicit confirmation. In a publishing tool, this creates a meaningful risk of unintended disclosure of local code, notes, or sensitive files that match the extension filter.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

SQP-3 applies to all file types and covers language/locale policy issues. The natural-language description and primary instructions are in Chinese, with no indication that the skill is region-specific or that users can opt into this language, which may violate an organizational policy against forcing a specific language by default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The top-level natural-language description is written only in Chinese and does not offer an opt-in or indicate that the tool is intentionally region-specific. Under the policy, forcing a specific language or locale without user choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.