Penetration Test Report (Cure53): Thunderbird enigmail report

Dr.-Ing. Mario Heiderich, Cure53
Bielefelder Str. 14
D 10709 Berlin
cure53.de · mario@cure53.de
Pentest-Report Thunderbird & Enigmail 09.2017
Cure53, Dr.-Ing. M. Heiderich, MSc. N. Krein, BSc. D. Weißer, BSc. F. Fäßler, MSc. N. Kobeissi,
DIpl.-Ing. A. Inführ, T.-C. Hong, Dr.-Ing. J. Magazinius
Index
Introduction
Scope
Attack Surface
Architectural Notes
Identified Vulnerabilities
TBE-01-002 Enigmail: Weak Parsing causes Confidentiality Compromise (Critical)
TBE-01-005 Enigmail: Replay of encrypted Contents leads to Plaintext Leak (High)
TBE-01-011 Thunderbird: RSS Feed vulnerable against Email Injection (High)
TBE-01-012 Thunderbird: RSS Local Path Leak via @-moz-document (Medium)
TBE-01-013 Thunderbird: RSS Local Path Leak via cid: Parsing Bug (Medium)
TBE-01-014 Thunderbird: JavaScript Execution via RSS in mailbox:// Origin (High)
TBE-01-015 Thunderbird: Decrypted PGP Blocks exposed via RSS Feeds (Critical)
TBE-01-017 Thunderbird: Multiple Hangs via malformed Headers (Medium)
TBE-01-021 Enigmail: Flawed parsing allows faked Signature Display (Critical)
Miscellaneous Issues
TBE-01-001 Enigmail: Insecure Random Secret Generation (Low)
TBE-01-003 Enigmail: Regular Expressions Exploitable for Denial of Service (Low)
TBE-01-004 Enigmail: Autocrypt Automatic Key Import (Info)
TBE-01-007 Thunderbird: JavaScript Execution via Reload Page Dialog (Low)
TBE-01-008 Enigmail: Default Keyserver configured without SSL (Info)
TBE-01-009 Thunderbird: Filename Spoofing for external Attachments (Info)
TBE-01-010 Thunderbird: DoS via invalid X-Mozilla-Draft-Info header (Low)
TBE-01-006 Thunderbird: Denial of Service via Link to .eml Attachment (Low)
TBE-01-016 Thunderbird: DoS via proprietary X-Mozilla-Cloud-Part Header (Low)
TBE-01-018 Thunderbird: Integer and Heap-Overflow in MIME-Body-Parsing (High)
TBE-01-019 Thunderbird: Integer Overflow in Attachment Code (High)
TBE-01-020 Thunderbird: Null Pointer Exception via SVG and Mailbox URI (Info)
Conclusions
Cure53, Berlin · 10/11/17 1/35
Dr.-Ing. Mario Heiderich, Cure53
Bielefelder Str. 14
D 10709 Berlin
cure53.de · mario@cure53.de
Introduction
“Software made to make email easier. Thunderbird is a free email application that’s easy
to set up and customize - and it’s loaded with great features!”
From https://www.mozilla.org/en-US/thunderbird/
“Enigmail adds OpenPGP message encryption and authentication to your email client. It
features automatic encryption, decryption and integrated key management functionality.
Enigmail is based on GnuPG (www.gnupg.org) for the cryptographic functions.”
From https://addons.mozilla.org/en-US/thunderbird/addon/enigmail/
This report documents the findings of a security assessment of Thunderbird with
Enigmail, carried out by Cure53 in September 2017. The tests yielded a total of twenty-
one security-relevant issues, including three “Critical”-level vulnerabilities.
It is worth noting that the project had very interesting origins and setup. Specifically,
publishing results of an earlier audit prompted Cure53 to propose a new collaboration.
The idea was well-received and eventually garnered necessary funding. To clarify, this
Cure53 assessment was a co-financed joint project of Mozilla's SOS (Secure Open
Source) Fund and Posteo e.K.. Both parties contributed to the test budget and had a say
regarding the scope.
Ultimately, the project was completed over the course of 24 days by a dedicated team of
eight Cure53 testers with varying skillsets and expertise. The main objective of this
assignment was to determine whether a particular combination of using Thunderbird with
the popular PGP Enigmail plugin translates to security or privacy issues. For this reason
the software compound was tested and the core focus of the audit was placed on
Thunderbird with Enigmail rather than standalone implementations of, for instance,
Thunderbird without the relevant plugin.
Prior to the beginning of the actual tests, the Cure53 testers liaised with the respective
development teams for Thunderbird and Enigmail. Briefings were held to exchange
information about the tested projects. It must be underlined that the scope of this joint
project was extremely extensive, meaning that certain decisions about selecting the
most important security aspects needed to be made. Given the time and budgetary
constraints, Cure53 opted for investigating key attack vectors, which signifies analyzing
the received emails, feed items and email attachments. In simple terms, Cure53 looked
at those channels and issues that an attacker could possibly use for reaching out to
potential victims. The main criterion was on the given realm’s potential to cause damage.
Cure53, Berlin · 10/11/17 2/35
Dr.-Ing. Mario Heiderich, Cure53
Bielefelder Str. 14
D 10709 Berlin
cure53.de · mario@cure53.de
By the above logic, the majority of work was invested into smaller source code audits,
review of all cryptographic implementations, and actual penetration testing with
maliciously modified emails, attachments, keys and RSS feeds. The Cure53 team
inspected publicly available sources, focusing primarily on the latest versions available.
During the test, Cure53 was in contact with Mozilla’s SOS and Posteo, though all
findings have been kept confidential until the documentation was fully ready for sharing
through this report.
As already noted, the project revealed a high prevalence of security problems within the
Thunderbird with Enigmail implementation. Among the twenty-two discoveries, as many
as nine constituted actual security vulnerabilities, with the remaining thirteen deemed as
general weaknesses. A major cause for concern relates to three issues being ranked
with the highest possible “Critical” severity in terms of their greatly severe security risks
and implications. Additional four issues were classified as “High”.
In the following sections, the report firstly sheds light on the attack surface and scope, as
well as provides some commentary on the architecture in place. Secondly, the document
furnishes a case-by-case discussions of findings, including relevant mitigation and fix
advice when applicable. Finally, the report delivers a broader verdict about the general
security situation encountered by the Cure53 team within the tested Thunderbird with
Enigmail compound.
Scope
• Thunderbird with Enigmail
◦ Cure53 worked with latest builds and sources
• Builds
◦ http://ftp.mozilla.org/pub/thunderbird/nightly/latest-comm-central/
◦ https://www.enigmail.net/index.php/en/download/nightly-build
Cure53, Berlin · 10/11/17 3/35
Dr.-Ing. Mario Heiderich, Cure53
Bielefelder Str. 14
D 10709 Berlin
cure53.de · mario@cure53.de
Attack Surface
The following items describe the attack surface Cure53 was concentrating on during this
test. Given the vast amount of code that both Enigmail and Thunderbird ship, it was
clearly impossible to conduct a full-scale code audit. The testing team instead
enumerated those attack channels that were deemed to be most interesting for real-life
attackers. These were subsequently examined in great detail.
• Incoming Emails with PGP signature / PGP encryption
◦ Can an attacker cause damage with an email sent to and received by a
victim?
◦ Can an attacker successfully target the signature parser or decryption
somehow?
◦ Can an attacker cause Command Line Injections, DoS or info leakage to
happen?
◦ Can an attacker cause crashes in Thunderbird or XSS/RCE in Enigmail?
• Incoming HTML emails
◦ Can an attacker cause damage with an email sent to a victim?
◦ Can an attacker smuggle in data that leaks HTTP requests?
◦ Can an attacker get 401/403 password dialogs to show?
◦ Can an attacker do nasty things with attachments? CRLF in file names,
Unicode, XSS via filename, XSS via preview/viewer, EML, MHTML, exotic
formats?
• Key Generation & Crypto Setup
◦ Is the handling of imported keys safe? Can an attacker cause damage here?
◦ Is the general key generation process safe enough by default?
◦ Is the random number generation well done and sound?
◦ Ca