T09 · Insecure Skill Coding Practices
- Location
scripts/ensure_puppeteer.js:206- Finding
Shell Command Injection Through an Unescaped Browser Path
- Content
View full analysis
{ try { const browser = await puppeteer.launch({ executablePath: '${normalizedBrowserPath}', args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage(); console.log('[TEST] 正在访问 CCF 官网...'); await page.goto('https://ccf.org.cn', { timeout: 30000 }); const title = await page.title(); console.log('[SUCCESS] 验证通过!页面标题:', title); await browser.close(); process.exit(0); } catch (err) { console.error('[ERROR] 验证失败:', err.message); process.exit(1); } })();"`); return true; } ``` ### Technical Analysis The script reads `PUPPETEER_EXECUTABLE_PATH` from a project-controlled `.env` file and only verifies that the specified path exists. It does not validate the characters in the path or escape the value for the shell context into which it is inserted. The path is embedded inside a double-quoted shell argument. Shell substitutions such as `$(command)` and backtick substitutions can therefore be evaluated by a POSIX-compatible shell when a user copies and executes the displayed verification command. ...[truncated 1696 chars]- Remediation
View remediation
