T09 · Insecure Skill Coding Practices
- Location
scripts/service.py:20- Finding
Payment Authorization Can Be Forged Through Locally Modified Order Data
- Content
View full analysis
bool: credential = order_data.get("payCredential") if not credential: return False credential_ts = order_data.get("credentialTimestamp") if credential_ts: age = time.time() - credential_ts if age > CREDENTIAL_TTL: return False return True ``` ```python if not is_credential_valid(order_data): print("PAY_STATUS: ERROR") print("ERROR_INFO: 未找到有效的支付凭证。请先通过 clawtip 完成支付。") sys.exit(1) pay_status = order_data.get("payStatus", "SUCCESS") print(f"PAY_STATUS: {pay_status}") if pay_status != "SUCCESS": print(f"ERROR_INFO: 支付状态为 {pay_status},无法续进") sys.exit(1) print("AUTHORIZATION_RESULT=verified") ``` ### Technical Analysis The service treats any non-empty `payCredential` value as proof of payment. It does not cryptographically verify the credential, establish a chain of trust to clawtip, or bind the credential to the expected order number, amount, recipient, or Skill indicator. The timestamp check is also fail-open. If `credentialTimestamp` is absent, the credential never expires. In addition, `payStatus` defaults to `SUCCESS` when the field is absent. Because order files are ordinary locally writable JSON files, an actor with access to the user's account or any Agent/tool with filesystem write permission can fabricate the fields required for authorization. ### Attack Path 1. Create an order using `scripts/create_order.py`. 2. Locate the resulting JSON file under the documented local orders directory. 3. Add an arbitrary non-empty field such as: ```json { "payCredential": "forged" } ``` 4. Omit `credentialTimestamp`, avoiding the expiration check. 5. Omit `payStatus`, causing the code to de ...[truncated 525 chars]- Remediation
View remediation
