🔍 CVE-2017-9047

7.5
CVSS Score
HIGH
2017-05-18
2026-10-14 07:16
✅ 완료

🇰🇷 한글 설명

libxml2의 xmlSnprintfElementContent 함수가 버퍼 길이를 정확히 추적하지 못하여 할당된 메모리를 초과하여 쓸 수 있습니다. 콘텐츠 prefix 추가 후 업데이트되지 않은 len 변수로 name 쓰기 가능성을 검사하여 최대 'size' 바이트까지 메모리 경계를 벗어나 데이터를 기록합니다.

💡 쉬운 설명

libxml2 라이브러리의 메모리 크기 계산 오류로 할당받은 메모리를 초과하여 데이터를 쓸 수 있습니다. 이를 악용하면 libxml2를 사용하는 PHP, 웹 서버 등의 프로그램이 비정상 종료됩니다.

🇺🇸 원문 (English)

A buffer overflow was discovered in libxml2 20904-GITv2.9.4-16-g0741801. The function xmlSnprintfElementContent in valid.c is supposed to recursively dump the element content definition into a char buffer 'buf' of size 'size'. The variable len is assigned strlen(buf). If the content->type is XML_ELEMENT_CONTENT_ELEMENT, then (i) the content->prefix is appended to buf (if it actually fits) whereupon (ii) content->name is written to the buffer. However, the check for whether the content->name actually fits also uses 'len' rather than the updated buffer length strlen(buf). This allows us to write about "size" many bytes beyond the allocated memory. This vulnerability causes programs that use libxml2, such as PHP, to crash.

📍 영향받는 시스템

libxml2 2.9.4 이전 버전 (GIT v2.9.4-16-g0741801 포함)

⚔️ 공격 벡터

특수 구조의 XML 문서를 libxml2 기반 애플리케이션에 전송하여 xmlSnprintfElementContent 함수의 버퍼 오버플로우 트리거

🛡️ 대응 방법

libxml2를 패치된 버전(2.9.5 이상)으로 업데이트 또는 배포판의 보안 패치 적용

🔧 검증 코드

출력된 버전이 2.9.4 이전이면 취약, 2.9.5 이상(또는 배포판의 패치버전)이면 수정됨

Shell / Script
dpkg -l libxml2 2>/dev/null | grep -E 'ii' | awk '{print $3}' || rpm -q libxml2 2>/dev/null

📊 CVSS Vector String

CVSS Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

💻 영향받는 소프트웨어

PHP