Listen to this Post
The vulnerability in the HPKE-JS library’s `SenderContext Seal()` API is a race condition that occurs during concurrent execution. The `Seal()` function is responsible for encrypting messages using an AEAD (Authenticated Encryption with Associated Data) scheme. A critical requirement for AEAD security is that a nonce (number used once) is never reused with the same key. Internally, the function uses a sequence number to compute this nonce. However, the implementation lacked proper synchronization mechanisms when the `Seal()` function was called asynchronously or from multiple concurrent operations. This allows two or more simultaneous calls to `Seal()` to read the same current sequence number value before any has a chance to increment it. Consequently, the `computeNonce()` function generates the identical nonce for different messages. When this nonce is reused with the same encryption key in an AEAD like AES-GCM, it catastrophically breaks the cryptographic security guarantees, leading to the complete loss of both confidentiality and integrity for the affected messages.
Platform: HPKE-JS
Version: pre-1.0.5
Vulnerability : Nonce Reuse
Severity: Critical
date: 2024
Prediction: 2024-05-15
What Undercode Say:
npm audit grep -r "computeNonce" node_modules/@hpke/core/
const [message0, message1] = await Promise.all([ sender.seal(plaintext1), sender.seal(plaintext2) ]);
How Exploit:
Concurrent `Seal()` calls.
Protection from this CVE
Implement mutex locking.
Impact:
Complete confidentiality loss.
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

