🇰🇷 한글 설명
PhpWeasyPrint 2.6.0 미만 버전에서 발생하며, 임시 파일 경로를 검증하지 않고 삭제하는 취약점입니다. 공격자가 임의의 경로를 배열에 삽입하면 스크립트 종료 시 해당 파일이 삭제될 수 있습니다.
💡 쉬운 설명
프로그램이 종료될 때 임시 파일을 지우는 과정에서, 지워야 할 파일이 아닌 중요한 시스템 파일을 실수로 지워버릴 수 있는 문제입니다. 공격자가 이 점을 악용해 서버의 중요한 파일을 삭제하도록 유도할 수 있습니다.
🇺🇸 원문 (English)
PhpWeasyPrint is a PHP library allowing PDF generation from a URL or an HTML page. Prior to version 2.6.0, `AbstractGenerator::$temporaryFiles` is a public array, and `removeTemporaryFiles()` — invoked from `__destruct()` and from a registered shutdown function — calls `unlink()` on every entry without verifying that the path is contained within the temporary folder. Any code holding a reference to a generator instance can push an arbitrary path into the array and have it deleted on script shutdown. This mirrors the KnpLabs/snappy issue GHSA-87qc-37cw-84h4. PhpWeasyPrint version 2.6.0 contains a patch for the issue.
📍 영향받는 시스템
PhpWeasyPrint version < 2.6.0
⚔️ 공격 벡터
생성기 인스턴스에 대한 참조를 가진 코드를 통해 임의의 파일 경로를 임시 파일 배열에 삽입
🛡️ 대응 방법
PhpWeasyPrint를 2.6.0 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 2.6.0 미만인 경우 해당 취약점에 노출된 상태입니다.
composer show phpweasyprint | grep 'versions'