T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/trustee_api.py:426
- Finding
- Automatic Payment Without Explicit User Authorization<![CDATA[ ## Vulnerability Details **File Location**: `scripts/trustee_api.py:426-436` **Vulnerability Type**: `T05: Unauthorized Access and Privilege Escalation` **Risk Level**: High ### Vulnerable Code ```python if not paid and (pay_status == "pending" or (current_step and "pay" in current_step.lower())): print(f"[{datetime.now().strftime('%H:%M:%S')}] [{project_id}] 执行支付...", file=sys.stderr) pay_result = self.pay(project_id) code = pay_result.get("code") if isinstance(code, str): code = int(code) if code.isdigit() else 0 if code != 0 and code != 200: return {"code": code, "msg": f"支付失败: {pay_result.get('msg', '未知错误')}", "data": None} paid = True continue ``` The automatic-payment behavior is also documented in `SKILL.md:101-106` and `SKILL.zh-CN.md:101-106`. ### Technical Analysis The `execute_workflow` method automatically calls the authenticated payment endpoint when the remote API reports either: - `pay_status == "pending"`; or - a `current_step` value containing the substring `"pay"`. No explicit user confirmation is obtained immediately before payment. The implementation also does not retrieve and present the price in advance, validate an expected amount or currency, or enforce a user-defined spending limit. The decision to initiate payment consequently depends on status data returned by the remote service. Although automatic payment is mentioned in the skill documentation, starting an MV-generation workflow does not provide transaction-specific consent to an unknown charge. ### Attack Path 1. A user invokes `execute_workflow` to generate an MV. 2. The skill creates a project and submits the generation task using the user's `GIGGLE_API_KEY`. 3. During polling, the remote API returns `pay_status: "pending"` or a `current_step` containing `"pay"`. 4. The condition at lines 426-427 is satisfied. 5. The skill immediately calls `self.pay(project_id)` using the authenticated account. 6. The payment opera ...[truncated 842 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove automatic payment from `execute_workflow`. 2. When payment is required, return a structured response containing the project identifier, exact price, currency, and payment status. 3. Require explicit user confirmation immediately before calling `pay`. 4. Add a user-configurable maximum spending limit and reject amounts exceeding it. 5. Validate that the payment request belongs to the expected project and account. 6. Use an exact payment-state comparison rather than matching the substring `"pay"` in `current_step`. 7. Record a non-secret audit event containing the approved amount, project identifier, timestamp, and result. 8. Where supported, use a restricted API credential that cannot initiate payments without additional authorization. ]]>
