T09 · Insecure Skill Coding Practices
Error
- Location
- references/config-guide.md:13
- Finding
- Unauthenticated Clash Controller and DNS Service Exposed on All Network Interfaces<![CDATA[ ## Vulnerability Details **File Location**: `references/config-guide.md`, lines 13-20 **Vulnerability Type**: Insecure network service exposure and missing controller authentication **Risk Level**: High ### Vulnerable Code ```yaml allow-lan: true mode: rule log-level: info external-controller: 0.0.0.0:9090 dns: enable: true listen: 0.0.0.0:53 ``` ### Technical Analysis The recommended configuration enables LAN access and binds both the Clash external controller and DNS service to all available network interfaces. No controller authentication secret is defined in the template. Consequently, if TCP port `9090` is reachable, a remote party may interact with the Clash management API without authentication. Depending on the installed Clash implementation and enabled API functions, an attacker may inspect runtime information, alter proxy selection or configuration, and stop or disrupt the proxy service. Binding the DNS listener to `0.0.0.0:53` also exposes it beyond the local host. If network filtering does not block the port, unauthorized clients may use the host as a DNS resolver. This creates an avoidable network-facing attack surface and may permit resolver abuse. These bindings are unnecessary for the documented local use case because the Skill advertises proxy endpoints on `127.0.0.1`. ### Attack Path 1. An operator copies the recommended configuration template and starts Clash. 2. Clash binds its external controller to every network interface on TCP port `9090` and its DNS service to every interface on port `53`. 3. An attacker with network access to the host scans for or directly connects to these ports. 4. Because the template does not configure a controller secret, the attacker submits unauthenticated API requests to the Clash controller. 5. The attacker manipulates Clash runtime behavior, proxy routing, or service state within the functionality exposed by the installed Clash version. 6. Separately, unauthorized clients may send DNS ...[truncated 985 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Use local-only defaults unless remote access is explicitly required: ```yaml allow-lan: false external-controller: 127.0.0.1:9090 secret: "<strong-random-controller-secret>" dns: enable: true listen: 127.0.0.1:53 ``` Additional hardening measures: 1. Generate a strong, unique controller secret and store it with restrictive filesystem permissions. 2. Do not include a real secret directly in public documentation or source control. 3. Restrict controller and DNS ports with host and network firewall rules. 4. If LAN proxy access is required, bind only to a trusted interface and limit access to explicitly approved source networks. 5. Run Clash under a dedicated, unprivileged service account rather than as root where feasible. 6. Document that remote controller exposure requires authentication, TLS or a secure tunnel, and explicit access-control rules. 7. Add a security warning to the configuration guide explaining the consequences of `allow-lan: true` and `0.0.0.0` bindings. ]]>
