T09 · Insecure Skill Coding Practices
- Location
scripts/api_client.js:6- Finding
Credentials and Bearer Tokens Can Be Sent to an Arbitrary or Plaintext Backend
- Content
View full analysis
Vulnerability Details
File Location:
scripts/api_client.js:6-7, 51-52, 65
Vulnerability Type: Unrestricted backend override and insecure transport of authentication material
Risk Level: HighVulnerable Code
javascript constructor() { this.baseUrl = process.env.BACKEND_URL || 'https://javatoarktsapi.uctoo.com'; this.accessToken = null; }javascript const isHttps = fullUrl.startsWith('https://'); const client = isHttps ? https : http;javascript if (requireAuth && this.isAuthenticated()) { options.headers['Authorization'] = `Bearer ${this.accessToken}`; }Technical Analysis
The client accepts
BACKEND_URLdirectly from the process environment without validating its scheme, hostname, port, or origin. It explicitly supports both HTTPS and plaintext HTTP. Thelogin()method sends the supplied username and password to this configured backend, and authenticated API calls automatically attach the stored bearer token.Environment configuration is a legitimate deployment mechanism, but authentication material should not be forwarded to an unrestricted origin. Supporting plaintext HTTP also exposes credentials and tokens to interception and modification by network-adjacent attackers.
This behavior exceeds minimum privilege because the declared Skill only needs access to the UCTOO backend, not arbitrary network destinations.
Attack Path
- An attacker influences the runtime environment, deployment configuration, wrapper script, or service definition.
- The attacker sets
BACKEND_URLto an attacker-controlled URL or a plaintext HTTP endpoint. - A user invokes
login(username, password). - The client sends the supplied credentials to the configured destination.
- If the destination returns a response containing
data.access_token, the client stores that value. - Subsequent authenticated calls automatically send the bearer token ...[truncated 524 chars]
- Remediation
View remediation
Remediation Suggestions
- Require
https:for every non-development backend and reject plaintext HTTP before sending a request. - Validate the parsed URL against an explicit allowlist of approved UCTOO hostnames, ports, and schemes.
- Reject URLs containing embedded credentials, fragments, or unexpected ports.
- Bind stored tokens to the exact origin that issued them. Never forward a token after an origin change.
- Separate development support for localhost from production behavior and require an explicit insecure-development flag.
- Avoid following cross-origin redirects for requests containing credentials or authorization headers.
- Add tests proving that HTTP, unapproved hosts, malformed URLs, and origin changes are rejected.
- Require
