T09 · Insecure Skill Coding Practices
- Location
scripts/wizard.js:21- Finding
Unauthenticated Wizard Endpoint Allows Arbitrary Configuration Overwrite and Resource Exhaustion
- Content
View full analysis
body += chunk); req.on('end', () => { // Ensure directory exists const configDir = path.dirname(CONFIG_FILE); if (!fs.existsSync(configDir)) { fs.mkdirSync(configDir, { recursive: true }); } fs.writeFileSync(CONFIG_FILE, body); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ success: true })); console.log('\n✓ Configuration saved to:', CONFIG_FILE); setTimeout(() => process.exit(0), 500); }); } ``` The server is started without an explicit loopback address: ```js server.listen(currentPort); ``` ### Technical Analysis The `/api/save-config` endpoint accepts POST requests without authentication, a per-run nonce, origin verification, CSRF protection, or content-type enforcement. It writes the complete request body directly to `data/.wizard-config.json` without parsing or validating it against the expected configuration schema. The request body is accumulated in memory without a maximum size: ```js req.on('data', chunk => body += chunk); ``` An attacker can therefore submit malformed or attacker-controlled configuration data or continuously send a large request body to consume process memory. Because `server.listen(currentPort)` does not specify `127.0.0.1`, Node.js may listen on an unspecified address covering available network interfaces, depending on the operating system. The resulting file is relevant to the Agent workflow because `SKILL.md` instructs subsequent operations to follow the configuration saved in `.wizard-config.json`. Although this is not demonstrated to provid ...[truncated 1734 chars]- Remediation
View remediation
