🇰🇷 한글 설명
PhpWeasyPrint 2.6.0 미만 버전에서 attachment 옵션에 URL 스킴을 제한하지 않아 발생하는 취약점입니다. 공격자가 조작된 URL을 입력할 경우 서버 측 요청 위조(SSRF) 및 로컬 파일 노출(LFD)이 가능하며, 탈취된 데이터는 PDF 첨부 파일 형태로 유출될 수 있습니다.
💡 쉬운 설명
PDF를 만드는 프로그램이 사용자가 입력한 주소를 검사할 때 보안 규칙이 부족하여 발생합니다. 이를 통해 해커가 서버 내부의 비밀 파일이나 다른 시스템의 정보를 몰래 가져올 수 있습니다.
🇺🇸 원문 (English)
PhpWeasyPrint is a PHP library allowing PDF generation from a URL or an HTML page. Prior to version 2.6.0, `pontedilana/php-weasyprint` fetches the content of option values server-side via `file_get_contents()` when the value looks like a URL, without restricting the URL scheme. The `attachment` option of `Pdf` is the reachable sink: any value that passes `isOptionUrl()` (`filter_var(..., FILTER_VALIDATE_URL)`) is downloaded by the PHP process and embedded into the generated PDF. Because `FILTER_VALIDATE_URL` accepts `http`, `https`, `ftp`, `file` and PHP stream wrappers such as `php://`, an attacker who can influence the `attachment` value reaches both a **Server-Side Request Forgery** primitive (e.g. internal HTTP endpoints, cloud metadata) and a local file disclosure primitive (`file://`, `php://filter/...`), with the fetched bytes exfiltrated as a PDF attachment. This is the same class of issue KnpLabs/snappy patched for its `xsl-style-sheet` option in GHSA-c5fp-p67m-gq56. The library is documented as a one-to-one substitute for KnpLabs/snappy and shares the same code shape. PhpWeasyPrint version 2.6.0 contains a patch for the issue.
📍 영향받는 시스템
PhpWeasyPrint version < 2.6.0
⚔️ 공격 벡터
attachment 옵션에 file:// 또는 php://와 같은 특수 스킴을 포함한 URL을 입력하여 서버 내부 자원에 접근
🛡️ 대응 방법
PhpWeasyPrint를 최신 버전인 2.6.0 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 2.6.0 미만이면 취약한 상태이며, 2.6.0 이상이면 안전합니다.
composer show pontedilana/php-weasyprint 2>/dev/null | grep -E 'versions'