🇰🇷 한글 설명
vm2의 nesting: true 설정에서 샌드박스 코드가 외부 VM의 require 제한을 우회하여 vm2 모듈을 직접 로드할 수 있는 취약점입니다. 공격자는 이를 통해 새로운 NodeVM을 생성하고 임의의 OS 명령을 실행하여 호스트를 완전히 손상시킬 수 있습니다. 3.11.1 이상으로 업그레이드하면 해결됩니다.
💡 쉬운 설명
Node.js 샌드박스인 vm2가 중첩 기능 사용 시 보안 제한을 우회할 수 있는 구멍이 있습니다. 이 구멍을 이용하면 악의적인 코드가 서버에서 자유롭게 명령을 실행할 수 있습니다.
🇺🇸 원문 (English)
vm2 is an open source vm/sandbox for Node.js. Prior to 3.11.1, when a NodeVM is created with nesting: true, sandbox code can unconditionally require('vm2') regardless of the outer VM's require configuration — including require: false. With access to vm2, the sandbox constructs a new inner NodeVM with its own unrestricted require settings and executes arbitrary OS commands on the host. Any application that runs untrusted code inside a NodeVM with nesting: true is fully compromised. This vulnerability is fixed in 3.11.1.
📍 영향받는 시스템
vm2 < 3.11.1 (nesting: true 설정 사용 시)
⚔️ 공격 벡터
NodeVM 내 샌드박스 코드에서 require('vm2')를 호출하여 새로운 NodeVM을 생성하고 unrestricted 설정으로 임의의 OS 명령 실행
🛡️ 대응 방법
vm2를 3.11.1 이상으로 즉시 업그레이드하거나 nesting: true 설정 제거
🔧 검증 코드
VULNERABLE이 출력되면 vm2 3.11.1 미만이 설치된 상태로 즉시 업그레이드 필요, SAFE가 출력되면 안전한 버전입니다.
npm ls vm2 2>/dev/null | grep -E 'vm2@([0-2]\.|3\.(0|1[01])\.)' && echo 'VULNERABLE' || echo 'SAFE'