T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:43
- Finding
- Route Allowlist and HTTP Method Restrictions Can Be Bypassed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 43–101 **Vulnerability Type**: Overly broad shell wildcard authorization and missing per-route method enforcement **Risk Level**: Medium ### Vulnerable Code ```bash case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the opensea-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 opensea-research skill" >&2 exit 2 ;; esac case "$path" in /opensea/activity) ;; /opensea/categories) ;; /opensea/chains) ;; /opensea/collection/*) ;; /opensea/collection/*/activity) ;; /opensea/collection/*/best-deals) ;; /opensea/collection/*/chart) ;; /opensea/collection/*/depth) ;; /opensea/collection/*/holders) ;; /opensea/collection/*/items) ;; /opensea/collection/*/offers) ;; /opensea/collection/*/rarest-items) ;; /opensea/collection/*/search-items) ;; /opensea/collection/*/social-proof) ;; /opensea/collection/*/top-sales) ;; /opensea/collection/*/trait-offers) ;; /opensea/collection/*/traits) ;; /opensea/collections) ;; /opensea/drops) ;; /opensea/item/*/*/*) ;; /opensea/item/*/*/*/activity) ;; /opensea/item/*/*/*/chart) ;; /opensea/item/*/*/*/depth) ;; /opensea/item/*/*/*/listings) ;; /opensea/item/*/*/*/offers) ;; /opensea/item/*/*/*/owners) ;; /opensea/most-watched) ;; /opensea/profile/*) ;; /opensea/profile/*/activity) ;; /opensea/profile/*/collections) ;; /opensea/profile/*/created) ;; /opensea/profile/*/items) ;; /opensea/profile/*/search-items) ;; /opensea/rankings) ;; /opensea/search/collections) ;; /opensea/top-movers) ;; *) echo "path is not in the opensea-research skill catalog" >&2 exit 2 ;; esac ``` ### Technical Analysis Bash `case` patterns use glob matching, and `*` can match slash characters. Consequently, ostensib ...[truncated 2743 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace broad shell-glob authorization with explicit route parsing that validates the exact number of path segments. 2. Restrict every dynamic segment to an appropriate allowlist, such as collection slugs, chain identifiers, hexadecimal contract addresses, token IDs, and profile identifiers. 3. Bind each endpoint to its documented HTTP method. If all current routes are GET-only, reject POST entirely. 4. Avoid generic patterns such as `/opensea/profile/*`. Match exact route shapes and reject any trailing segments. 5. Consider implementing route validation with anchored regular expressions or a table containing the allowed method and path pattern for each endpoint. 6. Add negative tests for nested paths, extra trailing segments, empty path parameters, encoded separators, unsupported methods, and undocumented endpoints. 7. Continue using the fixed HTTPS API origin and private temporary curl configuration, as these controls appropriately reduce API-key exposure. A hardened validation design should follow this structure: ```bash case "${method} ${path}" in "GET /opensea/activity"| "GET /opensea/categories"| "GET /opensea/chains"| "GET /opensea/collections"| "GET /opensea/drops"| "GET /opensea/most-watched"| "GET /opensea/rankings"| "GET /opensea/search/collections"| "GET /opensea/top-movers") ;; *) # Validate parameterized routes separately with anchored expressions and # exact segment counts before accepting them. ;; esac ``` Parameterized routes should then be checked using anchored expressions that cannot consume `/` inside a dynamic segment. ]]>
