T09 · Insecure Skill Coding Practices
- Location
scripts/service.py:27- Finding
Payment Credential Validation Can Be Forged
- Content
View full analysis
bool: credential = order_data.get("payCredential") if not credential: return False credential_ts = order_data.get("credentialTimestamp") if credential_ts and time.time() - credential_ts > CREDENTIAL_TTL: return False return True ``` ```python order_data = load_order(indicator, args.order_no) if is_credential_valid(order_data): pay_status = order_data.get("payStatus", "SUCCESS") if pay_status == "SUCCESS" or pay_status == "TEST_SUCCESS": print("\n" + "=" * 60) print(" Payment Verified - Adding Recommendation Numbers") print("=" * 60) recommendation = run_paid_recommendation() print(recommendation) ``` ### Technical Analysis The payment authorization decision trusts fields read from a locally writable JSON file. Any nonempty `payCredential` value is treated as valid. The code does not cryptographically verify: - The credential issuer or signature. - The order number associated with the credential. - The required payment amount. - The payment recipient. - The Skill indicator. - Whether the credential has already been used. - Whether the payment provider actually reported a successful transaction. The timestamp check is also optional: a credential without `credentialTimestamp` never expires. In addition, a missing `payStatus` defaults to `"SUCCESS"`, causing incomplete or attacker-created records to be accepted. ### Attack Path 1. Create an ordinary local order by running `scripts/create_order.py`, or create an order JSON file with a valid numeric filename. 2. Edit the order file under `~/.openclaw/skills/orders//.json`. 3. Add an arbitrary nonempty value such as: ```json { ...[truncated 694 chars]- Remediation
View remediation
