T09 · Insecure Skill Coding Practices
Note
- Location
- scripts/crawlora.sh:42
- Finding
- Helper permits authenticated POST requests outside the documented endpoint contract<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 42–48 and 92–98 **Vulnerability Type**: Excessive HTTP method capability and insufficient request-contract enforcement **Risk Level**: Low ### Technical Analysis The Skill documentation defines both permitted Apple Jobs endpoints as GET-only operations: - `GET /apple-jobs/job` - `GET /apple-jobs/search` However, the helper accepts both GET and POST, allows callers to provide arbitrary request bodies, and sends POST requests using the user's Crawlora API key. Relevant code: ```sh while [ $# -gt 0 ]; do case "$1" in -X) method="$2"; shift 2 ;; -d) body="$2"; shift 2 ;; *) args+=("$1"); shift ;; esac done ``` ```sh case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the apple-jobs-research skill" >&2 exit 2 ;; esac ``` ```sh else [ -n "$body" ] || body="${rest[0]:-}" [ -n "$body" ] || body='{}' # Stream the body on stdin so curl never interprets a user value as its # @file shorthand (and cannot read local files supplied in a request body). printf '%s' "$body" | curl -fsS -X "$method" "${auth[@]}" \ -H "Content-Type: application/json" --data-binary @- "${base}${path}" fi ``` This capability exceeds the minimum privileges required by the declared functionality. The hostname and paths remain fixed and allowlisted, which significantly limits exposure, but the HTTP method and body are not constrained to the documented API contract. The implementation also does not validate endpoint-specific parameter names or required parameters. Consequently, authenticated content can be transmitted to the two allowlisted routes even though the Skill only requires query-based GET requests. ### Attack Path 1. An attacker influences the arguments used to invoke `scripts/crawlora.sh`, such as through an untrusted prompt or an unsafe wrapper. 2. The attacker supplies `-X POST` and an arbitrary JSON body through `-d` or a positi ...[truncated 1415 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Restrict the helper to GET requests and remove the `-X` and `-d` interfaces. 2. Reject all methods other than GET rather than maintaining unnecessary POST support. 3. Validate parameters separately for each route: - `/apple-jobs/job`: permit only the required `id` parameter. - `/apple-jobs/search`: permit only `q`, `location`, and `page`; require `q`. 4. Reject duplicate, malformed, and unknown parameters. 5. Validate `page` as a positive integer and apply reasonable length limits to all string values. 6. Retain the existing fixed HTTPS base URL, route allowlist, API-key character validation, URL encoding, mode-600 temporary file, and cleanup trap. 7. Add automated negative tests confirming that POST, unknown methods, unknown parameters, missing required parameters, and non-allowlisted routes are rejected before any network request occurs. ]]>
