Back to skill

Security audit

lin-skill-demo

Security checks for vulnerabilities and agentic risk

Overview

This is a simple paid-skill licensing demo that reads one license environment variable and prints demo output, with no active network, persistence, or hidden control behavior.

Install this only as a licensing demonstration or template. Do not rely on its hardcoded demo key or local hash check to protect real paid or sensitive functionality; replace it with a proper entitlement design before production use. Be aware that messages and documentation are currently Chinese-only.

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/check_license.py:13
Finding

Hardcoded License Credential Allows Authorization Bypass

Content
View full analysis

Vulnerability Details

File Location: scripts/check_license.py, lines 13-37
Vulnerability Type: Hardcoded credential and ineffective client-side license validation
Risk Level: High

python
# Public key/salt; replace with your own value in an actual deployment
SALT = "PaidSkillDemoClawHub2024"


def hash_license(license_key: str, salt: str = SALT) -> str:
    """Calculate the license key hash."""
    return hashlib.sha256((license_key + salt).encode()).hexdigest()


def check_license() -> Tuple[bool, str]:
    """
    Check the license key.
    Returns: (whether valid, message)
    """
    license_key = os.environ.get("SKILL_LICENSE_KEY", "").strip()
    
    if not license_key:
        return False, "License key is not configured; set the SKILL_LICENSE_KEY environment variable."
    
    # Authorized hashes are stored here; an actual implementation could validate dynamically with a server.
    # Example: the hash of license "demo-license-123" is:
    expected_hash = hash_license("demo-license-123")
    
    # Check the license supplied by the user.
    user_hash = hash_license(license_key)
    
    if user_hash == expected_hash:
        return True, "License validation succeeded."

Technical Analysis

The accepted plaintext license key, demo-license-123, is embedded directly in source code distributed to users. The salt and complete validation algorithm are also public. Hashing the key does not protect it because the application must compare the user-supplied value against data available locally, and in this implementation the valid plaintext value is explicitly disclosed.

Validation is entirely client-side and does not use a digital signature, trusted remote entitlement service, expiration claim, revocation mechanism, or binding to a customer, account, or device. Anyone with access to the Skill package can therefore recover the accepted credential without cryptanalysis ...[truncated 1515 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove all accepted plaintext license keys, shared secrets, and reusable entitlement values from distributed source code.
  2. For offline validation, issue digitally signed license documents containing relevant claims such as customer identity, product identifier, enabled features, issuance time, expiration time, and a unique license identifier.
  3. Embed only the verification public key in the Skill. Keep the signing private key exclusively in a secured licensing service and never distribute it with the package.
  4. Use a modern, established signature scheme and library, such as Ed25519, rather than implementing custom cryptography.
  5. If online validation is appropriate, submit the license through an authenticated HTTPS licensing API. Apply strict TLS verification, request timeouts, safe error handling, rate limiting, replay protection, and a documented fail-closed policy.
  6. Add revocation and renewal support. If validation responses are cached, digitally sign them and enforce a short expiration period.
  7. Bind entitlements to the intended account or installation where required by the commercial model, while minimizing collection of device identifiers and other personal data.
  8. Compare security-sensitive values using constant-time comparison where direct comparisons remain necessary, although constant-time comparison alone does not correct the disclosed credential.
  9. Clearly mark demonstration credentials and validation code as non-production, and prevent the template from being published as a real paid Skill without replacing the demonstration mechanism.
  10. Add automated tests confirming that unknown, expired, revoked, altered, and incorrectly scoped licenses are rejected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill declares no explicit tool scope or permission boundary even though the content indicates capabilities involving environment variables and network access. Missing scope declarations can cause the agent runtime or reviewer to underestimate what the skill may access, increasing the risk of unintended secret exposure or outbound communication once implemented.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The visible user-facing description and instructions are entirely in Chinese, which imposes a specific language on users without indicating any language choice or opt-in. Under the policy, forced language selection in natural-language content is a reportable locale/language violation unless clearly justified.

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 · scripts/check_license.py (reported line 44)May include surrounding context.

python
# 生产环境可以在这里增加联网验证
    # import requests
    # response = requests.post("https://your-server.com/verify", json={"key": license_key})
    # return response.json().get("valid", False)
    
    return False, "授权码无效,请检查 SKILL_LICENSE_KEY 配置"

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 · scripts/check_license.py (reported line 44)May include surrounding context.

python
# 生产环境可以在这里增加联网验证
    # import requests
    # response = requests.post("https://your-server.com/verify", json={"key": license_key})
    # return response.json().get("valid", False)
    
    return False, "授权码无效,请检查 SKILL_LICENSE_KEY 配置"

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and user-facing messages are written entirely in Chinese, and the script does not indicate that language selection is configurable or that the tool is intentionally limited to a Chinese-speaking audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module docstring, comments, and all user-facing print messages are written in Chinese, which imposes a specific language on users. There is no indication that the skill is region-specific or that users can opt into another language, so this appears to violate the language/locale policy criterion.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.