The Shortest Path to Failure: Trivial Authentication Bypass in OpenMLS
Feb 4, 2026·6 min read·1 visit
Executive Summary (TL;DR)
A critical flaw in the `openmls` library allowed attackers to bypass cryptographic verification by providing truncated or empty authentication tags. The issue stemmed from Rust's `.zip()` iterator, which silently stops comparing when the shortest input is exhausted. Fixed in v0.7.2.
In the world of cryptographic implementation, 'constant-time' comparison is the gold standard for preventing side-channel attacks. Developers bend over backward to ensure that checking a signature takes exactly the same amount of time, regardless of whether it's correct or not. But in a cruel twist of irony, the developers of `openmls`—a Rust implementation of the Messaging Layer Security (MLS) protocol—focused so hard on the timing that they forgot the length. Due to a quirk in how Rust's iterators handle zipping, the library's equality check would happily accept an empty byte array as a valid cryptographic tag. This allowed attackers to bypass message authentication entirely by simply providing... nothing.
The Hook: When Silence is Accepted
Messaging Layer Security (MLS) is the designated successor to the Double Ratchet protocol (used by Signal, WhatsApp, etc.), designed to bring end-to-end encryption to large groups efficiently. It is complex, math-heavy, and relies entirely on strict cryptographic verification. openmls is a prominent Rust implementation of this standard.
The core of any such system is the ability to verify that a message actually came from who it says it did. This is done via Message Authentication Codes (MACs) or confirmation tags. When a message arrives, the system calculates what the tag should be and compares it to what was received.
Usually, we worry about timing attacks here—where an attacker measures how long the comparison takes to guess the secret key byte-by-byte. The openmls team knew this. They wrote a equal_ct (constant-time equality) function to prevent it. Unfortunately, in their pursuit of side-channel safety, they opened a massive logical door: they stopped checking if the provided tag was actually the right size.
The Flaw: The Perils of Zipping
The vulnerability lies in a fundamental behavior of Rust's iterator system, specifically the .zip() method. In many languages, if you try to zip two arrays of different lengths, you might get an error or an exception. In Rust, .zip() is designed to be safe and lazy: it creates an iterator that yields pairs of elements until either of the two underlying iterators is exhausted.
This behavior is documented, standard, and usually desirable—except when you are comparing cryptographic secrets. The vulnerable function, equal_ct, took two byte slices (a and b) and zipped them together to check for differences.
If the attacker controls a (the input tag) and the system controls b (the expected secret tag), the attacker can simply provide an empty slice []. The .zip() iterator sees that a is empty and immediately stops. The loop body never executes. The difference accumulator variable, initialized to 0, remains 0. The function returns true. It's the cryptographic equivalent of a bouncer stepping aside because you didn't hand him an ID card to check.
The Code: The Smoking Gun
Let's look at the code that caused the issue. It's elegant, idiomatic Rust, and completely insecure.
The Vulnerable Code:
fn equal_ct(a: &[u8], b: &[u8]) -> bool {
let mut diff = 0u8;
// CRITICAL: .zip() stops at the shortest iterator
for (l, r) in a.iter().zip(b.iter()) {
diff |= l ^ r;
}
diff == 0
}If a is empty, the loop runs 0 times. diff stays 0. 0 == 0 is true. Access granted.
The Fix:
The patch is painfully simple. Before doing the fancy constant-time loop, you must assert that the two things being compared are actually the same size. Since the length of a MAC is usually public knowledge (defined by the cipher suite), this check doesn't leak sensitive data.
fn equal_ct(a: &[u8], b: &[u8]) -> bool {
// The Fix: Explicitly check lengths first
if a.len() != b.len() {
log::error!("Incompatible values");
return false;
}
let mut diff = 0u8;
for (l, r) in a.iter().zip(b.iter()) {
diff |= l ^ r;
}
diff == 0
}This addition ensures the loop always processes the full expected length of bytes, preventing the truncation attack.
The Exploit: The 'Null' Key
Exploiting this does not require a supercomputer or advanced math. It requires a debugger and the audacity to send nothing.
Scenario: You are an attacker sitting on the network (MITM) or a malicious member of a group. You want to inject a fake Commit message into the MLS group, which normally requires a valid ConfirmationTag.
- Craft the Payload: Create a valid MLS
Commitmessage structure with your malicious content. - Neutering the Tag: When the protocol asks for the
ConfirmationTag(usually 32 bytes of high-entropy randomness), you provide a 0-byte array (or just an empty vector). - Transmission: Send the packet to the victim client.
- Verification: The victim's
openmlsclient receives the message. It calculates what the tag should be (e.g.,0xDEADBEEF...). - The Bypass: It calls
equal_ct(received_tag, expected_tag). Sincereceived_tagis empty, the check passes instantly. - Success: The client accepts your malicious commit, potentially rotating keys or adding compromised members to the group.
Alternatively, you could brute-force the first byte. If you send a 1-byte tag, you have a 1 in 256 chance of matching the first byte of the real tag. But why gamble when sending nothing wins 100% of the time?
The Impact: Trust No One
This is a catastrophe for a cryptographic library. The entire premise of MLS is that membership changes and message streams are cryptographically secured. By bypassing the equal_ct check, an attacker effectively disables authentication.
In a real-world scenario, this could allow:
- Message Forgery: Injecting messages that appear to come from trusted group members.
- Group Takeover: Forging
AddorRemoveproposals to kick out legitimate users or add attacker-controlled ghost users. - Denial of Service: corrupting the group state such that legitimate members can no longer decrypt messages.
This vulnerability is a stark reminder that "memory safety" (which Rust provides) does not equal "logic safety". The memory was never corrupted; the logic was simply flawed.
The Fix: Upgrade or Die
The fix was released in openmls v0.7.2. If you are using an older version, your application is wide open.
Remediation Steps:
- Open your
Cargo.toml. - Check the
openmlsversion. - Run
cargo update -p openmlsto pull the latest version. - Verify in
Cargo.lockthat you are on at least0.7.2.
If you cannot upgrade immediately, you must implement a wrapper around calls to openmls that explicitly validates the length of incoming tags before passing them to the library, though this is risky and difficult to cover 100% of code paths.
Official Patches
Fix Analysis (1)
Technical Appendix
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HAffected Systems
Affected Versions Detail
| Product | Affected Versions | Fixed Version |
|---|---|---|
openmls OpenMLS | < 0.7.2 | 0.7.2 |
| Attribute | Detail |
|---|---|
| CWE | CWE-1254 (Incorrect Comparison) |
| Attack Vector | Network |
| CVSS | 9.8 (Critical) |
| Impact | Authentication Bypass |
| Language | Rust |
| Fix Commit | 91ec049ffc2fa3766110223aa2aabe0303837af8 |
MITRE ATT&CK Mapping
Vulnerability Timeline
Subscribe to updates
Get the latest CVE analysis reports delivered to your inbox.