T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:43
- Finding
- Overbroad Route and HTTP Method Allowlist Permits Undocumented Authenticated API Requests## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 43–67 **Vulnerability Type**: Overbroad route and HTTP method validation **Risk Level**: Medium ```bash case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the threads-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 threads-research skill" >&2 exit 2 ;; esac case "$path" in /threads/post/*/*) ;; /threads/post/*/*/replies) ;; /threads/profile/*) ;; /threads/profile/*/posts) ;; /threads/search) ;; *) echo "path is not in the threads-research skill catalog" >&2 exit 2 ;; esac ``` ### Technical Analysis The documented skill catalog contains five read-only `GET` endpoints. However, the helper accepts both `GET` and `POST`, allowing authenticated POST requests even though no POST endpoint is documented for this skill. The path allowlist also uses unanchored Bash `case` glob patterns. In Bash, `*` can match slash characters, so patterns such as `/threads/profile/*` and `/threads/post/*/*` do not enforce the expected number of path segments. For example, the profile pattern can accept paths containing additional segments after a username. The broad patterns also appear before the more specific `posts` and `replies` patterns, causing valid specific paths to match the broader rules first. Consequently, the validation does not reliably restrict requests to the five documented endpoint shapes. Any accepted request is subsequently sent to the fixed Crawlora API origin with the user's `CRAWLORA_API_KEY`. ### Attack Path 1. An attacker or untrusted caller controls the arguments passed to `scripts/crawlora.sh`. 2. The caller supplies an undocumented path under an accepted prefix, such as `/threads/profile/user/posts/extra`, ...[truncated 1155 chars]
- Remediation
- ## Remediation Suggestions - Restrict this skill to `GET` requests because every documented Threads endpoint is read-only. Remove POST handling from the method allowlist. - Replace broad shell globs with anchored validation that enforces exact path shapes and segment counts. - Define separate validations for: - `/threads/profile/{username}` - `/threads/profile/{username}/posts` - `/threads/post/{username}/{code}` - `/threads/post/{username}/{code}/replies` - `/threads/search` - Restrict `username` and `code` to explicitly approved character sets and reject empty segments, slashes, control characters, and URL-encoded delimiters. - Evaluate specific routes before broader alternatives if glob matching is retained, although anchored regular expressions are preferable. - Add negative tests covering POST and other non-GET methods, extra path segments, missing segments, encoded separators, traversal syntax, query fragments in paths, and undocumented route suffixes. - Preserve the existing fixed HTTPS origin and temporary credential-file protections.
