명령어 주입 (Command Injection)
Command Injection
Last updated
Command Injection
Last updated
const { spawn } = require('child_process');
// 취약: shell: true 옵션 사용
const userInput = "someUserValue";
const p = spawn('ls', ['-lh', userInput], { shell: true });const { spawn } = require('child_process');
// 안전: shell: false(기본값)이므로 쉘 명령어 해석 불가
const userInput = "someUserValue";
const p = spawn('ls', ['-lh', userInput], { shell: false });