Closed Bug 2087009 Opened 25 days ago Closed 12 days ago

OpenPGP cache can reuse decrypted plaintext across IMAP accounts with colliding folder and UID

Categories

(MailNews Core :: Security: OpenPGP, defect)

Thunderbird 159
defect

Tracking

(thunderbird_esr153 wontfix, thunderbird161 wontfix)

RESOLVED FIXED
162 Branch
Tracking Status
thunderbird_esr153 --- wontfix
thunderbird161 --- wontfix

People

(Reporter: cbohn, Assigned: mkmelin)

References

Details

Attachments

(1 file, 1 external file)

Steps to reproduce

I reproduced the issue in Thunderbird 159.0 using a clean temporary profile, two independent loopback-only fake IMAP servers, two synthetic accounts, a synthetic OpenPGP key, and synthetic messages.

No real accounts, credentials, keys, messages, or external network connections were used.

Test topology:

  • Account A: different username, port, account key, server authority, and UIDVALIDITY 1111
  • Account B: different username, port, account key, server authority, and UIDVALIDITY 2222
  • Both accounts used folder INBOX and message UID 41
  • A contained the decrypted sentinel A_SECRET_7F4E9C
  • B contained the independent sentinel B_PUBLIC_2A91D0

Steps:

  1. Start Thunderbird 159.0 with the clean temporary test profile.
  2. Configure both loopback IMAP accounts.
  3. Import the synthetic OpenPGP fixture key.
  4. Open message A and wait for OpenPGP processing to complete.
  5. Confirm that A displays A_SECRET_7F4E9C and the protected subject A_PROTECTED_SUBJECT.
  6. Within ten seconds, open message B.
  7. Wait for B's OpenPGP/MIME processing to complete.
  8. Inspect B's active message URI, displayed body, protected subject, cryptographic status, and MIME output.
  9. Select Reply-to-Sender while B is active and inspect the recipient, subject, and quoted body of the unsent draft.
  10. Close the draft without saving or sending it.
  11. Clear the cache state and repeat the test.

The positive test was reproduced successfully in three out of three runs.

I also performed negative controls with:

  • a different UID;
  • a different folder;
  • an interval longer than ten seconds;
  • a non-PGP/MIME message B;
  • a complete cache identity including account authority and UIDVALIDITY;
  • legitimate A-to-A and B-to-B cache reuse.

Detailed synthetic evidence and the complete control matrix are included in the confidential attachment.

Preferred public reporter attribution:

Christopher Bohn (Protectstar Inc.)

If Mozilla/Thunderbird publishes reporter credit for this vulnerability after coordinated disclosure or a fix, please use the attribution above.

Actual results

In all three positive test runs, Thunderbird treated message B as the active message but reused OpenPGP data previously cached for message A.

The following behavior was observed:

  • B entered the OpenPGP cache-hit path.
  • The decrypted bytes supplied to B's MIME consumer were A's cached plaintext.
  • B's message pane displayed A_SECRET_7F4E9C instead of B's own content.
  • B displayed A's protected subject, A_PROTECTED_SUBJECT.
  • A's cached cryptographic result and status flags were reused in B's message context.
  • Reply-to-Sender created a draft addressed to B's sender, but the quoted body contained A's plaintext.
  • The draft subject was based on A's protected subject.

The active message and reply recipient remained B throughout the test. The incorrectly reused plaintext and security metadata came from A.

No message was automatically sent. The reply drafts were closed without being saved or sent.

The A-to-B test reproduced deterministically in three out of three runs, with completion intervals of 133 ms, 123 ms, and 128 ms.

All negative controls behaved correctly:

  • changing the UID caused a cache miss;
  • changing the folder caused a cache miss;
  • waiting longer than the cache lifetime caused a cache miss;
  • a non-PGP/MIME B message did not enter the OpenPGP handler;
  • using a complete account- and UIDVALIDITY-bound cache identity prevented the cross-account reuse;
  • legitimate A-to-A and B-to-B cache reuse continued to work.

Expected results

Message B should have been independently decrypted and rendered using only B's plaintext, protected headers, and cryptographic result.

Cached OpenPGP data from message A must never be reused for a message belonging to another IMAP account, server authority, or UIDVALIDITY context, even when the folder name and numeric UID are identical.

A reply created while B is active must:

  • be based exclusively on B's message data;
  • quote only B's plaintext;
  • use only B's protected subject and cryptographic status;
  • never contain plaintext or metadata produced by A.

The decrypted-message cache should be keyed by a complete immutable message identity, including at least:

  • account or server authority;
  • complete folder identity;
  • UIDVALIDITY;
  • UID;
  • MIME part;
  • message-load generation or epoch.

Any mismatch should cause a cache miss and independent OpenPGP processing.

Not really a sec issue. It's a small correctness bug though.

Assignee: nobody → mkmelin+mozilla
Group: mail-core-security
Status: UNCONFIRMED → ASSIGNED
Component: Security → Security: OpenPGP
Ever confirmed: true
Product: Thunderbird → MailNews Core

EnigmailURIs.msgIdentificationFromUrl() only used the URL path, so IMAP
messages with the same folder name and UID on different accounts got the
same identity. Opening such a message within ten seconds of another
one made mimeDecrypt reuse the cached plaintext and status of the first
message.

Prefix the folder with the URL's prePath.

Target Milestone: --- → 162 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/6ba475dcc59f
Include the server in the EnigmailURIs.msgIdentificationFromUrl() check. r=kaie

Status: ASSIGNED → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Regressions: 2091846
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: