sevenz-rust2 라이브러리 경로 탐색 및 임의 파일 덮어쓰기 취약점 보안 권고 (CVE-2026-61725)
실무자 핵심 요약 (Executive Summary)
SECOPS ASSESSMENT0.21.1 미만 버전의 sevenz-rust2 라이브러리를 사용하는 Rust 기반 애플리케이션
악의적으로 조작된 7z 압축 파일 해제 시, 지정된 디렉토리를 벗어나 시스템 설정 파일 등을 덮어쓰고 원격 코드 실행(RCE) 유도 가능
sevenz-rust2 의존성을 0.21.1 이상의 최신 버전으로 즉시 업데이트
영향받는 제품 및 버전 범위
권장 패치 및 임시 완화(Workaround) 가이드
PATCH & WORKAROUND가장 효과적인 조치는 라이브러리를 최신 버전으로 업데이트하는 것입니다.
- 의존성 업데이트:
Cargo.toml 파일에서 버전을 수정하거나 아래 명령어를 실행하십시오.
cargo update -p sevenz-rust2- 임시 완화 조치 (패치 불가 시):
압축 해제 로직 호출 전, 엔트리 리스트를 순회하며 파일 이름에 .. 또는 루트 경로(/)가 포함되어 있는지 검사하는 로직을 추가하십시오.
// 예시: 경로 검증 로직
if entry.name().contains("..") || entry.name().starts_with('/') {
return Err("Invalid path in archive");
}내 GitHub/GitLab 레포지토리에 이 취약한 패키지가 숨어 있는지 30초 만에 스캔하세요
간접 의존성(Transitive Dependency)에 포함된 취약점은 수동 확인이 불가능합니다. Git 연동 한 번으로 취약 버전 탐지부터 호환성을 유지하는 최소 버전 업그레이드 PR까지 자동 생성하세요.
취약점 발생 원리 및 공격 메커니즘
해당 취약점은 sevenz-rust2의 src/util/decompress.rs 내 decompress_impl 함수에서 발생합니다. 압축 파일 내의 엔트리 이름을 처리할 때, dest.join(entry.name()) 방식을 사용하여 대상 경로를 생성하는데, 이때 엔트리 이름에 대한 정규화(Normalization)나 경로 제한 검증이 누락되었습니다. Rust의 Path::join 특성상, 엔트리 이름에 .. (상위 디렉토리 이동)가 포함되어 있으면 대상 디렉토리를 탈출할 수 있으며, 절대 경로가 포함된 경우 기존 목적지 경로를 완전히 무시하고 해당 절대 경로에 파일을 생성합니다. 이는 전형적인 'ZipSlip' 유형의 취약점으로, 공격자는 이를 통해 .ssh/authorized_keys, cron 설정, 혹은 바이너리 파일을 교체하여 시스템 권한을 탈취할 수 있습니다.
공식 보안 권고문 및 참조 링크
sevenz-rust2 is a Rust-native 7z compressor and `decompress`or. Prior to 0.21.1, extracting an attacker-supplied 7z archive can write or overwrite files outside the destination directory. In `src/util/decompress.rs`, `decompress_impl` computes each destination with `dest.join(entry.name())` without normalizing the archive's UTF-16 entry name or verifying containment, and `default_entry_extract_fn` writes to it with `File::create`. Parent-directory components escape the extraction root, and an absolute entry path makes the join discard the destination entirely. The convenience entry points `decompress`, `decompress_file`, `decompress_with_password`, and `decompress_file_with_password` all use this default path. Overwriting writable configuration, startup, cron, or build files can lead to code execution or persistence. The archive bytes are the attacker-controlled trust boundary, including for applications that automatically unpack uploaded or otherwise untrusted archives. This issue is fixed in version 0.21.1.
일간 취약점 브리핑 및 긴급 Zero-Day 경보 구독
보안 실무자와 인프라·백엔드 엔지니어를 위해 매일 아침 주요 취약점과 패치 우선순위를 요약해 발송합니다.