JWTKitに認証なしでサービス停止に陥る脆弱性、5.8.0で修正
概要
JWTKitには、悪意のあるJWTヘッダーを解析させると、署名を検証する前にアプリケーションがクラッシュする脆弱性があります。認証が不要なため、外部から遠隔で攻撃される可能性があります。5.8.0より前のバージョンを使っている場合は、5.8.0に更新してください。
AI要約
SecPulse が外部の生成 AI を使って作った要約です。誤りを含むことがあります。重要な判断の前に、下の原文と参照URLを確認してください。
JWTKitには、悪意のあるJWTヘッダーを解析させると、署名を検証する前にアプリケーションがクラッシュする脆弱性があります。認証が不要なため、外部から遠隔で攻撃される可能性があります。5.8.0より前のバージョンを使っている場合は、5.8.0に更新してください。
影響パッケージ
| パッケージ | 影響を受ける版 → 修正版 | |
|---|---|---|
| vaporjwt-kit | — | 記載なし |
| SwiftURLgithub.com/vapor/jwt-kit |
5.8.0 未満→ 5.8.0 |
5.8.0 |
| swiftgithub.com/vapor/jwt-kit |
5.8.0 未満→ 5.8.0 |
5.8.0 |
原文の説明 取得元が公開している説明をそのまま載せています (多くは英語)。
Summary
JWTKit can crash while parsing a JWT header containing an extremely large integer value.
When decoding header fields, the library parses JSON numbers as Double and converts integral values to Int without checking whether the value fits into the valid Int range. A header containing a value such as 1e300 causes a Swift runtime trap.
Because JWT headers are parsed before signature verification, an attacker can crash the application by sending a specially crafted JWT without requiring a valid signature.
Details
JWTKeyCollection.verify() parses the JWT header before selecting a signer and verifying the token signature.
The header is decoded by JWTParser.parseHeader(), which deserializes the JSON into JWTHeader. During this process, JWTHeaderField.init(from:) decodes JSON numbers as Double and converts integral values to Int without validating that they fit within the representable Int range:
let doubleValue = try container.decode(Double.self)
if doubleValue.truncatingRemainder(dividingBy: 1) == 0 {
self = .int(Int(doubleValue))
}
An attacker can supply an extremely large integral value (for example, 1e300), causing the Int(doubleValue) conversion to trigger a Swift runtime trap. Because this occurs while parsing the JWT header, the application crashes before signature verification.
Affected code:
- Sources/JWTKit/JWTKeyCollection.swift (verify() - parseHeader())
- Sources/JWTKit/JWTParser.swift (parseHeader())
- Sources/JWTKit/JWTHeaderFie…
出典: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
参照URL
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com