🇰🇷 한글 설명
node-tar 7.5.16 미만 버전에서 PAX 확장 헤더의 size 레코드가 중간 메타데이터 헤더에 잘못 적용되어 스트림 커서가 어긋나는 취약점이 존재합니다. 이로 인해 다른 tar 구현체와 해석 결과가 달라지는 파싱 차이(CWE-436)가 발생하여 보안 도구가 파일을 오인할 수 있습니다.
💡 쉬운 설명
압축 파일을 읽는 방식의 차이를 이용해, 보안 검사기가 보는 파일 내용과 실제 압축을 풀었을 때 나오는 파일 내용이 다르게 만드는 공격입니다. 이를 통해 악성 파일을 보안 검사기를 속이고 몰래 숨겨서 전달할 수 있습니다.
🇺🇸 원문 (English)
node-tar is a full-featured Tar for Node.js. Prior to 7.5.16, tar (node-tar) applies a PAX extended header's size= record (and other PAX overrides) to the next header entry of any type, including intermediary metadata headers such as a GNU long-name (L) or long-link (K) entry. Per POSIX pax, a PAX extended header (x) describes the next file entry, not the intermediary extension headers that may sit between the x header and the file it annotates. Because node-tar lets the PAX size override the byte length of an intervening L/K/x header, an attacker can desynchronize node-tar's stream cursor relative to every other mainstream tar implementation (GNU tar, libarchive/bsdtar, Python tarfile, and the now-fixed tar-rs / astral-tokio-tar). The result is a tar parser interpretation differential (CWE-436): a single crafted archive yields a different set of members under node-tar than under the reference tar tools. An attacker can use this to hide a member from one parser while it is visible to another, which defeats security tooling whose scanner and extractor disagree on archive contents (e.g. a malware/secret scanner that lists entries with one library while a downstream step extracts with another) This vulnerability is fixed in 7.5.16.
📍 영향받는 시스템
node-tar versions prior to 7.5.16
⚔️ 공격 벡터
조작된 PAX 확장 헤더를 포함한 tar 아카이브를 통해 파서의 데이터 해석 위치를 강제로 변경함
🛡️ 대응 방법
node-tar를 7.5.16 버전 이상으로 업데이트하십시오.
🔧 검증 코드
명령어 결과에 7.5.16 미만의 버전이 출력되면 취약한 상태이며, 아무것도 출력되지 않으면 안전합니다.
npm list tar | grep -E 'tar@([0-7]\.[0-5]\.[0-9]|<7\.5\.16)'