T09 · Insecure Skill Coding Practices
- Location
scripts/eebus_query.js:120- Finding
Hard-Coded API Signing Key Enables Request Forgery
- Content
View full analysis
16 && (a = d(a, 32 * r)); var o = Array(16), h = Array(16); for (u = 0; u < 16; u++) { o[u] = 909522486 ^ a[u]; h[u] = 1549556828 ^ a[u] } var t = d(o.concat(D(input)), 512 + input.length * r); var g = d(h.concat(t), 640); var s = "0123456789abcdef", l2 = ""; for (u = 0; u < 4 * g.length; u++) l2 += s.charAt(g[u >> 2] >> u % 4 * 8 + 4 & 15) + s.charAt(g[u >> 2] >> u % 4 * 8 & 15); ``` ### Technical Analysis The fixed integer array is transformed into the secret key used by the custom HMAC-MD5 request-signing implementation. Because the signing material and the complete signing algorithm are distributed with the Skill, any person who obtains the source code can reconstruct the key and generate signatures independently. The script signs a concatenation of a client-generated token, timestamp, and nonce. Those changing values do not protect an exposed shared key because an attacker can choose their own values and calculate the corresponding signature. The token and nonce are also generated with `Math.random()` elsewhere in the script, which is not a cryptographically secure random-number generator, although exposure of the shared signing key is the principal weakness. The actual authorization checks and rate limits enforced by the remote server were not available for static review. Therefore, successful access beyond the public query functions cannot be asserted. Nevertheless, the client-side secret cannot provide a meaningful trust boundary. ### Attack Path 1. Obtain the distributed `scripts/eebus_query.js` file. 2. Extract the fixed integer arra ...[truncated 1219 chars]- Remediation
View remediation
