T09 · Insecure Skill Coding Practices
- Location
scripts/aria2.js:41- Finding
Aria2 RPC Credentials Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
{ const body = JSON.stringify({ jsonrpc: '2.0', id: Date.now(), method: method, params: ['token:' + config.token, ...params] }); const url = new URL(config.url); const isHttps = url.protocol === 'https:'; const lib = isHttps ? https : http; const options = { hostname: url.hostname, port: url.port || (isHttps ? 443 : 80), path: url.pathname || '/jsonrpc', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) } }; ``` ### Technical Analysis The RPC authentication token is placed directly into every JSON-RPC request as `token:`. The implementation selects Node.js's plaintext `http` client whenever the configured URL does not use the `https:` protocol. No validation rejects insecure HTTP endpoints or limits them to loopback interfaces. Consequently, a configuration such as `http://aria2.example.com/jsonrpc` transmits the authentication token, RPC method, and method parameters without transport encryption. An attacker with access to the network path can passively capture the token. An active man-in-the-middle attacker could additionally inspect or modify requests and responses. The 15-second request timeout does not provide confidentiality, integrity, or endpoint authentication. ### Attack Path 1. A user configures the Skill with an `http://` aria2 JSON-RPC endpoint. 2. The user invokes `add`, `list`, `pause`, `unpause`, `remove`, or `batch`. 3. The script constructs a request containing `token:`. 4. The script sends the request through Node.js's plaintext HTTP client. 5. An attacker mo ...[truncated 956 chars]- Remediation
View remediation
