T09 · Insecure Skill Coding Practices
- Location
src/tools.mjs:532- Finding
Model-Controlled Commands Are Executed Through an Unrestricted System Shell
- Content
View full analysis
{ const rawCommand = String(params.command || ""); const command = rawCommand .replace(/<\/?tool_call>/gi, " ") .replace(/<\/?function_call>/gi, " ") .replace(/<\/?tool>/gi, " ") .replace(/<\/?function>/gi, " ") .replace(/[{}]+$/g, "") .trim(); if (!command) { throw new Error("Command failed: empty command after sanitization"); } try { const stdout = execSync(command, { encoding: "utf-8", timeout: 30_000, maxBuffer: 1024 * 1024, cwd, }); return { content: [{ type: "text", text: stdout || "(no output)" }], details: { command, rawCommand }, }; } catch (err) { const msg = err.stderr || err.stdout || err.message; throw new Error(`Command failed: ${msg}`); } }, }; } ``` ### Technical Analysis The scanner exposes a general-purpose shell t ...[truncated 2592 chars]- Remediation
View remediation
