🇰🇷 한글 설명
Node Version Manager(nvm) 0.2.0부터 0.40.8까지 버전은 .nvmrc가 심볼릭 링크인지 검사하지 않습니다. 공격자가 .nvmrc를 다른 파일(예: ../../.npmrc, Linux의 /proc/self/environ)로 연결한 저장소를 배포하면, nvm 명령 실행 시 해당 파일의 내용이 오류 메시지나 버전 메시지에 출력되어 노출될 수 있습니다. 0.41.0 버전에서는 심볼릭 링크를 따르더라도 내용을 출력하지 않고, 유효한 버전 또는 기존 별칭일 때만 수용합니다.
💡 쉬운 설명
nvm이라는 Node.js 버전 관리 도구가 설정 파일을 잘못 읽어, 공격자가 만든 링크를 따라가서 민감한 파일 내용을 화면에 보여줄 수 있는 문제입니다. 최신 버전으로 업데이트하면 내용이 더 이상 출력되지 않습니다.
🇺🇸 원문 (English)
Node Version Manager (nvm) is a POSIX-compliant shell function for managing multiple node.js versions. In versions 0.2.0 through 0.40.8, nvm does not check whether `.nvmrc` is a symbolic link. A repository or archive that ships `.nvmrc` as a symlink to another file (for example `../../.npmrc`, or `/proc/self/environ` on Linux) makes a plain `nvm use`, `nvm install`, `nvm which`, `nvm exec`, `nvm run`, or `nvm-exec` read that file and print its contents in the invalid-`.nvmrc` message (even with `--silent`) or, for a one-line file, in the `Found ... with version <...>` message; with the README's zsh `load-nvmrc` or bash `cdnvm` hook installed, entering the directory is enough. nvm sends the content nowhere; the attacker learns it only where they can see the victim's output, such as a CI log for a contributed branch. Version 0.41.0 still follows a symlinked `.nvmrc`, so deliberate links to another version file keep working, but never prints its content, and accepts it only if it contains a version or the name of an existing alias; the README's bash `cdnvm` hook, which read `.nvmrc` itself, now gets the version from nvm, so users of that hook must also update their copy of it.
📍 영향받는 시스템
nvm 0.2.0 ~ 0.40.8 (POSIX 셸 기반 Linux/macOS 환경)
⚔️ 공격 벡터
공격자가 .nvmrc를 민감한 파일(.npmrc, /proc/self/environ 등)로의 심볼릭 링크로 만든 저장소를 제공하고, 피해자 또는 CI 로그에서 nvm 명령이 실행되어 파일 내용이 출력되도록 유도
🛡️ 대응 방법
nvm을 0.41.0 이상으로 업데이트하고, README의 bash cdnvm 훅을 사용하는 경우 해당 스크립트도 최신 버전으로 교체
🔧 검증 코드
출력된 버전이 0.41.0 이상이면 패치된 상태이고, 0.2.0~0.40.8 범위이면 취약하므로 업데이트가 필요합니다.
nvm --version 2>/dev/null || (. "$HOME/.nvm/nvm.sh" && nvm --version)