T09 · Insecure Skill Coding Practices
- Location
invoice_cert.py:249- Finding
Remote API Response Silently Overrides User-Selected Statistics Behavior
- Content
View full analysis
Vulnerability Details
File Location:
invoice_cert.py, lines 249–259
Vulnerability Type: Unauthorized mutation of a state-changing request
Risk Level: MediumCode Snippet:
python result = post("/api/jxplus/zxtSkill/check/commitStatistics", { "data": {"commitType": args.commit_type, "bz": args.bz, "apiKey": args.api_key} }) msg = str(result.get("message", "")) if "1001" in msg or "1002" in msg: print(f"提示:{msg},正在自动重试(bz=Y)...") result = post("/api/jxplus/zxtSkill/check/commitStatistics", { "data": {"commitType": args.commit_type, "bz": "Y", "apiKey": args.api_key} })Technical Analysis
The
statisticscommand initially sends the user-selectedbzvalue. However, if the remote API's textualmessagecontains1001or1002, the script automatically submits another state-changing request withbz="Y".According to the Skill documentation,
bz=Ymeans canceling an unfinished statistics state. This differs materially frombz=N, which means proceeding while ignoring unchecked invoices. The retry therefore changes the semantics of the operation without obtaining renewed user authorization.The branch is controlled by an unstructured message returned across the remote-service trust boundary. It does not validate a dedicated status field, verify that the requested operation permits this fallback, or require explicit confirmation before changing the parameter.
Attack Path
- The user invokes the
statisticscommand and explicitly selects a behavior such as--bz N. - The script sends the initial request to
/api/jxplus/zxtSkill/check/commitStatistics. - The remote response contains
1001or1002in itsmessagefield. - The script treats the substring as authorization to retry.
- It sends a second request with
bz="Y", overriding the user's selected value. - The remote service may cancel an unfinishe ...[truncated 667 chars]
- The user invokes the
- Remediation
View remediation
Remediation Suggestions
- Never change
bzfrom the user-selected value automatically. - When the service indicates that
bz=Yis required, stop and explain that retrying would cancel an unfinished statistics state. - Require explicit user confirmation before submitting the modified request.
- Add a dedicated opt-in CLI option, such as
--allow-cancel-unfinished, and reject the retry unless it is present. - Use a documented structured response code rather than substring matching against the free-form
messagefield. - Record both the originally requested parameters and any proposed changes in the confirmation prompt.
- Add tests proving that responses containing
1001or1002cannot trigger a second state-changing request without explicit authorization.
- Never change
