Choro is Free
A security analysis of msg gov, the encrypted messaging app of the Brazilian federal government, and the first public description of its State stream cipher, Choro-02.
Summary
msg gov is a modified version of the open-source Element (Matrix) messenger, distributed to Brazilian federal public servants. It is advertised as offering “two layers of encryption” with a proprietary cipher designed by the Brazilian Intelligence Agency (CEPESC/ABIN), end-to-end encryption of all communications including calls, and post-quantum protection.
We found that every cryptographic addition is either inert or wrong, and that the app’s real security is exactly that of the upstream Element code it inherited. The State cipher, Choro-02, also has a structural flaw that lets anyone who obtains a specific pair of outputs recover the key in minutes, although the app as deployed does not expose such pairs.
What we found
We analyzed the publicly available Android app (version 2.1.14, version code 223410280; version 2.1.11 on iOS).
- The Choro-02 cipher has an exact symmetry that holds through all rounds; a single “slid pair” of outputs reveals the key.
- The second encryption layer adds no protection: Choro-02 runs inside AES-256-CBC under the same key.
- 1:1 calls: every frame of every call is encrypted under one constant, hardcoded key and nonce, taken from a test fixture.
- Group calls have no frame encryption, so the conference server sees plaintext media. The current release hides the buttons that start a group call, but users can still join one.
- The post-quantum layer generates and advertises ML-KEM-1024 keys but never uses them.
- The library interface exposes a raw stream cipher without integrity protection, although an authenticated mode is available.
What is still intact
Because the fork modified the messaging, verification and calling code, we checked the properties that the app’s real security rests on. They hold: messages are authenticated before decryption, key material comes from a proper random number generator, emoji/decimal device verification (SAS) is unchanged, and calls keep standard WebRTC transport encryption (DTLS-SRTP) with fingerprint checks. The optional key backup is also upstream’s, unmodified: its key is generated on your device, so the server stores only data it cannot decrypt, though protected by classical cryptography.
What this means for users
Outsiders on the network
Your messages and 1:1 calls remain protected by the standard Matrix/Element encryption and WebRTC transport encryption, which are unaffected by our findings.
The service operator
The added layers give no extra protection against the operator of the server, which the Terms of Use say cannot access communications. A malicious server can mount the same attacks it could against ordinary Element, including sending group calls through a conference server it runs.
Future quantum computers
The advertised post-quantum protection is not active. Traffic recorded today is protected only by classical cryptography.
The Choro-02 cipher
Choro-02 is the stream cipher at the core of libharpia, the government’s cryptographic library. Its design had not been published. We extracted it from the app, validated our description byte-for-byte against the binary, and publish it in the paper, so that independent experts can analyze it.
The cipher is a ChaCha-like design that diffuses well, but has one structural defect: an exact symmetry that holds with probability one through all rounds, regardless of the number of rounds. It resembles the known “slid pairs” of Salsa20 and is absent from ChaCha20. Given a single slid pair of output blocks, the full key can be recovered in minutes on a laptop.
In the deployed app this flaw is certificational: keys are derived with HKDF, so an attacker cannot obtain a slid pair, and we found no evidence of a deliberate backdoor. It is, however, the kind of property that public review exists to catch before a cipher is deployed.
A reference implementation of Choro-02 and the scripts behind each experiment in the paper are available on GitHub (zip), under the Apache 2.0 license.
Disclosure
We followed a coordinated disclosure process with a 90-day window, shortened by mutual agreement with ABIN. All experiments ran in an isolated lab, with Matrix clients and a server under our control; we did not access any real user’s communications or create accounts on the production service.
- Late September 2026Report sent to the affected parties through the federal government CSIRTs.
- October 15, 2026Serpro, the operator, replied that development is the sole responsibility of ABIN and forwarded the report. ABIN’s project management acknowledged the findings the same day and announced a new version for December 2026.
- December 2026Planned release of version 4. At the time of publication, Google Play and the App Store still offer versions 2.1.14 and 2.1.11, respectively.
- December 4, 2026Public release of the paper and this website, ahead of the original deadline by agreement with ABIN.
We also reported weaknesses in the published post-quantum prototype that the next version builds on to its authors (issue).
FAQ
Is msg gov broken? Can someone read my messages?
Not because of our findings. The protection that actually works comes from the open-source Element/Matrix code that msg gov is based on. The additions made on top of it do not add the security they are advertised to provide, so the app is no more secure than plain Element, and the claims made about it are not accurate.
Did you find a backdoor?
No. We found no evidence of a deliberate backdoor, and the flaw in Choro-02 does not give one. Our concern is different: the operator of the service already has the privileged position of any Matrix server operator, while the Terms of Use state that it cannot access communications.
Why publish the description of a government cipher?
A cipher shipped inside a publicly downloadable app is already in the hands of anyone who looks. Strong cryptography does not depend on its design being secret, and public review is how flaws like the one we found get caught. The Choro-02 symmetry is a property of the design itself, so it cannot be fixed by an app update.
Did you attack government systems?
No. We analyzed the app distributed in the public app stores and ran all experiments in our own lab. The only contact with government infrastructure was the public discovery requests that every client sends before login.
Has it been fixed?
At the time of writing, no updated version is available in the app stores, so we could not verify any fixes. ABIN stated that version 4 is planned for December 2026.
Why “Choro is Free”?
In Brazilian Portuguese, choro means crying, and it is also the name of a traditional genre of Brazilian popular music. Now that its description is public, the cipher is free for anyone to study. The title also plays on “o choro é livre” (“crying is free”), a popular Brazilian expression used to tease someone who complains after losing an argument or a game: they are free to cry, but the result stands.
Cite
@inproceedings{choro-is-free,
author = {Diego F. Aranha},
title = {Choro is Free: a security analysis of
a government {E2EE} communication app},
booktitle = {Black Hat Asia},
year = {2027},
note = {\url{https://choro-is-free.github.io/}}
}