T09 · Insecure Skill Coding Practices
- Location
skills/ops-maintenance/src/utils/network-diagnostics.ts:76- Finding
Local Command Injection Through Network Diagnostic Arguments
- Content
View full analysis
{ try { const cmd = `ping -c ${count} -W 5 ${host}` const validation = validateCommand(cmd) const { stdout } = await execAsync(cmd, { timeout: this.timeout }) const alive = !stdout.includes('100% packet loss') ``` The variable `validation` is calculated but never checked. Other methods construct similar shell commands using `host`, `server`, `maxHops`, `count`, and `port` before passing them to `execAsync`. The public wrappers pass arguments directly to these methods: ```ts export async function networkPing(host: string, count: number = 4): Promise { const diag = getNetworkDiagnostics() const result = await diag.ping(host, count) return diag.formatPingResult(result) } ``` ### Technical Analysis Node.js `child_process.exec` executes its input through a shell. The implementation concatenates externally supplied diagnostic parameters into a command string without strict syntax validation or shell escaping. Although `ping()` calls `validateCommand`, it ignores the returned `safe` value. DNS, traceroute, MTR, and port-check paths shown during the audit execute dynamically constructed commands without effective validation. A timeout limits execution duration but does not prevent command injection. The injected command runs with the same operating-system identity and privileges as the Skill process. ### Attack Path 1. An attacker or untrusted caller supplies a crafted value to a public operation such as `networkPing`, `networkDns`, `networkTraceroute`, `networkMtr`, or `networkCheckPort` ...[truncated 1295 chars]- Remediation
View remediation
