T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:12
- Finding
- Canvas bearer token may be transmitted to an untrusted configurable endpoint## Vulnerability Details **File Location**: `SKILL.md`, lines 12-20 **Vulnerability Type**: Unvalidated credential destination and insufficient transport enforcement **Risk Level**: Medium ### Vulnerable Code ```bash export CANVAS_TOKEN="your_token_here" export CANVAS_URL="https://your-school.instructure.com" # or canvas.yourschool.edu ``` ```bash curl -s -H "Authorization: Bearer $CANVAS_TOKEN" "$CANVAS_URL/api/v1/..." ``` ### Technical Analysis The Skill instructs the agent to obtain the request destination from the environment-controlled `CANVAS_URL` variable and send `CANVAS_TOKEN` in an HTTP authorization header. It does not require HTTPS at execution time, validate the destination hostname against a trusted Canvas instance, or request confirmation before sending the credential. Although the documented example uses HTTPS, a modified, poisoned, or mistakenly configured `CANVAS_URL` can identify an attacker-controlled server or an unencrypted HTTP endpoint. Following the documented command would then disclose the bearer token to that endpoint. The exposed token could subsequently be reused according to the permissions granted by Canvas. Network access and Canvas authentication are necessary for the declared functionality. However, transmitting a sensitive bearer token without validating the configured destination exceeds safe minimum credential-handling requirements. The separate `curl ... | python3 -c ...` response-processing example is not remote payload execution: it parses downloaded content as JSON using fixed local Python code and does not evaluate the response as Python or shell source. ### Attack Path 1. An attacker, compromised setup process, or erroneous configuration changes `CANVAS_URL` to an attacker-controlled hostname or an HTTP endpoint. 2. The user or agent executes a documented Canvas API request without validating the configured scheme and hostname. 3. `curl` sends the `Authorization: Beare ...[truncated 927 chars]
- Remediation
- ## Remediation Suggestions 1. Require an HTTPS URL and reject every other scheme before transmitting the token. 2. Parse and validate `CANVAS_URL` rather than concatenating an arbitrary environment value into authenticated requests. 3. Require the hostname to match a user-approved Canvas domain or an explicit allowlist. 4. Reject URLs containing embedded credentials, unexpected paths, query strings, fragments, or nonstandard ports unless explicitly required. 5. Use hardened curl options such as: ```bash curl --fail-with-body --show-error --silent \ --proto '=https' \ --max-redirs 0 \ --connect-timeout 10 \ --max-time 30 \ -H "Authorization: Bearer $CANVAS_TOKEN" \ "$VALIDATED_CANVAS_URL/api/v1/..." ``` 6. If redirects are later enabled, ensure authentication headers cannot be forwarded to a different origin and validate every redirect destination. 7. Prompt the user to confirm the normalized destination hostname before the first authenticated request. 8. Recommend a least-privilege, revocable Canvas token and document immediate revocation and replacement procedures for suspected exposure. 9. Store the token in a protected secret manager or tightly permissioned environment configuration. Avoid committing it to the project or placing it in an unprotected `.env` file.
