🇰🇷 한글 설명
Go JOSE 라이브러리에서 alg 필드가 KW로 끝나는 키 래핑 알고리즘을 지정하고 encrypted_key 필드가 비어 있는 JWE 객체를 복호화하면 패닉이 발생합니다. 원인은 cipher.KeyUnwrap()에서 길이 기반 슬라이스 할당이 0 또는 음수 길이로 이루어지기 때문입니다. 4.1.4 및 3.0.5 버전에서 수정되었습니다.
💡 쉬운 설명
악의적으로 조작된 암호화 데이터를 받으면 프로그램이 비정상적으로 멈출 수 있습니다. 이로 인해 서비스가 중단되는 서비스 거부(DoS) 공격에 악용될 수 있습니다.
🇺🇸 원문 (English)
Go JOSE provides an implementation of the Javascript Object Signing and Encryption set of standards in Go, including support for JSON Web Encryption (JWE), JSON Web Signature (JWS), and JSON Web Token (JWT) standards. Prior to 4.1.4 and 3.0.5, decrypting a JSON Web Encryption (JWE) object will panic if the alg field indicates a key wrapping algorithm (one ending in KW, with the exception of A128GCMKW, A192GCMKW, and A256GCMKW) and the encrypted_key field is empty. The panic happens when cipher.KeyUnwrap() in key_wrap.go attempts to allocate a slice with a zero or negative length based on the length of the encrypted_key. This code path is reachable from ParseEncrypted() / ParseEncryptedJSON() / ParseEncryptedCompact() followed by Decrypt() on the resulting object. Note that the parse functions take a list of accepted key algorithms. If the accepted key algorithms do not include any key wrapping algorithms, parsing will fail and the application will be unaffected. This panic is also reachable by calling cipher.KeyUnwrap() directly with any ciphertext parameter less than 16 bytes long, but calling this function directly is less common. Panics can lead to denial of service. This vulnerability is fixed in 4.1.4 and 3.0.5.
📍 영향받는 시스템
go-jose 라이브러리 4.1.4 미만 및 3.0.5 미만 버전을 사용하는 Go 애플리케이션
⚔️ 공격 벡터
빈 encrypted_key 필드와 KW 계열 alg를 포함한 조작된 JWE 토큰을 전송하여 복호화 과정에서 패닉을 유발
🛡️ 대응 방법
go-jose를 4.1.4 이상 또는 3.0.5 이상으로 업데이트
🔧 검증 코드
출력된 버전이 v4.1.4 이상 또는 v3.0.5 이상이면 안전하며, 그보다 낮으면 취약합니다.
go list -m all 2>/dev/null | grep 'go-jose'