T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:48
- Finding
- Overly Broad Route and HTTP Method Authorization<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 48–72 **Vulnerability Type**: Insufficient endpoint and method validation **Risk Level**: Medium ### Vulnerable Code ```bash # This skill's helper is limited to its documented Crawlora route set. Keep # caller-account surfaces and unrelated API routes out of the helper even if # someone supplies an undocumented path directly. case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the wish-research skill" >&2 exit 2 ;; esac # Reject path syntax that could smuggle a route through a shell glob check. case "$path" in ""|*[?#%]*|*..*|*//* ) echo "invalid path for the wish-research skill" >&2 exit 2 ;; esac case "$path" in /wish/categories) ;; /wish/product/*) ;; /wish/product/*/related) ;; /wish/product/*/reviews) ;; /wish/search) ;; /wish/suggest) ;; *) echo "path is not in the wish-research skill catalog" >&2 exit 2 ;; esac ``` ### Technical Analysis The documented Skill functionality consists of six read-only `GET` endpoints. However, the helper authorizes both `GET` and `POST` for every accepted path. This grants a request capability that is not required by the declared Wish research functionality. The path allowlist also uses the broad shell pattern `/wish/product/*`. In shell pattern matching, `*` can include slash characters, so this rule accepts arbitrary trailing path segments below `/wish/product/`. Because it appears before the more specific related-items and reviews rules, those later rules do not meaningfully restrict matching. The helper also does not enforce the documented requirement that a product ID be exactly 24 hexadecimal characters. As a result, a caller can submit an authenticated POST request with an arbitrary body to an undocumented path beneath `/wish/product/`. The helper will attach the user's `CRAWLORA_API_KEY` and transmit the request to the fixed Crawlora API origin. Alt ...[truncated 1485 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove POST support and require the only method documented by the endpoint reference: ```bash [ "$method" = "GET" ] || { echo "only GET is supported by the wish-research skill" >&2 exit 2 } ``` 2. Replace the broad route glob with exact route-shape validation. Extract and validate product IDs against `^[0-9a-fA-F]{24}$`, and allow only: - `/wish/categories` - `/wish/search` - `/wish/suggest` - `/wish/product/{24-character hexadecimal ID}` - `/wish/product/{24-character hexadecimal ID}/related` - `/wish/product/{24-character hexadecimal ID}/reviews` 3. Reject additional path segments rather than relying on `/wish/product/*`. 4. Add endpoint-specific query-parameter allowlists: - No parameters for categories and product details. - `query`, `count`, and `offset` as appropriate for search. - `query` only for suggestions. - `count` only for related items and reviews. 5. Validate numeric ranges and pagination constraints locally before sending authenticated requests. 6. Add negative tests confirming that POST, malformed IDs, extra path components, unknown parameters, and out-of-range values are rejected without making a network request. ]]>
