T09 · Insecure Skill Coding Practices
- Location
scripts/service.py:51- Finding
Payment Authorization Can Be Forged Through Local 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 and time.time() - credential_ts > CREDENTIAL_TTL: return False return True ``` ```python pay_status = order_data.get("payStatus", "SUCCESS") print(f"PAY_STATUS: {pay_status}") if pay_status != "SUCCESS": print(f"ERROR_INFO: Payment status is '{pay_status}', cannot proceed") sys.exit(1) ``` ### Technical Analysis The service treats any non-empty `payCredential` value as valid. It does not cryptographically verify the credential's signature, issuer, order number, amount, recipient, or integrity. Expiration also fails open: if `credentialTimestamp` is absent, the credential is accepted indefinitely. Similarly, an absent `payStatus` defaults to `SUCCESS`. Consequently, local JSON fields controlled by the user are treated as authoritative payment evidence. ### Attack Path 1. Run `create_order.py` to create an order file or manually create one under the expected order directory. 2. Edit the order JSON and add a non-empty value such as `"payCredential": "x"`. 3. Omit `credentialTimestamp` so that expiration is not enforced. 4. Omit `payStatus`, causing it to default to `SUCCESS`. 5. Run `python3 scripts/service.py ""`. 6. The script prints `AUTHORIZATION_RESULT=verified` without validating a genuine payment. ### Impact Assessment Any user or process able to modify the local order file can bypass the payment gate. This permits unauthorized service activation and undermines the integrity of the payment workflow. The issue does not, by itself, grant operating-system privileges or remote access. ]]>- Remediation
View remediation
