T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:46
- Finding
- Overbroad HTTP Method and Route Authorization<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh:46-70` **Vulnerability Type**: Authenticated API scope is broader than the documented Skill requirements **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 auction-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 auction-research skill" >&2 exit 2 ;; esac case "$path" in /bonhams/auctions/*) ;; /bonhams/auctions/*/lots) ;; /bonhams/auctions/search) ;; /bonhams/lots/*/*) ;; /bonhams/lots/search) ;; *) echo "path is not in the auction-research skill catalog" >&2 exit 2 ;; esac ``` ### Technical Analysis The endpoint reference defines five Bonhams endpoints, all of which use the `GET` method. The helper nevertheless permits both `GET` and `POST`, allowing callers to submit authenticated POST requests that are not required by the Skill's documented functionality. The route allowlist is also broader than its comments imply. In a Bash `case` pattern, `*` matches slash characters as well as ordinary characters. Consequently, `/bonhams/auctions/*` accepts every non-empty suffix beneath `/bonhams/auctions/`, including paths with additional segments. It also subsumes the later auction-specific patterns, making those rules ineffective as scope restrictions. The fixed base URL prevents redirection of the API key to an attacker-controlled host, and the reviewed code does not expose the key on the curl command line. However, overbroad method and path authorization allows an untrusted caller or compromised agent workflow to use the victim's ...[truncated 1345 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove POST support because every endpoint documented for this Skill is GET-only: ```bash if [ "$method" != "GET" ]; then echo "only GET is supported by the auction-research skill" >&2 exit 2 fi ``` 2. Replace slash-permissive glob patterns with segment-aware validation. Validate dynamic identifiers separately and reject `/`, empty values, and unexpected characters. 3. Allow only these exact route forms: ```text /bonhams/auctions/search /bonhams/auctions/{id} /bonhams/auctions/{id}/lots /bonhams/lots/search /bonhams/lots/{auctionId}/{lotNumber} ``` 4. Check static routes before dynamic routes so values such as `search` cannot be ambiguously interpreted as identifiers. 5. Apply conservative character and length restrictions to `id`, `auctionId`, and `lotNumber`, based on the actual Bonhams identifier formats. 6. Add negative tests covering POST requests, extra path segments, empty identifiers, encoded separators, duplicate separators, traversal syntax, query fragments, and undocumented paths. Verify that every such request is rejected before curl is invoked. ]]>
