beChat has not had an independent audit. This post does not change that, and we do not want it read as a substitute. People who test their own code share their own blind spots. What we can do is attack the app the way an auditor would start, write down every result, and fix what we find. Several things did break.
We attacked our own app before anyone else could. We fed it hundreds of millions of broken messages, checked the protocol's design with a proof tool, and pretended to be a malicious server. The attacks found real problems, including four weaknesses in the protocol design. All of them are fixed in beChat 0.8.3.
Fuzzing: 265 million bad inputs
A fuzzer generates inputs, watches which code paths each one reaches, and mutates the ones that get further. We pointed libFuzzer at every place where beChat parses something an attacker controls: the ratchet message envelope, the sealed-sender frame, prekey bundles, raw ML-KEM and ML-DSA bytes, the wrapped database key, the key slot store. The first campaign on those six targets ran about 190 million inputs without a crash.
A parser that does not crash can still accept something it should refuse, so the second round checked behaviour as well. Each of the new targets starts from a saved snapshot of a real conversation and mutates genuine messages, so the inputs get past the first layer of checks. After every input the target asserts something about the result:
- a session start that gets accepted never changes how the first message decrypts;
- a key rotation is accepted only for the contact's genuine new key, and a refused one leaves the stored key untouched;
- after any control message a contact can send (group commits and invitations, key packages, resync and resend requests), the next genuine group message still decrypts to the right text;
- an altered attachment never decrypts to different bytes.
Eleven targets ran about 265 million inputs before that work merged, 45 minutes of it on the snapshot-based ones. No crash, no broken assertion. A fuzzer is only as good as the rules it checks, and those rules are ours, so this result tells you what we thought to ask.
Test vectors: one signature, two answers
Wycheproof is Google's collection of tricky test cases for cryptographic libraries. We ran the AES-GCM-SIV, X25519, Ed25519 and ML-DSA-87 sets, plus NIST-derived ML-KEM-768 and ML-KEM-1024 vectors, through beChat's own wrappers rather than the libraries directly.
On a desktop PC, the ML-DSA suite accepted 49 signatures that it should have rejected. The same vectors failed correctly on Android. The optimized AVX2 code that x86 processors use skipped a range check that the FIPS 204 standard requires and the reference code performs. The signatures could not be turned into a forgery, but a signature that verifies on one CPU and not on another is a bug. beChat now builds ML-DSA without the AVX2 path. ML-DSA only runs while a session is set up, so the lost speed does not matter.
Property tests: what the protocol promises
A second set of tests states the protocol's promises directly and tries to break each one: old messages stay secret after a key leaks, a conversation recovers after a leak, replays and edits are rejected, and a message signed by the wrong identity key is refused. A randomized test drives two ratchets through a network that drops, reorders, repeats and corrupts messages, and checks that nothing is forged and nothing is accepted twice.
Two of these tests found problems. Messages that arrived out of order across a ratchet step failed to decrypt. beChat resets a session after three failed messages, so a network that reordered traffic could force a reset. That is fixed. The second problem was a downgrade. The protocol version in a contact's key bundle is not signed by the contact, and a reset rebuilds the session from whatever bundle the server hands out. A malicious server could lower that number and get a v9 session rebuilt at v6, without the post-quantum ratchet. beChat now remembers, per contact, the highest version that contact has proven it runs, and refuses anything below it.
ProVerif: checking the design
ProVerif is a tool that proves properties of a protocol against an attacker who controls the whole network. For beChat that includes the server. We modelled the session setup (X3DH with the post-quantum PQXDH extension), sealed sender and the v9 Double Ratchet, then ran each model under extra assumptions: the attacker steals long-term keys, steals the current prekeys, or breaks X25519 and Ed25519 with a quantum computer.
A proof tool can report "proved" because the model is too weak to ever find an attack. To catch that, each model has broken versions: one with the device signature removed, one without the ML-DSA identity signature, one without the post-quantum ratchet. The tool has to find an attack on each, and it does. One of these checks failed at first. The simulated state leak left out a public key, and the version without the post-quantum ratchet came back as "secure". With the full state leaked, the attack appears.
What the models prove:
- The first message of a session stays secret, the person who receives it knows who sent it, a stolen key of the receiver does not let anyone impersonate the sender to them, and the message stays secret even if every long-term key leaks later.
- The first message stays secret against a quantum attacker.
- From v7 on, a conversation recovers from a full state leak even against a quantum attacker. At v6 and below it does not, which is why the version downgrade above mattered.
- Someone who steals the server's certificate key still cannot make your phone believe a sealed message came from one of your contacts, because the phone checks the sender against the identity key it already has.
The models check the design, not the code. They treat the encryption algorithms as perfect, and nobody outside the team has reviewed them.
Marlene, the server we do not trust
Marlene is a proxy that sits between two test accounts and our staging server and does what a compromised server could do: replay messages, change bytes, reorder or drop messages, deliver a message to the wrong person, swap the identity keys in a key bundle, and lower the advertised protocol version. It refuses to connect to anything except staging. A script runs one attack end to end and a second one reports what the attacker got: messages delivered, forged, duplicated, or read.
- TLS. A release build refuses Marlene's certificate before it sends a single byte. Certificate pinning works.
- Replay, tampering, swapped keys. No forgery, no duplicate message, no plaintext.
- Downgrade on first contact. This one worked. Rewriting the version from 9 to 5 in a key bundle made two up-to-date phones agree on a v5 session. The per-contact floor did not help, because two people who have never talked have no floor yet. Every beChat release since 0.4.93 speaks v9, so every new session now requires v9, on both sides.
- Replay, second look. Nothing was forged, but replayed old messages failed to decrypt and counted as failures, so three replays could make the phones throw away a healthy session. A malicious server could force re-keys whenever it liked. beChat now keeps a 12-byte fingerprint of the last 512 messages it decrypted from each contact and treats an identical message as a duplicate before touching any state.
Closing the four design weaknesses
The ProVerif work found four weaknesses in the protocol design. None could be used to read a message, and two of them needed a quantum computer. beChat 0.8.3 closes all four, and we ran the models again to check.
- Session setup was authenticated with Ed25519 only. A future quantum computer that can forge Ed25519 could have opened a session with you while pretending to be one of your contacts. The first message of a session now also carries an ML-DSA signature over everything the session is built from, including who it is for. In the model, Bob now always knows the first message came from Alice. Remove the new check and ProVerif finds the old attack again.
- The outer sealed-sender layer used X25519 only. Someone who recorded traffic and later got a quantum computer could have learned who sent each recorded message. The outer layer now combines X25519 with ML-KEM-768, which adds about 1 KB to each message, and the model proves the sender stays hidden even from that attacker.
- The sender's signature did not name the recipient. A contact who received your sealed message could re-send it to someone else, labelled as from you, and each copy counted as a failed message on that chat. The signature now names the recipient, and each message also carries a code computed with a key only you and that contact share, which travelled inside your post-quantum session. A re-sent copy fails both checks and no longer counts against the chat.
- An old session-start message could be replayed while its prekey was still in use. beChat now remembers the last 256 session starts from each contact, so none of them is accepted twice.
These protections apply between two people who both run 0.8.3 or later. A newer app keeps talking to an older one in the previous format until the older one updates.
Sealed sender has one more limit that is not a bug: the server knows which account submits each message. The security model says so, and sealed sender only keeps the sender out of stored message records.
Not a one-off
The fuzz targets, test vectors, property tests, attack scenarios and ProVerif models all live in the beChat repository next to the code they test. We run them again whenever the crypto code changes, and every fix in this post came with a test that fails without it. When a model or test finds something new, it gets fixed the same way.
The biggest missing piece is still an independent audit.
Frequently asked questions
Has beChat been independently audited?
No. Everything in this post was done by the beChat team. An outside audit is still planned, and none of this replaces it: people who test their own code share their own blind spots.
Is the beChat protocol formally verified?
Partly, and only at the design level. ProVerif models of the session setup, sealed sender and the v9 ratchet prove secrecy, authentication and recovery properties against an attacker who controls the network and the server. They also found four weaknesses in the design, all fixed in beChat 0.8.3. The models check the design, not the Rust code, and nobody outside the team has reviewed them yet.
Did the testing find real bugs?
Yes. A server could push a new session down to an old protocol version, replayed messages could make a chat throw away a healthy session, messages that arrived out of order could force a reset, and ML-DSA signatures were checked differently on desktop and Android CPUs. All of these are fixed in the current release.
Keep reading
The security model lists every mechanism these tests attack, and the post-quantum guide explains what the v9 protocol adds. For how beChat compares with Signal, which is formally verified and independently audited, see Signal vs beChat. beChat is free on Android.