🇰🇷 한글 설명
PyJWT 라이브러리의 detached JWS 토큰 검증 시 unencoded-payload 옵션 사용 시, Base64URL 디코딩 단계에서 서명 검증 전에 임의의 크기 페이로드를 처리하도록 강제되는 취약점입니다. 인증되지 않은 원격 공격자가 대량 데이터를 전송하여 CPU 및 메모리 자원을 소비시키는 DoS 공격이 가능합니다.
💡 쉬운 설명
PyJWT 라이브러리가 위조된 토큰을 받으면 검증 전에 먼저 큰 데이터를 처리하려고 시도하여 서버 자원을 낭비합니다. 이를 악용하면 인증 없이 웹 서버를 마비시킬 수 있습니다.
🇺🇸 원문 (English)
PyJWT is a JSON Web Token implementation in Python. From 2.8.0 to 2.12.1, when verifying detached JWS tokens using the unencoded-payload option ("b64": false, RFC 7797), PyJWT performs Base64URL decoding of the compact-serialization payload segment before enforcing the detached-payload rules. For b64=false, PyJWT later discards that decoded payload and replaces it with the caller-provided detached_payload. In practice, this turns the middle segment into an attacker-controlled “work amplifier”: a remote client can supply an arbitrarily large Base64URL payload segment that forces CPU work + memory allocations even if the signature is invalid. This creates an unauthenticated DoS vector against any endpoint that verifies detached JWS using PyJWT. This vulnerability is fixed in 2.13.0.
📍 영향받는 시스템
PyJWT 2.8.0 ~ 2.12.1 (2.13.0 이상에서 패치됨)
⚔️ 공격 벡터
detached-payload 검증을 사용하는 엔드포인트에 초대형 Base64URL 페이로드를 포함한 JWS 토큰 송신
🛡️ 대응 방법
PyJWT 패키지를 2.13.0 이상으로 업그레이드 (pip install --upgrade pyjwt)
🔧 검증 코드
출력이 'vulnerable'이면 패치 필요, 'patched'이면 안전, pip 미설치면 pip show 결과의 Version이 2.13.0 이상인지 확인
python -c "import jwt; print('vulnerable' if tuple(map(int, jwt.__version__.split('.'))) < (2, 13, 0) else 'patched')" 2>/dev/null || pip show pyjwt | grep Version