OpenPGP cache can reuse decrypted plaintext across IMAP accounts with colliding folder and UID
Categories
(MailNews Core :: Security: OpenPGP, defect)
Tracking
(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
INBOXand message UID41 - A contained the decrypted sentinel
A_SECRET_7F4E9C - B contained the independent sentinel
B_PUBLIC_2A91D0
Steps:
- Start Thunderbird 159.0 with the clean temporary test profile.
- Configure both loopback IMAP accounts.
- Import the synthetic OpenPGP fixture key.
- Open message A and wait for OpenPGP processing to complete.
- Confirm that A displays
A_SECRET_7F4E9Cand the protected subjectA_PROTECTED_SUBJECT. - Within ten seconds, open message B.
- Wait for B's OpenPGP/MIME processing to complete.
- Inspect B's active message URI, displayed body, protected subject, cryptographic status, and MIME output.
- Select Reply-to-Sender while B is active and inspect the recipient, subject, and quoted body of the unsent draft.
- Close the draft without saving or sending it.
- 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_7F4E9Cinstead 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.
| Assignee | ||
Comment 1•25 days ago
|
||
Not really a sec issue. It's a small correctness bug though.
| Assignee | ||
Comment 2•25 days ago
|
||
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.
| Assignee | ||
Updated•12 days ago
|
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/6ba475dcc59f
Include the server in the EnigmailURIs.msgIdentificationFromUrl() check. r=kaie
Description
•