<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reverse Firewalls |</title><link>https://bemagri.xyz/tags/reverse-firewalls/</link><atom:link href="https://bemagri.xyz/tags/reverse-firewalls/index.xml" rel="self" type="application/rss+xml"/><description>Reverse Firewalls</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Fri, 02 Oct 2026 00:00:00 +0000</lastBuildDate><image><url>https://bemagri.xyz/media/icon_hu_b1b8ea8dd459471c.png</url><title>Reverse Firewalls</title><link>https://bemagri.xyz/tags/reverse-firewalls/</link></image><item><title>What if your encryption software is working against you?</title><link>https://bemagri.xyz/blog/what-if-your-encryption-software-is-working-against-you/</link><pubDate>Fri, 02 Oct 2026 00:00:00 +0000</pubDate><guid>https://bemagri.xyz/blog/what-if-your-encryption-software-is-working-against-you/</guid><description>&lt;p&gt;Suppose someone modifies your messaging app. You keep sending messages, your contacts keep receiving them, and everything decrypts correctly. There are no strange error messages. As far as you can tell, the app works.&lt;/p&gt;
&lt;p&gt;Meanwhile, the implementation could be using those encrypted messages to leak your secrets.&lt;/p&gt;
&lt;p&gt;I work on subversion-resilient cryptography, which studies what security we can retain when cryptographic implementations have been tampered with. One of the things I find most interesting about this area is that the malicious implementation may continue doing exactly what the user expects. The messages arrive. The signatures verify. The extra information escapes through choices the user never sees.&lt;/p&gt;
&lt;p&gt;That makes the problem rather uncomfortable. It also leads to a surprising question: can we protect a user from their own cryptographic software without giving another party access to their secrets?&lt;/p&gt;
&lt;h2 id="how-a-valid-ciphertext-can-leak-a-key"&gt;How a valid ciphertext can leak a key&lt;/h2&gt;
&lt;p&gt;Consider an encryption scheme that uses fresh randomness. Encrypting the same message twice can produce different ciphertexts, both of which decrypt to the same message. This is ordinary behaviour for a randomised encryption scheme.&lt;/p&gt;
&lt;p&gt;Now give the implementation a malicious objective. It wants to leak one bit of a secret key while still encrypting the user&amp;rsquo;s message correctly.&lt;/p&gt;
&lt;p&gt;For a deliberately simple example, fix the key and message. Suppose a public test on the ciphertext returns 0 or 1 with equal probability over honestly sampled encryption randomness. The modified implementation encrypts the message and runs the test. If the result matches the secret bit it wants to leak, it sends that ciphertext. Otherwise, it tries again with fresh randomness.&lt;/p&gt;
&lt;p&gt;Each attempt succeeds with probability one half, so it takes two attempts on average. The recipient decrypts the intended message. An observer who knows the selection rule reads the leaked bit from the ciphertext. That is a rather cheap price for leaking a bit of a key.&lt;/p&gt;
&lt;p&gt;This example is deliberately crude. Its purpose is to make the channel visible; it does not establish that the attack would evade statistical analysis. More sophisticated algorithm-substitution attacks use cryptography to conceal the selection rule. Bellare, Paterson and Rogaway studied this problem formally in their work on symmetric encryption and mass surveillance.
&lt;/p&gt;
&lt;p&gt;A test that checks whether decryption recovers the original message would pass in this example. To notice the problem, we would need to examine how the implementation chooses among the many ciphertexts that pass that check.&lt;/p&gt;
&lt;h2 id="what-happened-to-the-security-proof"&gt;What happened to the security proof&lt;/h2&gt;
&lt;p&gt;There is no contradiction with a proof that the encryption scheme is secure. Such a proof concerns specified algorithms and assumptions about how they are executed. If the encryption algorithm is supposed to sample randomness uniformly, the proof relies on that step.&lt;/p&gt;
&lt;p&gt;Our malicious implementation changes the distribution by discarding outputs it does not like. It is executing a different algorithm, even though each ciphertext it eventually releases remains valid.&lt;/p&gt;
&lt;p&gt;That distinction matters. Correct decryption tells us that a ciphertext represents the right message. It does not tell us that the process which produced the ciphertext respected the assumptions of the security proof.&lt;/p&gt;
&lt;p&gt;Subversion resilience asks us to model that malicious process explicitly and establish what protection remains possible.&lt;/p&gt;
&lt;h2 id="changing-a-message-without-reading-it"&gt;Changing a message without reading it&lt;/h2&gt;
&lt;p&gt;A cryptographic reverse firewall sits between a participant and the outside world and transforms protocol messages. Mironov and Stephens-Davidowitz introduced the model at EUROCRYPT 2015. The firewall receives public information and protocol traffic, without being given the participant&amp;rsquo;s private input or secret keys. Its transformations must preserve the intended protocol functionality.
&lt;/p&gt;
&lt;p&gt;The name can be misleading if it makes you picture a filter searching packets for suspicious contents. In our example, a ciphertext carrying a hidden key bit is also a perfectly valid encryption. There need not be a distinctive bad packet to recognise.&lt;/p&gt;
&lt;p&gt;A useful technique is rerandomisation. Certain encryption schemes allow a ciphertext to be transformed into a fresh encryption of the same message without decrypting it. Textbook ElGamal is an example. For a fixed message, adding independent uniform randomness removes the original sender&amp;rsquo;s control over the encryption randomness.
&lt;/p&gt;
&lt;p&gt;Return to the toy attack. The malicious implementation carefully chooses a ciphertext for which the public test returns 1. If a suitable rerandomisation step produces an independently distributed encryption of that same message, the test on the outgoing ciphertext is again equally likely to return 0 or 1. The carefully selected bit has been lost.&lt;/p&gt;
&lt;p&gt;The firewall does not need to discover which secret the implementation was trying to leak. It changes the representation in a way that destroys the illustrated channel while retaining the message.&lt;/p&gt;
&lt;p&gt;
&lt;figure id="figure-in-the-toy-example-rerandomisation-removes-the-apps-control-over-the-publicly-readable-bit-without-changing-the-encrypted-message"&gt;
&lt;div class="flex justify-center "&gt;
&lt;div class="w-full" &gt;
&lt;img alt="Diagram comparing the toy leakage attack with and without an honest reverse firewall. Without the firewall, a compromised app chooses a valid ciphertext whose public test reveals secret bit 1. With the firewall, rerandomisation makes the test return a fresh 0 or 1 while the recipient still recovers the same message."
srcset="https://bemagri.xyz/blog/what-if-your-encryption-software-is-working-against-you/reverse-firewall-illustration_hu_19587cc91eb37ada.webp 320w, https://bemagri.xyz/blog/what-if-your-encryption-software-is-working-against-you/reverse-firewall-illustration_hu_f8715847a435ec43.webp 480w, https://bemagri.xyz/blog/what-if-your-encryption-software-is-working-against-you/reverse-firewall-illustration_hu_712790a80f97ce5e.webp 760w"
sizes="(max-width: 480px) 100vw, (max-width: 768px) 90vw, (max-width: 1024px) 80vw, 760px"
src="https://bemagri.xyz/blog/what-if-your-encryption-software-is-working-against-you/reverse-firewall-illustration_hu_19587cc91eb37ada.webp"
width="760"
height="504"
loading="lazy" data-zoomable /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;figcaption&gt;
In the toy example, rerandomisation removes the app’s control over the publicly readable bit without changing the encrypted message.
&lt;/figcaption&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;
.&lt;/p&gt;
&lt;p&gt;That is a useful building block. A complete protocol needs much more care: its messages may be authenticated, influence later keys, or carry state that other participants expect to remain consistent. The transformations have to be designed together with those requirements.&lt;/p&gt;
&lt;h2 id="where-the-trust-goes"&gt;Where the trust goes&lt;/h2&gt;
&lt;p&gt;At this point, a reasonable objection is that I have introduced another piece of software that might also be compromised.&lt;/p&gt;
&lt;p&gt;The distinction is in the security cases. Protection from a subverted implementation requires a correctly operating firewall. When the participant&amp;rsquo;s implementation is honest, a malicious firewall has the powers of an active network attacker, which the underlying protocol must already withstand. The firewall is not entrusted with the user&amp;rsquo;s secret keys.
&lt;/p&gt;
&lt;p&gt;These statements do not promise security when the attacker controls both components. Nor do they promise delivery through a firewall that simply drops every message.&lt;/p&gt;
&lt;p&gt;It also puts a practical question on the table. If the firewall runs in an environment that the compromised application can modify freely, what independence have we actually gained? The deployment has to make the separation assumed by the cryptography meaningful.&lt;/p&gt;
&lt;h2 id="from-one-ciphertext-to-a-conversation"&gt;From one ciphertext to a conversation&lt;/h2&gt;
&lt;p&gt;A conversation introduces a different level of difficulty. People send messages while their contacts are offline. Messages can arrive out of order. Keys evolve over time.&lt;/p&gt;
&lt;p&gt;Ratcheting protocols aim to limit the damage from key exposure. Forward secrecy protects earlier messages from a later compromise of the current state. Post-compromise security concerns recovering protection for future messages once the attacker no longer has the access needed to follow the evolving keys and suitable fresh secret material enters the protocol. Those guarantees have conditions. By themselves, they do not protect an implementation that keeps leaking the newly generated keys.
&lt;/p&gt;
&lt;p&gt;Now imagine allowing an intermediary to transform some of the messages that drive that evolution. Will both participants still compute compatible keys? Can we preserve authentication? What happens after an attacker interferes? A transformation that looks harmless in isolation can affect the rest of the conversation.&lt;/p&gt;
&lt;p&gt;In Guarding the Signal, our CRYPTO 2025 paper with Yevgeniy Dodis, Noah Stephens-Davidowitz and Yiannis Tselekounis, we construct a Signal-style messaging protocol with reverse firewalls, including X3DH-based initial key agreement.
&lt;/p&gt;
&lt;p&gt;The firewall sanitises key-agreement traffic. For message encryption, fixing the key, message and associated data fixes the only accepted ciphertext, removing the choice exploited in the toy attack. Forward secrecy and post-compromise security hold under our model. Deployment requires changes to the messaging protocol.
&lt;/p&gt;
&lt;p&gt;Constraining the ciphertext alone would leave another problem. An implementation that could arrange for the encryption key to be known to the attacker would still compromise confidentiality. Requiring a unique ciphertext under that key would not help. This is why protecting key agreement and controlling the encryption layer have to work together.
&lt;/p&gt;
&lt;p&gt;Refreshing one encrypted value is a neat algebraic operation. Preserving the guarantees of an ongoing conversation requires reasoning about what that operation changes everywhere else.&lt;/p&gt;
&lt;h2 id="the-assumptions-are-part-of-the-result"&gt;The assumptions are part of the result&lt;/h2&gt;
&lt;p&gt;Suppose a malicious application replaces the message you intended to send with your private key. A component that preserves an encrypted message without learning its contents cannot generally determine that you meant to say something else. Protecting the meaning of a user&amp;rsquo;s input requires a way to establish what that input was.&lt;/p&gt;
&lt;p&gt;Our model requires subverted implementations to preserve functionality and be explainable: their messages must be consistent with honest execution on the same inputs and incoming messages, using possibly malicious randomness. Biased randomness and rejection sampling remain possible; deliberately generating invalid messages to signal secrets is excluded. Timing and other side channels are outside the model.
&lt;/p&gt;
&lt;p&gt;Similarly, a firewall on one communication path has no control over a second path that bypasses it. If malware can read plaintext and send it elsewhere, a guarantee about transformed protocol messages does not address that escape route.&lt;/p&gt;
&lt;h2 id="making-the-model-survive-implementation"&gt;Making the model survive implementation&lt;/h2&gt;
&lt;p&gt;This is what we should be asking now: would these assumptions survive contact with a real system?&lt;/p&gt;
&lt;p&gt;Where should the firewall run? How does it obtain independent randomness? Which messages can it see and transform? How do we ensure that the application cannot quietly use another route?&lt;/p&gt;
&lt;p&gt;Our paper leaves open how to apply these transformations when an additional encryption layer, such as TLS, hides the relevant traffic.
&lt;/p&gt;
&lt;p&gt;That is the level of security the community should aim for: protocols with guarantees that remain useful even when the implementation is part of the problem.&lt;/p&gt;
&lt;h2 id="further-reading"&gt;Further reading&lt;/h2&gt;
&lt;p&gt;[1] Mihir Bellare, Kenneth G. Paterson and Phillip Rogaway. Security of Symmetric Encryption against Mass Surveillance. CRYPTO 2014.
&lt;/p&gt;
&lt;p&gt;[2] Ilya Mironov and Noah Stephens-Davidowitz. Cryptographic Reverse Firewalls. EUROCRYPT 2015.
&lt;/p&gt;
&lt;p&gt;[3] Yevgeniy Dodis, Ilya Mironov and Noah Stephens-Davidowitz. Message Transmission with Reverse Firewalls — Secure Communication on Corrupted Machines. CRYPTO 2016.
&lt;/p&gt;
&lt;p&gt;[4] Signal. The Double Ratchet Algorithm. Protocol specification.
&lt;/p&gt;
&lt;p&gt;[5] Yevgeniy Dodis, Bernardo Magri, Noah Stephens-Davidowitz and Yiannis Tselekounis. Guarding the Signal — Secure Messaging with Reverse Firewalls. CRYPTO 2025.
&lt;/p&gt;</description></item></channel></rss>