🇰🇷 한글 설명
Hono 웹 프레임워크의 4.12.0부터 4.12.33 버전에서 languageDetector 미들웨어가 하이픈으로 구분된 다수의 서브태그를 포함한 악성 언어 태그를 처리할 때 알고리즘 복잡도 기반 서비스 거부(DoS) 취약점이 존재합니다. normalizeLanguage() 함수가 가능한 모든 접두사마다 문자열 처리를 반복하여 처리량이 서브태그 수의 제곱에 비례해 증가합니다. 이 취약점은 쿼리 파라미터, 쿠키, Accept-Language 헤더 등을 통해 인증 없이 공격될 수 있습니다.
💡 쉬운 설명
웹 서버가 언어 설정을 처리할 때 아주 긴 특수 문자열을 받으면 과도하게 계산을 하게 되어 서버가 느려집니다. 공격자가 이런 요청을 반복해서 보내면 다른 정상 사용자의 요청도 처리되지 못하게 됩니다.
🇺🇸 원문 (English)
Hono is a Web application framework that provides support for any JavaScript runtime. From 4.12.0 to 4.12.33, the languageDetector middleware is vulnerable to algorithmic complexity denial of service when processing a crafted language tag containing a large number of hyphen separated subtags. To implement progressive language tag truncation, normalizeLanguage() repeatedly calls parts.slice(0, i).join('-') for every possible prefix, so the total amount of string processing grows quadratically with the number of subtags. Language values may come from a query parameter, cookie, Accept-Language header, or URL path, depending on the detector configuration, and the default detector order enables query string, cookie, and header detection, so applications using languageDetector() may expose this processing to unauthenticated requests. An attacker may repeatedly send requests containing long, hyphen separated language tags, causing excessive CPU consumption and preventing unrelated requests from being processed. This issue is fixed in version 4.12.34.
📍 영향받는 시스템
Hono 4.12.0 이상 4.12.33 이하 버전에서 languageDetector 미들웨어를 사용하는 애플리케이션
⚔️ 공격 벡터
쿼리 파라미터, 쿠키, Accept-Language 헤더 등에 하이픈으로 구분된 매우 긴 언어 태그를 담아 인증 없이 반복 전송
🛡️ 대응 방법
Hono를 4.12.34 이상 버전으로 업그레이드하거나 languageDetector 입력 길이를 제한하는 검증 로직을 추가
🔧 검증 코드
출력에 [email protected]부터 [email protected] 사이의 버전이 표시되면 취약하며, 아무것도 출력되지 않으면 해당 범위에 속하지 않습니다.
npm ls hono 2>/dev/null | grep -E 'hono@4\.12\.([0-9]|[12][0-9]|3[0-3])\b'