T09 · Insecure Skill Coding Practices
- Location
src/config.js:20- Finding
Bearer Credentials and Authentication Responses Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
src/config.js:20;src/client.js:53-72
Vulnerability Type: Plaintext transmission of authentication credentials
Risk Level: HighTechnical Analysis
The built-in service endpoint uses unencrypted HTTP:
js const DEFAULT_BASE_URL = 'http://st.aidata366.com';The API client subsequently sends the user's bearer token to that endpoint in the
Authorizationheader:js if (!_httpWarned && this.token && this.baseUrl.startsWith('http://')) { _httpWarned = true; process.stderr.write('[warn] 当前服务地址为明文 http,token 会明文传输,建议确认网络安全或切换 https\n'); } res = await fetch(this.baseUrl + '/api/v1' + apiPath, { method, headers: { ...(body ? { 'Content-Type': 'application/json' } : {}), ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}), ...headers, }, body: body ? JSON.stringify(body) : undefined, signal: ctrl.signal, });The stderr warning only reports the condition and does not stop or protect the request. Authenticated commands therefore transmit reusable bearer credentials without transport confidentiality or server authentication.
The registration and login checking flow also uses the default base URL and receives the newly issued token in an HTTP response before saving it. Consequently, the credential can be exposed even during its initial issuance, not only during later authenticated requests.
This crosses the trust boundary between the user's local credential store and the public network. A network-positioned adversary does not need to compromise the configured service or the user's account beforehand.
Attack Path
- The user runs registration, login, quota, collection, query, export, or session commands without replacing the default endpoint.
- The CLI connects to
http://st.aidata366.com. - During login or registration checking, the service returns the account token over plaintext HTTP ...[truncated 885 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the default endpoint with an HTTPS URL that has a valid, correctly scoped certificate.
- Reject authenticated requests to non-HTTPS endpoints instead of merely printing a warning.
- If plaintext HTTP is needed for local development, restrict it to loopback addresses and require an explicit development-only override.
- Apply the HTTPS requirement to login and registration session checking because those responses carry newly issued credentials.
- Do not recommend disabling certificate validation as a routine alternative. For private deployments, support an explicitly configured custom certificate authority.
- After deploying HTTPS enforcement, revoke or rotate tokens that may previously have traversed untrusted networks over HTTP.
