T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:31
- Finding
- Overbroad HTTP Method and Wildcard Route Authorization<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 31–41, 49–75, and 113–119 **Vulnerability Type**: Excessive network capability and insufficient route validation **Risk Level**: Medium ### Vulnerable Code ```bash # Fixed, non-overridable: an env-configurable base URL would let anything that # can set CRAWLORA_API_BASE redirect this key to an attacker-controlled host. base="https://api.crawlora.net/api/v1" method="GET" body="" args=() while [ $# -gt 0 ]; do case "$1" in -X) method="$2"; shift 2 ;; -d) body="$2"; shift 2 ;; *) args+=("$1"); shift ;; esac done ``` ```bash case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the app-review-mining 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 app-review-mining skill" >&2 exit 2 ;; esac case "$path" in /appstore/app) ;; /appstore/developer/*) ;; /appstore/editorial) ;; /appstore/editorial/category) ;; /appstore/list) ;; /appstore/privacy/*) ;; /appstore/ratings) ;; /appstore/reviews) ;; /appstore/search) ;; /appstore/similar) ;; /appstore/suggest/*) ;; /appstore/version-history/*) ;; /googleplay/app) ;; /googleplay/categories) ;; /googleplay/datasafety) ;; /googleplay/developer/*) ;; /googleplay/list) ;; /googleplay/permissions) ;; /googleplay/ratings) ;; /googleplay/reviews) ;; /googleplay/search) ;; /googleplay/similar) ;; /googleplay/suggest/*) ;; *) echo "path is not in the app-review-mining skill catalog" >&2 exit 2 ;; esac ``` ```bash if [ "$method" = "GET" ]; then # -G + --data-urlencode URL-encodes each value (so spaces etc. are safe). qs=() for kv in ${rest[@]+"${rest[@]}"}; do [ -n "$kv" ] || continue # curl treats both @file and name@file forms as local-file input for # --data-urlencode. Reject @ outrig ...[truncated 3351 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove `POST` support because every endpoint documented for this Skill uses `GET`: ```bash if [ "$method" != "GET" ]; then echo "only GET is supported by the app-review-mining skill" >&2 exit 2 fi ``` 2. Replace broad wildcard route checks with exact route-template validation. Require precisely one nonempty path segment for parameterized routes and reject additional slashes. 3. Validate each path parameter according to the endpoint catalog: - Require numeric values for App Store track and developer IDs where documented. - Restrict package names and bundle IDs to an explicit safe character set. - Validate suggestion terms separately and URL-encode them rather than inserting raw text into a path. 4. Maintain a centralized route table mapping each operation to its exact HTTP method, path template, and parameter validation rules. Reject every request that does not match the table exactly. 5. Add automated negative tests covering unsupported methods, additional path segments, malformed IDs, encoded separators, empty path parameters, and attempts to access undocumented endpoints. ]]>
