# Isolink threat model

What Isolink protects, against whom, and what it doesn't. The mechanisms are in
[protocol.md](protocol.md); bots that use a computer are in
[bot-threat-model.md](bot-threat-model.md). This describes the code as of November 2026 and has
not been reviewed by anyone outside the project.

## What is being protected

| Asset | Where it lives |
| --- | --- |
| Message and file contents | Sender's and recipients' devices; sealed on carriers and relay servers |
| Who talks to whom, when, how much (metadata) | Visible in part to the network, carriers and relay servers |
| Device and account private keys | Each device's encrypted store; the account key on every linked device |
| The local message history | Each device's encrypted store, and backups if any |
| The computer, when a bot is let use it | See [bot-threat-model.md](bot-threat-model.md) |

## Who the attackers are

| Attacker | Can | Assumed unable to |
| --- | --- | --- |
| **Passive network observer** (Wi-Fi, ISP, Bluetooth sniffer) | See every byte on a link, IP and MAC addresses, timing and sizes | Break X25519, Ed25519, AES-GCM, SHA-2 |
| **Active network attacker nearby** | Inject, drop, replay and reorder frames; announce fake devices; jam the radio | The same |
| **Stranger in range** | Dial you, send hello frames, carry or ask for carried items | Get past your admission rules |
| **Carrier phone** (a contact or a stranger holding your mail) | Keep, drop, delay, replay or copy what it carries | Open it, forge it, or tell who it is for |
| **Relay server operator** (Isolink's or anyone's) | Everything the server sees and stores; run modified server code | Open links or mail, or forge a device's signature |
| **A contact** | Anything an Isolink app can send; lie about group members if an admin | Read chats it isn't in, impersonate another account |
| **Someone with your unlocked device, or malware on it** | Everything that device can do | — this is out of scope beyond what is listed below |
| **Release infrastructure** (CI, isolink.app) | Ship app builds and the web app | Ship a desktop/Android update that isn't signed by the release key |

## What is protected

- **Contents** against everyone but the two ends: the network, carriers, relay servers and the
  push service see only ciphertext of padded sizes.
- **Forward secrecy.** Messages already received can't be decrypted from a later device
  compromise once their keys are gone, with the exceptions under [Resent messages](#resent-messages)
  and [No one-time prekeys](#no-one-time-prekeys).
- **Post-compromise security.** After a temporary key compromise, the next DH ratchet step (the
  next reply) locks the attacker out again, as long as they aren't active in the middle.
- **Authenticity.** A link authenticates both device keys; a message is authenticated by its
  session; a carried item can only be opened and believed by its recipient. Forged acks,
  receipts and relay items fail.
- **Hidden presence.** A hidden device (the default) broadcasts only tags that change every 10
  minutes and that only contacts can recognise, and refuses strangers before saying who it is.
- **Data at rest**, while the OS keychain is intact (not on the web app; see below).
- **Updates**: an update from any feed, isolink.app or a relay, is taken only if it is signed by
  the release key for that version, file, hash and size.

## What is not protected, and why

Each of these is a real limit of the current code, stated so a reviewer can check it. Items marked
**Finding** differ from what the README said before this document.

### Metadata visible to relay servers

**Finding.** On main, a relay server knows the full bundle (keys, account, display name, device
kind) of every device signed in to it, and for every circuit and every piece of mail both the
sending and the receiving device id. It sees timing and sizes. It cannot read anything, and it
can't forge a device. The README said relays "can't tell who [items] are for"; that is true of
phones that carry mail, which see only rotating mailbox tags, but not of relay servers, which are
told the recipient. The isolink.app community page already says so correctly.

From the next release, mail between two newer apps goes to daily boxes posted over a connection
that never signs in ([sealed-sender.md](sealed-sender.md)), so the protocol no longer tells the
relay who mail is from or for. A relay still learns them:

- for **mail by device id**: to or from older apps, at older or clustered relays, and to a device
  that hasn't given the sender boxes yet;
- for **live circuits**, which name the device at the far end;
- for **phones woken by push**: the phone registers its push target with its boxes, so the relay
  can match the token to the box (Kyle chose to keep push wakes, 2026-11-14);
- by **IP address and timing**: a device's signed-in connection, the connection that empties its
  boxes, and a sender's post come from addresses and times a logging relay can compare;
- for **files to several people**: the same blob id is posted to each of their boxes.

The relay still knows every signed-in device's bundle. The members' pass is shared by all members,
so it says nothing about which member opened a box, and someone removed keeps it up to two weeks.

### Stranger carrying is on by default

**Finding.** The README said a device holds items only for saved contacts. Since then, *Carry for
strangers* and *Strangers may carry* were added, both **on by default**: your sealed mail may
travel on up to two phones of people you don't know, and your phone may hold up to 20 MB of
strangers' sealed mail for 48 hours. They learn what any carrier learns: a mailbox tag, a size,
which device handed it over, and when it was picked up.

### Metadata visible to carriers and the network

- A carrier knows which device handed it an item and can guess pairs by timing. Fetches include
  3 decoy tags; this is a small cover.
- Tags come from static keys (`DH(IKdh_a, IKdh_b)`), not from the ratchet. **Anyone who later
  gets a device's identity private key can compute every past and future beacon and mailbox tag
  it shares with every contact**, and so link old captures of the radio or a carrier's store to
  that pair. Content stays protected.
- A beacon or mailbox tag is the same in both directions, so it says "these two", not who sent.
- IP and MAC addresses, Bluetooth presence, timing and rough volume are visible on the network.
  Visible devices announce their bundle, including their name, to everyone nearby.

### No one-time prekeys

On main, sessions use X3DH without one-time prekeys. From the next release, newer apps use them
([one-time-prekeys.md](one-time-prekeys.md)): handed over inside sessions, left signed on relays
for first chats, or carried in an in-person QR code. A session that spends one is not open to
either problem below, and a replay that spends one is refused. What remains:

- A first chat with no relay in common and no QR code (a stranger nearby, a code with no relays),
  a session with an older app, or one started after the keys ran out, uses no one-time prekey.
- A relay can withhold its keys, or hand the same one to two people (the second gets a new
  session), but can't substitute one: they are signed by the device.
- Someone who drains a device's relay keys (3 per account per device per 10 minutes) only takes
  first chats back to no one-time prekey.

For sessions with no one-time prekey, two consequences:

- Someone who later gets both a device's identity key and a still-kept signed prekey (up to about
  4 weeks old) can decrypt the **first messages of any session** that started against that prekey,
  captured until the initiator heard a reply.
- A recorded first message can be **replayed** to start a second session once the original has
  dropped out of the 5 sessions kept per device, and the ratchet would open it again. The
  envelope id doesn't stop this, since it sits outside the encryption and a replayer can change
  it; only the session-id check does, and only while that session is kept. Whether the app then
  shows a duplicate depends on the payload's own message id. On the network the first message
  is inside link encryption, but a carrier holds it sealed exactly as the recipient will open it,
  so a carrier could hand it over again under a new id. That works within the mailbox tag's
  8-day window, and only if the recipient has started 5 newer sessions with that device since,
  which is rare.

### Resent messages

**Finding.** To recover when a device lost a session, each device keeps the plaintext of its
last 20 messages to each other device for up to a day (`_sentLately`), in its encrypted store,
and resends them over a new session when that device's `session` note names them. This trades a
day of forward secrecy on the sender's own device for messages not getting lost. A note can only
come over a session with that same device, and resent messages only ever go back to the device
they were first for.

### The account key is on every device

Every linked device holds the account private key. A stolen device, while it is still linked, can:

- certify a new device of the attacker's, which contacts accept with no prompt and no change of
  safety number (a `devices` message);
- rotate the account itself, which contacts accept automatically because the old key signs the
  new one, leaving the real devices out.

Removing the stolen device from another device rotates the key and retires every certificate the
stolen device could make. If the stolen device rotates first, the two chains fork; contacts are
warned and must verify by hand. Until a contact hears of a rotation, it still accepts the removed
device. A lost device you can't remove from another device means starting a new account.

### Compact codes

A compact (QR-sized) contact code carries an account chain *summary*: the genesis key, the current
key and the length. Nothing in it proves the current key belongs to the account the genesis key
names. So a forged code can claim **any account id** whose genesis key the forger has seen, with
the forger's own current key and devices. Isolink accepts it, and messages go to the forger's
devices until the real account sends its whole chain, when the forged devices are dropped and the
chat says so. For an account you already have, a summary can't move what you know along, only
add devices under the key you already have. The safety number of a forged contact differs from
the real one, so checking it, or scanning in person, catches this.

### Trust on first use

Adding someone from Nearby, a link or a shared code trusts the keys you were given. Isolink opens
a safety-number check straight away for Nearby, marks unverified contacts in the chat, and
verifies automatically when a code is scanned in person. Skipping the check leaves it TOFU.

### Group admins are trusted

A group admin's update carries every member's contact card, and each member adds the others from
those cards. A malicious admin can add a device of their own under a member's account only by
holding that account's key, but can add any account they like, rename the group, or remove
people. Members who missed an update see the old member list until it reaches them. There is no
group-wide transcript consistency: two members can hold different histories.

### Denial of service

Links, handshakes, attempts per host, UDP datagrams, stranger messages and carrying all have
caps, and hidden devices refuse strangers at the handshake. A nearby attacker can still jam the
radio, fill the connection slots, or drop everything they carry.

### The web app

The web app keeps its state, including private keys, in IndexedDB with no encryption of its own,
and its code is served by isolink.app on every load, so whoever controls that server or its TLS
key could serve code that reads keys. This is the usual limit of end-to-end encryption in a
browser. The installed apps are not affected.

### Post-quantum protection is partial

On main, X25519 only: traffic recorded now could be decrypted by a future quantum computer. From
the next release, sessions between two newer apps start with a hybrid ML-KEM-768 + X25519 secret
([post-quantum.md](post-quantum.md)), so a recording of them stays shut unless both are broken.
Still X25519 only: sessions with older apps, the ratchet steps after the first message (a device
compromise heals only against a classical attacker), the carrier seal, provisioning, SOS keys and
pair-key tags. A carrier that strips `pq` from a bundle you have never seen with it can keep that
session on X3DH. ML-KEM comes from a pure-Dart package (`pqcrypto` 0.4.4) that is not audited.

### Side channels and the platform

Isolink relies on the Dart `cryptography` package, the platform's AES, and its own Dart GCM for
large payloads where no native AES exists. The Dart GCM uses table lookups (Shoup's 8-bit tables)
and table-driven AES, which are not constant-time against an attacker who shares the CPU cache.
That attacker is out of scope for phones, but worth a reviewer's look for shared desktops. A
compromised OS, keyboard or screen reader sees everything.

## Out of scope

- Compromise of the device while it is unlocked, beyond the limits above.
- The person sharing their own messages or screenshots.
- Traffic analysis by a global observer.
- Physical attacks on the phone's secure hardware.

## Reporting

See [SECURITY.md](../SECURITY.md).
