<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-burger-mimi-audit-layer-00" category="info" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <front>
    <title abbrev="Detection of Malicious Hub in MIMI">Detecting the Presence of a Malicious Hub in MIMI Protocol</title>
    <seriesInfo name="Internet-Draft" value="draft-burger-mimi-audit-layer-00"/>
    <author fullname="Harditya Sarvaiya">
      <organization>Virginia Tech</organization>
      <address>
        <postal>
          <country>United States of America</country>
        </postal>
        <email>harditya@vt.edu</email>
      </address>
    </author>
    <author fullname="Eric W Burger">
      <organization>Virginia Tech</organization>
      <address>
        <postal>
          <country>United States of America</country>
        </postal>
        <email>ewburger@vt.edu</email>
      </address>
    </author>
    <date year="2025" month="July" day="7"/>
    <area>ART</area>
    <workgroup>More Instant Messaging Interoperability (mimi)</workgroup>
    <keyword>Audit layer</keyword>
    <keyword>Merkle proof</keyword>
    <keyword>Malicious hub</keyword>
    <abstract>
      <?line 58?>

<t>This document defines a Merkle-tree-based approach that can act as an audit-layer detection mechanism to identify a malicious hub, responsible for interoperable group communication between various messaging platforms. The proposed approach is based on the MIMI protocol, which uses a central hub for timestamping and broadcasting messages to clients operating on different platforms. Even though all MLS ciphertexts are end-to-end encrypted, they are routed through the hub, making it a lucrative attack surface for message reordering attacks. To detect such attacks, the proposed approach suggests creating Merkle proofs of messages and timestamps on the client-side, which can subsequently be broadcast to other clients for verification with local Merkle proofs. The broadcast messages are encrypted too and are sent probabilistically to avoid being dropped by the hub. If any of the proofs do not match, an alert is broadcast to the room, indicating a malicious hub. The approach has minimal communication overhead for practical purposes. </t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        Discussion of this document takes place on the
        mimi Working Group mailing list (<eref target="mailto:mimi@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/mimi/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/mimi/"/>.
      </t>
    </note>
  </front>
  <middle>
    <?line 63?>

<section anchor="introduction">
      <name>Introduction</name>
			<t> The MIMI architecture <xref target="I-D-mimi-arch"/> <xref target="I-D-mimi-proto"/> uses a hub as the center of each room, which is also responsible for routing and timestamping all messages. It employs MLS <xref target="RFC9420"/> for end-to-end encryption (E2EE) and security. If a hub is compromised, it can take advantage of the trust vested in it by the MIMI protocol. This can affect the integrity of the messages being routed through the hub, including, but not limited to message dropping, message reordering, targeted censorship attacks, etc <xref target="I-D-mimi-content"/> <xref target="E2EE-Attacks"/>. With this detailed example below, we will demonstrate few of the possible attacks that a compromised hub can execute. We are considering a group chat between Alice, Bob and Charlie.
			</t>
			<t> Message reordering attack:</t>
			<ul empty="true">
			<li> <strong>Seen by Alice:</strong> </li>
			<li><strong>08:00 Alice:</strong> <em>How to fix the system?</em></li>
			<li><strong>08:02 Bob:</strong> <em>Press X, it should work!</em></li>
			<li><strong>08:03 Alice:</strong> <em> I pressed X, the system crashed! </em></li>
			<li><strong>08:04 Charlie:</strong> <em> Do not Press X, the system will crash!</em></li>
			<li><strong>08:08 Charlie:</strong> <em> I told you not to press X, but you went with Bob&apos;s suggestion.</em></li>
			</ul>

			<ul empty="true">
			<li> <strong>Seen by Charlie:</strong> </li>
			<li><strong>08:00 Alice:</strong> <em>How to fix the system?</em></li>
			<li><strong>08:04 Charlie:</strong> <em> Do not Press X, the system will crash!</em></li>
			<li><strong>08:06 Bob:</strong> <em>Press X, it should work!</em></li>
			<li><strong>08:07 Alice:</strong> <em> I pressed X, the system crashed! </em></li>
			<li><strong>08:08 Charlie:</strong> <em> I told you not to press X, but you went with Bob&apos;s suggestion.</em></li>
			</ul>

			<t> Now, in the scenario presented above, Charlie sees a different version of the chat than Alice, which creates a misunderstanding between Alice and Charlie. Charlie thinks that Alice decided to go ahead with Bob&apos;s suggestion and ignored his suggestion even though it was sent first, whereas Charlie&apos;s message arrived after Alice had already acted upon Bob&apos;s suggestion. Here, the hub reordered message timestamps for Charlie, undermining the integrity of the group chat.
			</t>
			<t>
			Shown below is another example, where the hub specifically dropped or censored messages from Charlie, such that Alice never sees any messages from Charlie. This is a targeted censorship attack from the hub. Also, from the context of the messages, Charlie assumes that Alice provided an update in response to his message, whereas Alice never saw Charlie&apos;s message and was updating Bob, due to which the malicious hub also avoided being detected.</t>

			<ul empty="true">
			<li> <strong>Seen by Alice:</strong> </li>
			<li><strong>08:00 Alice:</strong> <em>How to fix the system?</em></li>
			<li><strong>08:02 Bob:</strong> <em>Press X, it should work!</em></li>
			<li><strong>08:07 Alice:</strong> <em> I pressed X, the system crashed! </em></li>
			</ul>

			<ul empty="true">
			<li> <strong>Seen by Charlie:</strong> </li>
			<li><strong>08:00 Alice:</strong> <em>How to fix the system?</em></li>
			<li><strong>08:02 Bob:</strong> <em>Press X, it should work!</em></li>
			<li><strong>08:04 Charlie:</strong> <em> Do not Press X, the system will crash!</em></li>
			<li><strong>08:05 Charlie:</strong> <em> Any update Alice?</em></li>
			<li><strong>08:07 Alice:</strong> <em> I pressed X, the system crashed! </em></li>
			</ul>

			<t> As per <xref target="I-D-mimi-content"/> <xref target="E2EE-Attacks"/>, message reordering, and traffic analysis attacks are practically possible, even with E2EE being in place. The draft MIMI specification does not offer any solution for detecting or countering a malicious hub. The protocol described in this document introduces a client-driven audit layer to detect malicious hub behavior without the need to modify the hub, and the need to add new trusted servers, with practically minimal resource overhead. Following the proposed protocol, each client maintains a timestamp-ordered list of messages from the client perspective, while continuously maintaining a Merkle root for the list. With a random probability &apos;alpha&apos; the client broadcasts the Merkle root to the group with a regular encrypted group message. On receipt of this message, each client individually verifies the Merkle root against their local list of ordered messages. If the Merkle root does not match with even one of the clients, the client raises an alarm, indicating a malicious hub.
			</t>

			</section>

			<section anchor="threat-model">
			<name>Threat Model</name>
			<t>Based on the examples and discussion in the previous section, we propose a formal threat model for a MIMI hub, as a critical point of security failure in the MIMI protocol. The threat model will be defined by the following three components:</t>
			<ol>
				<li>
					Timestamp Authority of the hub enables it to back-date or falsify timestamps, leading to a timeline of messages that can be misleading.
				</li>
				<li>
					Re-ordering via delay is another property of a malicious hub that causes downstream clients to see an arbitrary permutation of actual messages, due to the hub selectively delaying certain messages.
				</li>
				<li>
					Isolated views indicate that clients are only dependent on the hub for receiving and sending messages, and have no other way of cross-checking the order of the messages received.
				</li>
			</ol>
			<t>The Theat Model represented in Figure 1, represents a message reordering attack where, the messages sent by Client B and Client C get reordered by the malicious hub Server A, such that Client B sees a different order of messages than Client C and Client A.</t>

<figure anchor="fig-threat-model">
<name>Threat Model</name>
<artwork type="ascii-art" name="message-flow">
<![CDATA[
ClientB   ServerB      ClientC      ServerC       ServerA        ClientA
 |            |            |            |             |              |
 |    M_b     |            |            |             |              |
 |----------->|            |            |             |              |
 |            |              /submit M_b              |              |
 |            |-------------------------------------->|              |
 |            |            |   200 OK   |             |              |
 |            |<--------------------------------------|              |
 |  Accepted  |            |            |             |              |
 |<-----------|            |            |             |              |
 |            |            |    M_c     |             |              |
 |            |            |----------->|             |              |
 |            |            |            | /submit M_c |              |
 |            |            |            |------------>|              |
 |            |            |            |    200 OK   |              |
 |            |            |            |<------------|              |
 |            |            |  Accepted  |             |              |
 |            |            |<-----------|             |              |
 |            |            |            +----------------------------+
 |            |            |            |Malicious reordering: M_c is|
 |            |            |            |delivered first to ClientA  |
 |            |            |            +----------------------------+
 |            |            |            |             |     M_c      |
 |            |            |            |             |------------->|
 |            |            |            |             |     M_b      |
 |            |            |            |             |------------->|
 |            |            |   /notify M_c            |              |
 |            |<--------------------------------------|              |
 |     M_c    |            |            |             |              |
 |<-----------|            |            |             |              |
 |            |            |            | /notify M_b |              |
 |            |            |            |<------------|              |
 |            |            |     M_b    |             |              |
+----------+  |            |<-----------|             |              |
|M_b -> M_c|  |            |            |             |              |
+----------+  |       +----------+      |             |              |
 |            |       |M_c -> M_b|      |             |              |
 |            |       +----------+      |             |     +----------+
 |            |            |            |             |     |M_c -> M_b|
 |            |            |            |             |     +----------+
 |            |            |            |             |              |
]]></artwork>
</figure>

</section>

    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>
    </section>
    <section anchor="protocol-design">
      <name>Protocol Design</name>
			<t>The proposed mechanism is designed based on Merkle proof generation. Merkle proofs are generated using Merkle trees where each leaf is represented as a hash function of a message and its timestamp. The proof is calculated using the leaf nodes and if the message order is tampered with in any way, the proof generated will vary. This will help identify if the hub is malicious as it handles all the message routing and distribution mechanisms. The proposed mechanism is broadly divided into three components, which are described below:</t>

			<section anchor="merkle-tree-construction-proof-gen">
			<name>Merkle Tree Construction and Proof Generation</name>
			<t>
				All clients maintain a list of messages with their corresponding timestamps assigned by the central hub. The list of messages M = [(d_i, t_i)], where d_i is the message plaintext and t_i is the timestamp, stores messages in the ascending order of the timestamps. The hash generated for each message in the list and its corresponding timestamp forms a leaf node.
			</t>
			<t>
				We use SHA-256 as the hash function H(<tt>.</tt>), for its collision resistance, wherein, each leaf node l_i can be denoted as a hash function of (d_i, t_i), i.e. l_i = H(d_i || t_i) . To construct a Merkle tree, a batch of messages are taken from the maintained message list, with s and e being the starting and ending message indices respectively. The parent node at each level of the tree is calculated by combining a pair of leaf nodes l_k and l_k+1 spanning from l_s to l_e. The calculation for parent nodes represented by n_j = H(l_k || l_k+1), continues recursively at each level until the single root node or the Merkle root R is generated, as shown in Algorithm 1. In case of even number of leaf nodes, the pairwise combination of leaf nodes works perfectly. In case of odd number of leaf nodes, the last node is duplicated to form a pair.
			</t>
			<t>
				The generated Merkle proof is a tuple represented by (R, t_max, s, e), where t_max represents the maximum timestamp from message s to e. The generated Merkle proof will be broadcast randomly by the client to all other clients via the MIMI hub. To avoid detection by the MIMI hub, we will discuss the random sampling of the proof in the next section.
			</t>


		<sourcecode type="pseudo" name="ComputeAndBroadcastMerkleProof">

<![CDATA[
Algorithm 1: ComputeAndBroadcastMerkleProof(Lm, s, e)

Require: List of sorted messages Lm = M[1,...,m],
indices 1 <= s <= e <= m
Ensure: Proof tuple (R, t_max, s, e)

procedure ComputeMerkleProof(M, s, e)
    leaves := []
    t_max := 0
    for i := s to e do
        (d_i, t_i) := M[i]
        l_i := H(d_i || t_i)
        leaves.append(l_i)
        t_max := max(t_max, t_i)
    end for
    R := BuildMerkleTreeRoot(leaves)
    return (R, t_max, s, e)
end procedure

procedure BroadcastProof(alpha)
    if Bernoulli(alpha) then
        Broadcast(R, t_max, s, e)
    end if
end procedure
]]>


</sourcecode>
			</section>

		<section anchor="prob-proof-sampling-and-broadcast">
		<name>Probabilistic Proof Sampling and Broadcast</name>
		<t>
				The Merkle proofs requested by a client are embedded with a probability alpha within the <tt>MLS PrivateMessage</tt> frames to prevent a malicious hub from predicting and selectively suppressing messages containing proofs. Following this, the MLS PrivateMessage containing the proof is broadcast to all the other clients, as per Algorithm 1. To test the ideal sampling rate, we varied the sampling rates and outlined the results in the evaluations section.
			</t>
			<t>
				Given n number of clients, the probability of each requesting a Merkle proof independently is alpha. The Proof-request Probability per Message is given by:
			</t>
			<t>
				P<sub>proof</sub> = 1 - (1 - alpha)<sup>n</sup>
			</t>
			<t>
				The probability of a malicious hub attacking each message is given by beta. The probability of detection of a malicious hub in a single message is defined as:
			</t>
			<t>
				P<sup>(1)</sup><sub>detect</sub> = beta[1 - (1 - alpha)<sup>n</sup>]
			</t>
			<t>
				Assuming independence across messages, the escape probability for T messages (i.e., probability that messages go undetected) is given by:
			</t>
			<t>
				P<sup>(T)</sup><sub>escape</sub> = [1 - beta(1 - (1 - alpha)<sup>n</sup>)]<sup>T</sup>
			</t>
			<t>
				The detection probability by message T is given by:
			</t>
			<t>
				P<sup>(T)</sup><sub>detect</sub> = 1 - [1 - beta(1 - (1 - alpha)<sup>n</sup>)]<sup>T</sup>
			</t>
		</section>

		<section anchor= "client-verfication-and-mal-hub-detection">
		<name>Client Verification and Malicious Hub Detection</name>
		<t>
					When a client randomly broadcasts a Merkle proof to the other clients via the MIMI hub, the proof received by all the clients is verified locally against a maintained list of messages M specifically for message indices s to e. Each client computes a Merkle root and verifies it against the received Merkle root; the timestamp t_max is verified as well. Any discrepancy found will cause a client to raise an alert, and a proof mismatch is broadcast to all clients indicating the presence of a malicious hub, as described in Algorithm 2.
			</t>
			<sourcecode type="pseudo" name="ProofVerificationAndBroadcast">
<![CDATA[
Algorithm 2: ProofVerificationAndBroadcast

procedure OnProof(R, t_max, s, e)
    compute leaves l_i = H(d_i || t_i) for i in [s, e]
    R_hat := ComputeRootFromLocalMessages(s, e)
    if R_hat != R or t_max != max_{i in [s,e]} t_i then
        RaiseAlert(ProofMismatch)
        Broadcast(ProofMismatch)
    end if
end procedure
]]>

</sourcecode>
		</section>

    </section>



    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>A compromised client is one of our primary security considerations that could undermine the efficacy of the proposed detection mechanism. Since a client is independent or autonomous in terms of Merkle proof generation, if compromised, it has the ability to generate fake proofs, which can lead to false alarms by other clients. Another possibility is that the compromised client generates a false alarm. Even if the received Merkle proof matches the locally generated proof, the client might raise a false alarm, disrupting communication or causing overheads to re-establish secure communication. To potentially mitigate the generation of fake proofs, cryptographically signed Merkle proofs could be used to verify the origin of the proof, potentially preventing proof spoofing.</t>
			<t>A compromised client can also pull off a Denial of Service (DoS) attack by flooding the group with proofs or mismatched alerts. This may lead to higher communication overheads for continuous Merkle proof computations and verification against multiple proofs available on the group. This may also cause alert fatigue and confusion, generating irrelevant alerts due to a compromised client rather than a compromised hub. Dealing with this issue requires setting policies for handling alerts, including but not limited to limiting the rate of proof generation and broadcast, aggregation of alerts, and explicit alert handling to detect the presence of a malicious client.</t>
			<t>Similar to post quantum decryption consideration for MLS, Merkle proof generation by the proposed mechanism can also be affected by the security of the underlying algorithm for proof generation. Another consideration would be the collision resistance property of the algorithm used for proof generation, which can potentially undermine the integrity of the generated proofs. Choosing and optimizing the available hash functions to suit the security and overhead requirements for Merkle proof generation is key in maintaining proof integrity. Algorithmic agility is another key component to rapidly switch between cryptographic algorithms as a response to emerging threats to the integrity of the proofs and the overall communication integrity.</t>
			<t>Another point of possible intrusion could be the follower servers. A compromised follower server may do internal message reordering or dropping, acting as a malicious hub for its clients. In such a case, the MIMI hub will be the one held responsible, whereas the malicious follower server will bypass detection. To mitigate this situation, it might be a good idea to apply the audit-layer detection on the follower servers internally, while keeping the communication overhead minimal.</t>
    </section>

    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>

  <back>  <references>
    <name>References</name>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
			<reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
			<reference anchor="RFC9420" target="https://www.rfc-editor.org/info/rfc9420">
				<front>
					<title>The Messaging Layer Security (MLS) Protocol</title>
					<author initials="R." surname="Barnes" fullname="Richard Barnes"/>
					<author initials="J." surname="Beurdouche" fullname="Jonas Beurdouche"/>
					<author initials="K." surname="Omari" fullname="Katriel Omari"/>
					<author initials="R." surname="Robert" fullname="Raphaël Robert"/>
					<date month="October" year="2023"/>
				</front>
				<seriesInfo name="RFC" value="9420"/>
				<format type="HTML" target="https://www.rfc-editor.org/rfc/rfc9420.html"/>
			</reference>
    </references>

    <references>
      <name>Informative References</name>
			<reference anchor="I-D-mimi-proto" target="https://datatracker.ietf.org/doc/draft-ietf-mimi-protocol/03/">
				<front>
					<title>More Instant Messaging Interoperability (MIMI) using HTTPS and MLS</title>
					<author initials="R." surname="Barnes" fullname="Richard Barnes"/>
					<author initials="M." surname="Hodgson" fullname="Matthew Hodgson"/>
					<author initials="K." surname="Kohbrok" fullname="Konrad Kohbrok"/>
					<author initials="R." surname="Mahy" fullname="Rohan Mahy"/>
					<author initials="T." surname="Ralston" fullname="Travis Ralston"/>
					<author initials="R." asciiSurname="Robert" asciiFullname="Raphaël Robert"/>
					<date month="March" year="2025"/>
				</front>
				<seriesInfo name="Internet-Draft" value="draft-ietf-mimi-protocol-03"/>
				<format type="HTML" target="https://datatracker.ietf.org/doc/draft-ietf-mimi-protocol/03/"/>
			</reference>
			<reference anchor="I-D-mimi-arch" target="https://datatracker.ietf.org/doc/draft-ietf-mimi-arch/01/">
				<front>
					<title>An Architecture for More Instant Messaging Interoperability (MIMI)</title>
					<author initials="R." surname="Barnes" fullname="Richard Barnes"/>
					<date month="November" year="2024"/>
				</front>
				<seriesInfo name="Internet-Draft" value="draft-ietf-mimi-arch-01"/>
				<format type="HTML" target="https://datatracker.ietf.org/doc/draft-ietf-mimi-arch/01/"/>
			</reference>
			<reference anchor="E2EE-Attacks" target="https://doi.org/10.1109/SP58266.2024.00174">
				<front>
					<title>Injection Attacks Against End-to-End Encrypted Applications</title>
					<author initials="A." asciiSurname="Fábrega" asciiFullname="Arnau Fábrega"/>
					<author initials="C. O." asciiSurname="Pérez" asciiFullname="Carlos O. Pérez"/>
					<author initials="A." surname="Namavari" fullname="Amir Namavari"/>
					<author initials="B." surname="Nassi" fullname="Ben Nassi"/>
					<author initials="R." surname="Agarwal" fullname="Rohan Agarwal"/>
					<author initials="T." surname="Ristenpart" fullname="Thomas Ristenpart"/>
					<date year="2024"/>
				</front>
				<seriesInfo name="Proceedings of the IEEE Symposium on Security and Privacy (S&amp;P)" value="2024, pp. 2648-2665"/>
				<format type="HTML" target="https://doi.org/10.1109/SP58266.2024.00174"/>
			</reference>
			<reference anchor="I-D-mimi-content" target="https://datatracker.ietf.org/doc/draft-ietf-mimi-content/">
				<front>
					<title>Message Content for More Instant Messaging Interoperability (MIMI)</title>
					<author initials="R." surname="Mahy" fullname="Rohan Mahy"/>
					<date month="February" year="2025"/>
				</front>
				<seriesInfo name="Internet-Draft" value="draft-ietf-mimi-content-07"/>
				<format type="HTML" target="https://datatracker.ietf.org/doc/html/draft-ietf-mimi-content-07"/>
			</reference>

    </references>
  </references>
    <?line 253?>

    <section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>We gratefully acknowledge the valuable feedback and constructive discussions received within the working group, in individual conversations, and during the MIMI interim meetings.</t>
    </section>
  </back>
</rfc>
