🇰🇷 한글 설명
DiceBear 아바타 라이브러리의 @dicebear/converter 패키지에서 SVG 크기 제한을 우회할 수 있는 취약점이 발견되었습니다. 공격자가 조작된 SVG를 입력하면 정규식 기반의 크기 제한 로직이 무력화되어, @resvg/resvg-js 렌더링 과정에서 과도한 메모리를 사용하여 서비스 거부(DoS)를 유발할 수 있습니다.
💡 쉬운 설명
이미지 크기를 제한하는 규칙을 속이는 특수한 파일을 보내서 컴퓨터의 메모리를 가득 채우게 만드는 공격입니다. 이로 인해 서버가 멈추거나 다운될 수 있습니다.
🇺🇸 원문 (English)
DiceBear is an avatar library for designers and developers. Prior to version 9.4.2, the `ensureSize()` function in `@dicebear/converter` used a regex-based approach to rewrite SVG `width`/`height` attributes, capping them at 2048px to prevent denial of service. This size capping could be bypassed by crafting SVG input that causes the regex to match a non-functional occurrence of `<svg` before the actual SVG root element. When the SVG is subsequently rendered via `@resvg/resvg-js` on the Node.js code path, it renders at the attacker-specified dimensions, potentially causing out-of-memory crashes. In version 9.4.2, the regex-based approach has been replaced with XML-aware processing using `fast-xml-parser` to correctly identify and modify the SVG root element's attributes. Additionally, a `fitTo` constraint has been added to the `renderAsync` call as defense-in-depth, ensuring the rendered output is always bounded regardless of SVG content.
📍 영향받는 시스템
@dicebear/converter 9.4.2 미만 버전
⚔️ 공격 벡터
정규식 매칭을 우회하도록 설계된 조작된 SVG 파일을 입력하여 렌더링 시 대규모 메모리 할당 유도
🛡️ 대응 방법
@dicebear/converter 패키지를 9.4.2 이상 버전으로 업데이트
🔧 검증 코드
출력된 버전 번호가 9.4.2 미만인지 확인하여 취약 여부를 판단합니다.
npm list @dicebear/converter | grep @dicebear/converter