🇰🇷 한글 설명
nvm(Node Version Manager) 0.40.4 이하 버전에서 설정된 미러 서버의 버전 문자열을 적절히 검증하지 않아 발생하는 명령 주입 취약점입니다. 공격자가 제어하는 미러 서버를 통해 악성 명령이 포함된 버전 정보를 제공할 경우, nvm 실행 시 로컬 쉘이나 awk를 통해 임의의 명령이 실행될 수 있습니다.
💡 쉬운 설명
Node.js 버전을 관리하는 프로그램이 외부 서버에서 가져온 버전 이름을 그대로 컴퓨터 명령어로 실행해버리는 보안 결함입니다. 가짜 서버를 이용해 나쁜 명령어를 섞어 보내면 사용자의 컴퓨터가 해킹될 수 있습니다.
🇺🇸 원문 (English)
nvm (Node Version Manager) through 0.40.4 executes arbitrary commands from version strings supplied by the configured Node.js/io.js mirror. Commands such as `nvm install` read the available versions from the mirror's index.tab and use the selected version, without sanitization, to build download URLs and shell/awk commands. Two sinks are affected by the same untrusted input: nvm_download() built a curl/wget command string and ran it with `eval`, so a version field containing command substitution (for example $(id)) was executed by the local shell; and nvm_get_checksum() interpolated the version-derived download slug into an awk program, so a crafted version could execute arbitrary commands via awk's system(). An attacker who controls the configured mirror, supplies mirror content to a user or CI on a non-default mirror, or machine-in-the-middles a non-TLS mirror can ∴ run arbitrary commands with the privileges of the user running nvm. The default mirror (https://nodejs.org over TLS) is not affected. Fixed on master (pending the next tagged release) by passing every argument as a literal argv element instead of using eval, by passing the value to awk as data via -v instead of interpolating it into the program, and by rejecting any version outside the Node.js/io.js version grammar before it is used.
📍 영향받는 시스템
nvm (Node Version Manager) 0.40.4 이하 버전
⚔️ 공격 벡터
신뢰할 수 없는 미러 서버를 사용하거나 MITM 공격을 통해 조작된 버전 정보를 제공하여 명령 주입 수행
🛡️ 대응 방법
nvm을 최신 버전(master 브랜치 반영 버전)으로 업데이트하거나 기본 TLS 미러(https://nodejs.org)만 사용
🔧 검증 코드
출력 결과가 VULNERABLE이면 취약한 버전이며, SAFE이면 안전한 버전입니다.
nvm --version | awk '{if ($1 <= 0.40.4) print "VULNERABLE"; else print "SAFE"}'