Back to skill

Security audit

塔罗牌占卜

Security checks for vulnerabilities and agentic risk

Overview

This is a paid tarot skill, but it ships unsafe payment defaults and writes payment/order data in ways users may not expect.

Review this carefully before installing or using it. Do not run the paid order flow unless you have replaced and verified the payment recipient and cryptographic configuration, understand where order files and the database are written, and are comfortable with user questions being stored with transaction metadata. The payment verification design should not be relied on for real paid fulfillment without redesign.

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

T09 · Insecure Skill Coding Practices

Error
Location
configs/config.yaml:7
Finding

Bundled Payment Recipient Can Redirect User Payments

Content
View full analysis

Vulnerability Details

File Location: configs/config.yaml:7-9, used by scripts/create_order.py:20-27
Vulnerability Type: Hardcoded payment destination
Risk Level: High

Vulnerable Code

yaml
payment:
  # 收款方账号(京东支付 payTo)
  # 请替换为你的收款账号
  pay_to: "f91cfdba04fddf169afb419d152c5b39202604071400000010008651nJdJZZSrtcbsWJiCGhOsBcauJUi6R5SIbhH1KV5Ocu9Kxgg6HSj5BSYwx9BjoRFqNyxMqkVG"

The configured value is consumed without requiring explicit operator initialization:

python
pay_to = config.get("payment", {}).get("pay_to")
if not pay_to or pay_to == "YOUR_PAY_TO_VALUE":
    raise RuntimeError("请先配置 payment.pay_to")
amount = config.get("service", {}).get("amount", 1)
order_no = datetime.now().strftime("%Y%m%d%H%M%S") + str(random.randint(100000, 999999))
plain_dict = {"orderNo": order_no, "amount": amount, "payTo": pay_to}
plain_text = json.dumps(plain_dict, ensure_ascii=False)
encrypted_data = sm4_encrypt(plain_text, sm4_key)

Technical Analysis

The package contains a fully populated payment recipient rather than an empty or unmistakable placeholder. The initialization check only rejects a missing value or the literal string YOUR_PAY_TO_VALUE; therefore, the bundled recipient passes validation and is embedded into every newly created payment order.

This behavior is unnecessary for the declared tarot functionality and exceeds a safe default configuration model. Payment-enabled skills should require the operator to explicitly configure and confirm the intended recipient before accepting orders.

Attack Path

  1. A user installs the Skill and follows the documented order-creation workflow.
  2. The user does not notice or replace the bundled payment.pay_to value.
  3. create_order.py reads the bundled recipient and embeds it into the payment request.
  4. The external payment workflow processes the order using that recipient.
  5. Funds may be sent to the account included ...[truncated 420 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove the populated recipient from the distributed configuration.
  • Use an empty value or an unmistakable placeholder that always fails validation.
  • Require an explicit setup command to register and confirm the operator's recipient.
  • Maintain a denylist of any sample or package-author recipient values.
  • Display the resolved recipient and require confirmation before creating the first order.
  • Add deployment tests that fail if release artifacts contain populated production payment destinations.

T09 · Insecure Skill Coding Practices

Error
Location
configs/config.yaml:1
Finding

Distributed Symmetric Key Allows Forgery of Payment Credentials

Content
View full analysis

Vulnerability Details

File Location: configs/config.yaml:1-4, scripts/serve.py:12-35
Vulnerability Type: Hardcoded cryptographic secret and forgeable authorization token
Risk Level: Critical

Vulnerable Code

yaml
crypto:
  # SM4 密钥(Base64 编码),用于加密订单数据
  # 请替换为你的 SM4 密钥
  sm4_key: "WoDb5xjzDmsYPV875mvYqg=="
python
config = load_config()
sm4_key_b64 = config.get("crypto", {}).get("sm4_key")
sm4_key = base64.b64decode(sm4_key_b64)
indicator = __import__("hashlib").md5(SLUG.encode("utf-8")).hexdigest()
conn = get_db_connection()
cursor = conn.execute("SELECT * FROM orders WHERE order_no = ?", (order_no,))
order = cursor.fetchone()

if not order:
    conn.close()
    return ("ERROR", "", False, "订单不存在")
if not credential:
    conn.close()
    return ("ERROR", "", False, "未完成支付,请先完成支付流程后再获取服务")
try:
    decrypted = sm4_decrypt(credential, sm4_key)
except Exception as e:
    conn.close()
    return ("ERROR", "", False, "支付凭证无效: " + str(e))
pay_info = json.loads(decrypted)
if pay_info.get("payStatus") != "SUCCESS":
    conn.close()
    return ("FAIL", "", False, "支付未成功,暂不履约")

Technical Analysis

Payment authorization relies on an SM4 symmetric key distributed inside the Skill package. Anyone able to inspect the package obtains the same key used by serve.py to decrypt payment credentials.

Symmetric encryption does not establish authenticity when every client has access to the encryption key. An attacker can construct arbitrary JSON containing a successful status, encrypt it with the bundled key, and submit the resulting ciphertext as payCredential. The verifier cannot distinguish attacker-generated credentials from legitimate payment-provider credentials.

Attack Path

  1. The attacker reads crypto.sm4_key from configs/config.yaml.
  2. The attacker creates an order or identifies an existing local order.
  3. The attacker constructs a payl ...[truncated 772 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove all production and sample secret keys from release artifacts.
  • Rotate the exposed key and treat it as permanently compromised.
  • Keep payment-verification secrets exclusively in a trusted server-side secret store.
  • Prefer provider-signed receipts or asymmetric signatures, distributing only the verification public key.
  • Do not let clients generate credentials accepted as proof of payment.
  • Authenticate payment callbacks directly with the payment provider.
  • Add secret-scanning and release checks to prevent cryptographic keys from being committed.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/serve.py:28
Finding

Payment Credential Is Not Bound to the Order, Amount, or Recipient

Content
View full analysis

Vulnerability Details

File Location: scripts/serve.py:28-47
Vulnerability Type: Insufficient payment authorization validation and replay protection
Risk Level: Critical

Vulnerable Code

python
try:
    decrypted = sm4_decrypt(credential, sm4_key)
except Exception as e:
    conn.close()
    return ("ERROR", "", False, "支付凭证无效: " + str(e))
pay_info = json.loads(decrypted)
if pay_info.get("payStatus") != "SUCCESS":
    conn.close()
    return ("FAIL", "", False, "支付未成功,暂不履约")

fulfill_status = order[7]
if fulfill_status == "FULFILLED":
    cursor = conn.execute("SELECT service_result FROM fulfillment_records WHERE order_no = ?", (order_no,))
    record = cursor.fetchone()
    result = record[0] if record else ""
    conn.close()
    return ("SUCCESS", result, True, None)

result = generate_result(question)

Technical Analysis

The verifier checks only whether the decrypted JSON has payStatus equal to SUCCESS. It does not verify that the credential belongs to the requested order or that it represents the expected amount and recipient.

Missing validation includes:

  • The credential's order number against the database order_no.
  • The paid amount against the stored order amount.
  • The payment recipient against the stored pay_to.
  • A unique provider transaction identifier.
  • Credential issue time, expiration, and freshness.
  • Whether the same payment transaction was previously used for another order.
  • Authenticity confirmation with the payment provider.

Consequently, even if the encryption key were kept secret, a valid successful credential could potentially be copied and replayed for unrelated orders.

Attack Path

  1. The attacker obtains one credential that decrypts to a payload containing payStatus: SUCCESS.
  2. The attacker creates another unpaid order.
  3. The attacker places the previously successful credential into the new order's `payCreden ...[truncated 781 chars]
Remediation
View remediation

Remediation Suggestions

  • Require authenticated payment receipts containing the order number, exact amount, currency, recipient, transaction ID, and timestamp.
  • Compare every receipt field against the corresponding immutable database order fields.
  • Store provider transaction IDs under a unique database constraint to prevent replay.
  • Reject expired, duplicated, malformed, or mismatched receipts.
  • Verify receipt signatures or query the payment provider through an authenticated server-side channel.
  • Perform payment verification and fulfillment state changes in one database transaction.
  • Use named columns rather than positional access such as order[7] to avoid authorization errors caused by schema changes.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/sm4_utils.py:27
Finding

Unauthenticated SM4-ECB Encryption Is Used for Security-Sensitive Payment Data

Content
View full analysis

Vulnerability Details

File Location: scripts/sm4_utils.py:27-37, scripts/sm4_utils.py:55-68
Vulnerability Type: Insecure cryptographic mode and incomplete padding validation
Risk Level: High

Vulnerable Code

python
# PKCS7 填充
padding_len = 16 - (len(plaintext.encode('utf-8')) % 16)
padded = plaintext.encode('utf-8') + bytes([padding_len] * padding_len)

# SM4 ECB 模式加密
cipher = Cipher(algorithms.SM4(key), modes.ECB(), backend=default_backend())
encryptor = cipher.encryptor()
ciphertext = encryptor.update(padded) + encryptor.finalize()

# 返回 Base64 编码
return base64.b64encode(ciphertext).decode('utf-8')
python
# Base64 解码
ciphertext = base64.b64decode(encrypted_text.encode('utf-8'))

# SM4 ECB 模式解密
cipher = Cipher(algorithms.SM4(key), modes.ECB(), backend=default_backend())
decryptor = cipher.decryptor()
plaintext = decryptor.update(ciphertext) + decryptor.finalize()

# 去除 PKCS7 填充
padding_len = plaintext[-1]
plaintext = plaintext[:-padding_len]

return plaintext.decode('utf-8')

Technical Analysis

ECB mode encrypts identical plaintext blocks into identical ciphertext blocks and supplies no nonce, authentication tag, or integrity protection. It is therefore inappropriate for structured, security-sensitive data such as order and payment credentials.

The implementation also removes padding based only on the final byte. It does not verify that the padding length is within the valid range or that all removed bytes have the expected padding value. Additionally, Base64 only encodes bytes and provides no security property.

Because ciphertext authenticity is not verified before JSON parsing and authorization, modified ciphertext cannot be reliably distinguished from legitimate ciphertext. The exposed key and weak authorization logic make direct credential forgery the primary practical attack, while ECB further weakens the design.

Attack Path

  1. An attacker ...[truncated 939 chars]
Remediation
View remediation

Remediation Suggestions

  • Replace ECB with an authenticated-encryption mode, such as SM4-GCM where supported by the deployment environment.
  • Generate a fresh, unpredictable nonce for every encryption operation and never reuse a nonce with the same key.
  • Store or transmit the nonce, ciphertext, and authentication tag together.
  • Verify the authentication tag before decrypting or parsing any plaintext.
  • Use a maintained cryptographic library's padding implementation if a padded mode is unavoidable.
  • Reject invalid ciphertext lengths and malformed encodings before decryption.
  • Separate encryption from payment authentication; payment authorization should rely on provider signatures or authenticated server-side verification.
Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

A tarot-reading skill has no obvious need for cryptographic key generation/validation and encryption/decryption absent transparent payment-service documentation, especially when no tarot dataset or card-draw logic is evident. Such divergence makes the skill more dangerous because it can conceal non-obvious processing behind an innocuous theme, undermining informed consent and reviewability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A tarot-reading skill has no obvious need for cryptographic key generation/validation and encryption/decryption absent transparent payment-service documentation, especially when no tarot dataset or card-draw logic is evident. Such divergence makes the skill more dangerous because it can conceal non-obvious processing behind an innocuous theme, undermining informed consent and reviewability.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A tarot-reading skill has no obvious need for cryptographic key generation/validation and encryption/decryption absent transparent payment-service documentation, especially when no tarot dataset or card-draw logic is evident. Such divergence makes the skill more dangerous because it can conceal non-obvious processing behind an innocuous theme, undermining informed consent and reviewability.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file’s primary behavior is generating payment orders, encrypting payment payloads, and persisting order records rather than implementing tarot card draw or divination functionality. This is dangerous because the skill’s declared purpose does not match its operational behavior, creating a deceptive capability gap that can mislead users into triggering financial workflows and data collection they did not reasonably expect.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill advertises a simple tarot-reading workflow but omits any explicit tool scope while static analysis detected file read/write capabilities. In an agent environment, undeclared capabilities reduce transparency and can let the skill access or persist local data in ways the user did not reasonably expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file describes the skill's purpose and capabilities but does not define any explicit trigger phrases, activation conditions, or exclusion conditions. For a skill manifest/README, that absence makes it unclear when the agent should invoke this skill versus treating tarot-related language as ordinary conversation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill describes a paid workflow with order creation and payment, but it does not present a strong, explicit warning that invoking the workflow will create an order and require payment before service delivery. In an agent setting, insufficient upfront notice can lead to unintended transactional actions and user deception, especially given the harmless-seeming tarot framing.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script handles payment recipient data, order creation, and encrypted payment payload generation without any clear connection to tarot functionality in this file. Even if the payment path is not inherently malicious, embedding unrelated financial-processing behavior in a divination skill increases the risk of hidden monetization, user deception, and broader abuse if the surrounding system auto-executes this workflow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The user’s question is written into persistent storage as part of the order record, but this file shows no user notice, consent, retention control, or minimization. Questions submitted to a tarot service may contain sensitive personal, emotional, relationship, or health-related details, so silent persistence creates a privacy and compliance risk if the database is accessed, retained too long, or repurposed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script saves an order object containing the user’s question, payment metadata, and encrypted payment data to storage without any evident disclosure in this file. Combining sensitive user input with payment-related artifacts increases privacy exposure and may enable profiling or secondary misuse if storage is compromised or used beyond the user’s expectations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This utility module implements persistent order, payment, and fulfillment storage that materially exceeds the stated tarot skill behavior of drawing and interpreting a card. While persistence is not inherently malicious, collecting and storing transaction metadata, order history, and fulfillment state creates unnecessary data-retention and privacy risk for a simple divination feature, especially when no minimization, consent, retention, or access controls are evident.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code loads payment configuration and later supports storage of customer/order metadata such as question, amount, pay_to, client_ip, and timestamps, which is not justified by the manifest's simple tarot-reading description. In this context, hidden payment and customer-data handling is dangerous because users may not expect financial or identifying information to be accessed or retained, increasing privacy, compliance, and trust risks.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill name is hard-coded in Chinese and, throughout the file, user-facing messages are written only in Chinese. This indicates a fixed language/locale behavior without any opt-in, fallback, or documented regional justification, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/serve.py (reported line 16)May include surrounding context.

python
config = load_config()
    sm4_key_b64 = config.get("crypto", {}).get("sm4_key")
    sm4_key = base64.b64decode(sm4_key_b64)
    indicator = __import__("hashlib").md5(SLUG.encode("utf-8")).hexdigest()
    conn = get_db_connection()
    cursor = conn.execute("SELECT * FROM orders WHERE order_no = ?", (order_no,))
    order = cursor.fetchone()

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/serve.py (reported line 159)May include surrounding context.

python
config = load_config()
    sm4_key_b64 = config.get("crypto", {}).get("sm4_key")
    sm4_key = base64.b64decode(sm4_key_b64)
    indicator = __import__("hashlib").md5(SLUG.encode("utf-8")).hexdigest()
    conn = get_db_connection()
    cursor = conn.execute("SELECT * FROM orders WHERE order_no = ?", (order_no,))
    order = cursor.fetchone()

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes a tarot-reading service that randomly draws a card and provides interpretation, but this file implements generic SM4 cryptographic helpers, key validation, and key generation. Encryption support is not an obvious implementation detail for drawing tarot cards or generating daily guidance, so the code behavior exceeds the stated skill purpose.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill contains unjustified cryptographic capability that expands what the package can do beyond its stated tarot purpose, which is risky in an agent context because it can conceal data handling or enable opaque transport of sensitive values. In addition, the implementation uses SM4 in ECB mode, which is an insecure construction for most real-world data because it leaks plaintext structure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The natural-language comments in this config are written exclusively in Chinese, which can amount to a language/locale policy issue when no user choice or justification is provided. The file does not indicate that the skill is region-specific or that Chinese is an intentional, documented requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

This file uses Chinese as the fixed language for the skill slug and runtime error messages, and later also for default user-facing content. That creates a language/locale constraint without any opt-in, fallback, or explanation that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The order description and default CLI question are hard-coded in Chinese, which enforces a specific language for interaction. The file does not provide any mechanism for locale selection or state that the skill is intentionally limited to Chinese-speaking users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

Multiple user-facing docstrings and error text are written only in Chinese, such as the configuration error message at L031. The file does not indicate that the skill is region-specific or provide any user opt-in for language/locale, which can violate language-choice policy.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

This file’s natural-language documentation and user-facing error/output strings are entirely in Chinese, with no indication that the skill is intentionally limited to a Chinese-speaking or region-specific context. Under the policy rule, forcing a specific language without opt-in can be a locale-policy issue.

Content

No source excerpt is available for this finding.