T09 · Insecure Skill Coding Practices
- Location
scripts/gateway-request.sh:27- Finding
Unrestricted Gateway Override Can Disclose the API Key
- Content
View full analysis
Vulnerability Details
File Location:
scripts/gateway-request.sh, lines 27–36
Vulnerability Type: Unvalidated network destination for sensitive credentials
Risk Level: Mediumbash BASE_URL="${ONEBOUND_BASE_URL:-https://onebound.vercel.app}" REQUEST_ARGS=() for pair in "$@"; do REQUEST_ARGS+=(--data-urlencode "$pair") done RESPONSE=$(curl -sS -G -w "\n%{http_code}" "${BASE_URL}${PATH_SUFFIX}" \ -H "Authorization: Bearer ${ONEBOUND_API_KEY}" \ "${REQUEST_ARGS[@]}")Technical Analysis
The script permits
ONEBOUND_BASE_URLto specify an arbitrary network destination without validating its scheme, hostname, port, user information, query string, or fragment. It subsequently sendsONEBOUND_API_KEYto that destination in a bearer authorization header.Although transmitting the key to the documented Onebound HTTPS gateway is necessary for the declared product-search and item-detail functionality, unrestricted destination selection is not required for normal operation. It creates a credential-exfiltration risk if the environment variable is maliciously or accidentally changed. The script also accepts plaintext HTTP URLs, which could expose the API key and request data to network interception.
The request query parameters can contain users' product search terms and item identifiers. Those values would be disclosed alongside the credential when requests are redirected to an untrusted gateway.
Attack Path
- An attacker, compromised launcher, unsafe environment file, or erroneous configuration sets
ONEBOUND_BASE_URLto an attacker-controlled destination, such ashttp://attacker.example. - A user invokes one of the legitimate Taobao or 1688 search/detail wrapper scripts.
- The wrapper delegates the request to
gateway-request.sh. - The helper constructs the URL from the unvalidated base URL and the endpoint path.
curlsendsAuthorization: Bearer ${ONEBOUND_API_KEY}a ...[truncated 835 chars]
- An attacker, compromised launcher, unsafe environment file, or erroneous configuration sets
- Remediation
View remediation
Remediation Suggestions
- Remove the configurable base URL if custom gateways are not an essential requirement, and use the fixed destination
https://onebound.vercel.app. - If custom gateways are required, parse and validate the URL before attaching credentials.
- Require the
httpsscheme and reject plaintext HTTP. - Allowlist approved hostnames, expected ports, and endpoint prefixes.
- Reject URLs containing embedded credentials, query strings, or fragments.
- Bind credentials to destinations: use a separate, explicitly configured, least-privileged credential for each custom gateway rather than sending the default Onebound key to arbitrary hosts.
- Require explicit user or administrator approval before enabling a non-default gateway.
- Configure
curlto restrict protocols, for example with--proto '=https'. - Document the trust implications of gateway overrides and avoid inheriting this security-sensitive setting from untrusted environment files.
- Rotate the API key immediately if it may already have been sent to an unauthorized endpoint.
- Remove the configurable base URL if custom gateways are not an essential requirement, and use the fixed destination
