T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/ari.py:1169
- Finding
- Specialized workflow restrictions can be overridden through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/ari.py:1169-1171` and `scripts/ari.py:1647-1651` **Vulnerability Type**: Specialized workflow scope bypass **Risk Level**: Medium ### Vulnerable Code ```python def operation_payload(args): defaults = operation_defaults() workflow = (getattr(args, "workflow", None) or defaults.get("workflow") or "").strip() focus = (getattr(args, "focus", None) or defaults.get("focus") or "").strip() ``` The command-line parser exposes the overriding arguments: ```python def add_operation_args(parser, confirm=False): parser.add_argument("--asin", required=True) parser.add_argument("--site", default="amz_us", choices=SITES) parser.add_argument("--workflow") parser.add_argument("--focus") parser.add_argument("--competitor") parser.add_argument("--request-id", default="") ``` ### Technical Analysis The specialized Skill declares an immutable `weekly/competitor` workflow in `skill-defaults.json`, `SKILL.md`, and `references/operation-workflow.md`. However, `operation_payload()` gives command-line values precedence over those configured defaults. Consequently, the purportedly fixed workflow is not enforced as a local security boundary. An agent, user, or injected instruction can supply a different `--workflow` and `--focus`. The subsequent capability check only verifies that the ARI service supports the requested combination; it does not verify that the combination belongs to this specialized Skill. This does not bypass the server's account permissions or the explicit `--confirm` requirement. Nevertheless, it allows the package to perform supported paid operations outside its declared purpose and violates least-functionality expectations for a specialized Skill. ### Attack Path 1. The Skill is invoked for its declared competitor weekly-report function. 2. An attacker-controlled instruction or mistaken agent action supplies alternate `--workflow` and `--focus` values. 3. `operat ...[truncated 997 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat the values in `skill-defaults.json` as mandatory in specialized builds. 2. Remove `--workflow` and `--focus` from the specialized command-line interface, or reject values that do not exactly match the configured contract. 3. Distinguish specialized and generic builds explicitly rather than inferring behavior from optional defaults. 4. Add a local validation step before any quote or execution request: ```python def operation_payload(args): defaults = operation_defaults() configured_workflow = str(defaults.get("workflow") or "").strip() configured_focus = str(defaults.get("focus") or "").strip() supplied_workflow = str(getattr(args, "workflow", None) or "").strip() supplied_focus = str(getattr(args, "focus", None) or "").strip() if configured_workflow and supplied_workflow not in ("", configured_workflow): return None, error_obj( "ARI_WORKFLOW_OVERRIDE_BLOCKED", 0, "This specialized Skill does not permit workflow overrides." ) if configured_focus and supplied_focus not in ("", configured_focus): return None, error_obj( "ARI_FOCUS_OVERRIDE_BLOCKED", 0, "This specialized Skill does not permit focus overrides." ) workflow = configured_workflow or supplied_workflow focus = configured_focus or supplied_focus ``` 5. Have the service verify the Skill channel against an allowlisted workflow/focus combination so that a modified client cannot bypass the local restriction. 6. Add regression tests confirming that alternate workflow and focus values are rejected before a network request is sent. ]]>
