T09 · Insecure Skill Coding Practices
- Location
SKILL.md:140- Finding
Unrestricted API Base URL Can Expose Payment API Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:140-152and authenticated request examples atSKILL.md:206-208,243-245,283-285,308-310,338-340,375-377,400-402,422-424,430-432,448-450,458-460,475-477, and488-495
Vulnerability Type: Credential disclosure through an unrestricted API endpoint
Risk Level: HighVulnerable Code
bash | **Production** | `$AGENTWALLEX_BASE_URL` | Live environment. Use production API keys (`awx_sk_live_*`). | # Set the base URL (default: sandbox) export AGENTWALLEX_BASE_URL="https://api-sandbox.agentwallex.com/api/v1"Authenticated requests then transmit the API key to that environment-controlled URL:
bash curl -s -X POST \ "$AGENTWALLEX_BASE_URL/agents" \ -H "X-API-Key: $AGENTWALLEX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent_name": "payment-bot", "chain": "ethereum", "agent_description": "Handles outbound payments" }' | jqThe same pattern is used by balance, deposit, transfer, transaction-status, and transaction-list requests.
Technical Analysis
The skill documentation directs authenticated requests to a base URL obtained from the mutable
AGENTWALLEX_BASE_URLenvironment variable. It does not require the destination to use HTTPS, verify that the destination hostname belongs to AgentWallex, or enforce an allowlist of trusted sandbox and production origins.Because
curlattachesAGENTWALLEX_API_KEYas anX-API-Keyheader, anyone able to influence the environment variable can redirect a documented request to an attacker-controlled endpoint. Merely setting a trusted default does not prevent the variable from being inherited, overwritten, or poisoned before the workflow runs.This is particularly sensitive because the documented production keys begin with
awx_sk_live_*, and the skill supports administrative and financial operations.Attack Path
- An attacker, malicious wrapper, compromised shell profi ...[truncated 1160 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the unrestricted environment-controlled endpoint with explicit, hardcoded trusted origins for sandbox and production.
- Represent environment selection as a strict enumeration such as
sandboxorproduction, then map it internally to the corresponding trusted URL. - Before attaching credentials, parse and validate the URL:
- Require the
httpsscheme. - Require an exact approved hostname.
- Reject embedded credentials, unexpected ports, malformed URLs, redirects to untrusted hosts, and hostname-suffix tricks.
- Require the
- Configure
curlto reject insecure transport and unsafe redirection. Avoid forwarding authentication headers across origins. - Apply least-privilege API scopes, especially separating read-only administration from transfer authority.
- Rotate any key suspected of having been used while the base URL was untrusted.
- Add runtime tests verifying that credentials are never sent to HTTP endpoints, arbitrary hosts, or redirect destinations outside the approved allowlist.
- Document the exact trusted production endpoint rather than instructing users to provide an arbitrary URL.
