T09 · Insecure Skill Coding Practices
- Location
SKILL.md:13- Finding
Bearer Token Forwarded to an Unvalidated Configurable Host
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:13-14, 41-48, 696-697
Vulnerability Type: Bearer-token disclosure through an unvalidated API origin
Risk Level: MediumVulnerable Code
yaml env: - SNIPEIT_URL # e.g. https://assets.w-w.top - SNIPEIT_API_TOKEN # Bearer token from your profile → API keysbash local args=( -s -X "$method" -H "Authorization: Bearer $SNIPEIT_API_TOKEN" -H "Accept: application/json" -H "Content-Type: application/json" ) [ -n "$data" ] && args+=(-d "$data") curl "${args[@]}" "${SNIPEIT_URL}/api/v1${endpoint}" | jq .bash export SNIPEIT_URL="https://assets.w-w.top" export SNIPEIT_API_TOKEN="your_token_here"Technical Analysis
The helper constructs the request destination directly from the configurable
SNIPEIT_URLand unconditionally attachesSNIPEIT_API_TOKENas a bearer credential. It does not validate that the URL uses HTTPS, belongs to an approved Snipe-IT deployment, contains no user-information component, or matches the origin for which the token was issued.Consequently, a configuration mistake or attacker-controlled environment value can cause every API helper to disclose the bearer token to an unintended server. Shell quoting prevents ordinary argument-splitting injection through this variable, but it does not prevent credential exfiltration because
curlstill intentionally sends the authorization header to the selected origin.Attack Path
- An attacker influences
SNIPEIT_URL, such as through a modified environment configuration, copied setup command, deployment secret, or wrapper script. - The value is set to an HTTPS endpoint controlled by the attacker.
- The user invokes any helper such as
snipe_get,snipe_post, orsnipe_delete. - The helper builds an
Authorization: Bearer $SNIPEIT_API_TOKENheader without validating the destination. curltransmits the bearer token to the attacker-controlled endpoint.- The attacker captures ...[truncated 683 chars]
- An attacker influences
- Remediation
View remediation
Remediation Suggestions
- Require
SNIPEIT_URLto use HTTPS and reject all other schemes. - Parse and validate the URL before constructing authenticated requests.
- Reject URLs containing user information, fragments, unexpected paths, or malformed hostnames.
- Require the hostname to match an explicit administrator-managed allowlist or a pinned deployment origin.
- Replace the concrete example domain with an unmistakable placeholder such as
https://snipeit.example.com. - Display the resolved destination and require confirmation during initial configuration before sending credentials.
- Use a narrowly scoped API token with only the permissions required for the intended workflow.
- Store the token in a protected secret manager rather than reusable shell configuration files.
- Rotate the token immediately if it may have been sent to an unintended host.
- Consider certificate or public-key pinning in controlled deployments where the Snipe-IT endpoint is stable.
A hardened helper should fail closed before adding the authorization header:
bash validate_snipeit_url() { case "$SNIPEIT_URL" in "https://snipeit.example.com") ;; *) echo "Refusing unapproved Snipe-IT URL" >&2 return 1 ;; esac } snipe() { validate_snipeit_url || return 1 local method="${1:-GET}" local endpoint="$2" local data="${3:-}" local args=( --silent --show-error --fail-with-body --request "$method" --header "Authorization: Bearer $SNIPEIT_API_TOKEN" --header "Accept: application/json" --header "Content-Type: application/json" ) [ -n "$data" ] && args+=(--data "$data") curl "${args[@]}" "${SNIPEIT_URL}/api/v1${endpoint}" | jq . }- Require
