T09 · Insecure Skill Coding Practices
- Location
skill.js:3- Finding
Hard-Coded Clash REST API Bearer Secret
- Content
View full analysis
{ const options = { hostname: '127.0.0.1', port: port, path: path, method: method, headers: { 'Authorization': `Bearer ${secret}`, 'Content-Type': 'application/json' } }; ``` ### Technical Analysis The Clash REST API bearer secret is embedded directly in the distributed source code. It is automatically attached to every API request made by the skill. A source-level credential cannot remain confidential because any user, process, archive recipient, repository reader, or package consumer with access to the project can recover it. The exposure is especially significant if this credential is also present in a live Clash configuration. The code currently connects only to `127.0.0.1`, which limits direct remote exploitation by this skill. Nevertheless, the exposed credential could be reused independently if the Clash external controller is accessible through another interface, port-forwarding arrangement, local malware, or a separate network configuration. ### Attack Path 1. An attacker obtains a copy of the project, package, repository, or source archive. 2. The attacker reads the bearer secret from `skill.js:3`. 3. The attacker identifies a running Clash controller configured with the same secret. 4. The attacker reaches that controller locally or through an exposed controller interface, tunnel, proxy, or port forward. 5. The attacker submits authenticated Clash API requests using the recovered bearer secret. 6. Within the permissions offered by the Clash API, the attacker reads proxy state or modifies proxy selection and related controller-man ...[truncated 726 chars]- Remediation
View remediation
