Back to skill

Security audit

ClawTip付费技能开发指南

Security checks for vulnerabilities and agentic risk

Overview

This is a payment-skill guide, but its payment verification advice could cause users to accept invalid or mismatched payments.

Review before installing or following this guide. Use a test or sandbox account where possible, do not treat payCredential field presence as proof of payment, fail closed on merchant or recipient errors, protect local order files, and verify payment credentials through the trusted ClawTip component before generating paid services.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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

Warning
Location
SKILL.md:87
Finding

SM4-CBC Encryption Uses a Fixed IV and Weak Key Normalization

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:87-100
Vulnerability Type: Insecure cryptographic implementation
Risk Level: Medium

python
def sm4_encrypt(data: str, key: str) -> str:
    """SM4 encryption"""
    key_bytes = key.encode('utf-8')[:16].ljust(16, b'0')
    iv = b'5f5e5a247f544d77'
    
    data_bytes = data.encode('utf-8')
    padding_length = 16 - len(data_bytes) % 16
    data_bytes += bytes([padding_length] * padding_length)
    
    cipher = Cipher(algorithms.SM4(key_bytes), modes.CBC(iv), backend=default_backend())
    encryptor = cipher.encryptor()
    encrypted = encryptor.update(data_bytes) + encryptor.finalize()
    
    return base64.b64encode(encrypted).decode('utf-8')

Technical Analysis

The implementation truncates keys longer than 16 bytes and pads shorter keys with predictable zero bytes. This is not a secure key-derivation procedure and can substantially reduce effective key strength when operators provide short or low-entropy configuration values.

The CBC initialization vector is a constant value reused for every order. CBC encryption requires an unpredictable, unique IV for each encryption under the same key. Reuse causes identical plaintext prefixes to produce identical ciphertext prefixes, exposing relationships between encrypted payment records.

SM4-CBC also provides confidentiality only. No MAC or authenticated-encryption mechanism protects the ciphertext, IV, or associated order metadata. Base64 only serializes the ciphertext and does not provide integrity or additional secrecy.

Attack Path

  1. An attacker obtains multiple local order files or otherwise observes their encrypted_data values.
  2. Because the same configured key and fixed IV are reused, the attacker compares ciphertext blocks to identify repeated plaintext structures and payment-field relationships.
  3. If the configured key is short or predictable, zero-padding makes candidat ...[truncated 863 chars]
Remediation
View remediation

Remediation Suggestions

  • Reject keys that are not exactly the protocol-required size and require cryptographically random key material.
  • If passphrases must be supported, derive keys with a reviewed KDF such as Argon2id, scrypt, or PBKDF2 using a unique salt and suitable work factor.
  • Generate a fresh cryptographically random IV for each encryption and serialize it alongside the ciphertext.
  • Prefer an authenticated-encryption mode supported by the payment protocol. If SM4-CBC is mandatory, apply an independent MAC using an appropriately separated key and verify it before decryption.
  • Authenticate immutable context such as order number, amount, payee, skill identifier, and protocol version.
  • Ensure decryption fails closed when authentication, padding, schema, or field validation fails.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:172
Finding

Payment Success Is Inferred from an Unverified Local Field

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:172-185
Vulnerability Type: Improper payment credential validation
Risk Level: High

The vulnerable guidance instructs implementations to inspect a local order file:

bash
cat ~/.openclaw/skills/orders/<indicator>/<order-number>.json

It then treats the presence of the following field as proof of successful payment:

json
{
  "payCredential": "..."
}

The guide further advises that a merchant-information error can be ignored when payCredential exists.

Technical Analysis

Field presence in a local JSON file is not proof that a payment credential is authentic or valid. The documented check does not establish that the credential:

  • Was issued by the trusted payment authority.
  • Has a valid signature or MAC.
  • Corresponds to the expected order number.
  • Covers the required amount and intended merchant.
  • Represents a completed rather than pending, failed, or reversed payment.
  • Is unexpired and has not been replayed.
  • Was not inserted into a writable local order file.

Advising users to ignore a merchant-information error also creates a fail-open condition. Such an error may indicate a recipient mismatch or another failure that should prevent service delivery.

Attack Path

  1. An attacker identifies the local JSON order file under ~/.openclaw/skills/orders/.
  2. If the attacker, another local process, or a compromised skill can write to that file, it inserts a fabricated payCredential property or copies a stale credential from another order.
  3. The service-generation logic follows the documented validation procedure and checks only whether the property exists.
  4. The implementation ignores a merchant-information error as instructed.
  5. The service is generated or released without authoritative confirmation that the expected merchant received the expected payment.

Impact Assessment

This can enab ...[truncated 453 chars]

Remediation
View remediation

Remediation Suggestions

  • Never use property presence as evidence of payment.
  • Verify the credential cryptographically through the trusted ClawTip payment component.
  • Validate credential status, issuer, signature, order number, amount, currency or unit, recipient, issue time, expiry, and protocol version.
  • Bind each credential to a single order and record its consumption to prevent replay.
  • Fail closed on merchant-information errors, recipient mismatches, malformed credentials, unknown status values, and verification outages.
  • Protect order files with restrictive ownership and permissions, atomic writes, and integrity controls.
  • Separate order creation from payment confirmation and service fulfillment using explicit state transitions.
  • Document the authoritative verification interface and require successful verification before invoking the service-generation script.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:188
Finding

Third-Party Cryptography Package Is Installed Without Version or Integrity Pinning

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:188-191
Vulnerability Type: Unpinned third-party dependency installation
Risk Level: Medium

bash
pip install cryptography

Technical Analysis

The documented command installs whichever cryptography release the configured package index resolves at execution time. It does not pin a reviewed version, verify package hashes, use a lock file, or require an isolated environment.

Although the package name itself is legitimate, this installation pattern is non-reproducible and depends on the integrity of the package index, local package-manager configuration, mirrors, and network path. A malicious or compromised configured index could supply attacker-controlled package content.

Attack Path

  1. An attacker compromises or influences the Python package index or mirror configured on the user's system.
  2. The user follows the guide and executes pip install cryptography.
  3. Package resolution retrieves an unreviewed or attacker-controlled artifact from that source.
  4. Installation hooks or subsequently imported package code execute under the privileges of the user running the command.
  5. The malicious dependency can access files, credentials, payment configuration, and network resources available to that user.

Impact Assessment

Successful supply-chain exploitation can execute code with the installing user's privileges. This may expose the configured SM4 key, merchant data, local order files, payment credentials, and other files accessible to the same account.

The project does not itself include a malicious dependency or remote payload. The risk arises from unsafe dependency-resolution guidance and depends on compromise or manipulation of the configured package source.

Remediation
View remediation

Remediation Suggestions

  • Pin a reviewed dependency version in a requirements or lock file.
  • Require package hashes, for example through a hash-locked requirements file and pip install --require-hashes.
  • Install dependencies in a dedicated virtual environment rather than the global interpreter.
  • Use an explicitly configured trusted package index over TLS.
  • Review and update pinned versions through a controlled dependency-management process.
  • Consider distributing a signed, reproducible environment specification for the complete skill.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

At L067 the documentation emphatically states '不要调用外部API...本地创建即可' for create_order.py, conveying a local-only approach. But the testing steps at L165-L166 direct the user to run clawtip's payment_process.py for '真实支付', which contradicts the earlier documentation intent that no external API call should be involved.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The guide instructs operators to perform real payment actions and inspect local order files, but it does not prominently warn that this can trigger actual financial charges and write sensitive payment artifacts such as payCredential to disk. In a payment-capable skill with network.outbound and credential.read permissions, that omission increases the risk of accidental charges, mishandling of local payment data, and unsafe test practices.

Content

No source excerpt is available for this finding.