T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:45
- Finding
- Route Allowlist and HTTP Method Validation Bypass## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 45-113 **Vulnerability Type**: Permissive route matching and method authorization **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 prediction-markets-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 prediction-markets-research skill" >&2 exit 2 ;; esac case "$path" in /kalshi/event/*) ;; /kalshi/event/*/history) ;; /kalshi/event/*/metadata) ;; /kalshi/events) ;; /kalshi/events/multivariate) ;; /kalshi/exchange/schedule) ;; /kalshi/exchange/status) ;; /kalshi/historical/cutoff) ;; /kalshi/historical/market/*) ;; /kalshi/historical/market/*/history) ;; /kalshi/historical/markets) ;; /kalshi/historical/trades) ;; /kalshi/market/*) ;; /kalshi/market/*/history) ;; /kalshi/market/*/orderbook) ;; /kalshi/markets) ;; /kalshi/markets/history) ;; /kalshi/markets/orderbooks) ;; /kalshi/series) ;; /kalshi/series/*) ;; /kalshi/trades) ;; /metaculus/category/*/questions) ;; /metaculus/comments-feed) ;; /metaculus/project/*/questions) ;; /metaculus/question/*) ;; /metaculus/question/*/forecast-history) ;; /metaculus/question/*/forecasts) ;; /metaculus/question/*/metadata) ;; /metaculus/question/*/options) ;; /metaculus/questions) ;; /metaculus/top-comments) ;; /metaculus/tournament/*/questions) ;; /polymarket/activity/trades) ;; /polymarket/clob/market/*) ;; /polymarket/dashboards/macro ...[truncated 3676 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the independent method and path checks with a single route table that binds each endpoint shape to its permitted HTTP method. 2. Validate every path parameter as exactly one nonempty segment using an explicit character allowlist appropriate to that parameter, such as identifiers, numeric IDs, slugs, or tickers. 3. Reject slash characters inside path parameters instead of relying on unrestricted shell `*` patterns. 4. Permit `POST` only for the four documented batch endpoints: - `/polymarket/tokens/midpoints` - `/polymarket/tokens/orderbooks` - `/polymarket/tokens/prices` - `/polymarket/tokens/spreads` 5. Permit only `GET` for all endpoints documented as read-only GET routes. 6. Use anchored regular expressions or explicit parsing. For example: ```bash if [[ "$method" == "GET" && "$path" =~ ^/kalshi/market/[A-Za-z0-9._-]+$ ]]; then : elif [[ "$method" == "GET" && "$path" =~ ^/kalshi/market/[A-Za-z0-9._-]+/(history|orderbook)$ ]]; then : elif [[ "$method" == "POST" && "$path" =~ ^/polymarket/tokens/(midpoints|orderbooks|prices|spreads)$ ]]; then : else echo "unsupported route or HTTP method" >&2 exit 2 fi ``` 7. Add negative tests for nested paths, method mismatches, encoded separators, empty parameters, and undocumented suffixes. 8. Retain the fixed HTTPS base URL, restricted API-key alphabet, private temporary configuration file, and stdin-based POST body handling, as these controls appropriately reduce credential leakage and local-file disclosure risks.
