CVE-2023-2868 — Barracuda Networks ESG Appliance Improper Input Validation Vulnerability

CVE-2023-2868

Barracuda ESG — Zero-Day TAR Filename OS Command Injection; UNC4841 (China-Nexus) Operated Undetected 8+ Months; Barracuda Recommended Full Appliance Replacement

What is the Barracuda Email Security Gateway?

Barracuda Email Security Gateway (ESG) is a hardware or virtual appliance deployed at the email perimeter to scan incoming and outgoing email for spam, malware, and phishing. It processes all organizational email — including attachments — before delivery to internal mail servers. ESG appliances are trusted network devices with deep access to email content, integration with internal mail infrastructure, and connectivity to both the internet and internal network. This privileged position makes ESG compromise ideal for persistent email surveillance, credential theft from processed email, and lateral movement into internal networks.

Overview

CVE-2023-2868 is a critical improper input validation vulnerability in Barracuda's ESG appliance that allows an unauthenticated remote attacker to inject OS commands via a malicious email attachment. China-nexus threat actor UNC4841 exploited it as a zero-day for over eight months — from at least October 2022 through May 2023 — conducting a global espionage campaign against government, defense, high-tech, and critical infrastructure organizations worldwide. The attack was so thoroughly embedded in compromised appliances that Barracuda made the unprecedented recommendation to physically replace all affected ESG hardware rather than attempt remediation.

Affected Versions

Product Status
Barracuda ESG appliances (versions 5.1.3.001 – 9.2.0.006) Patch deployed automatically; full appliance replacement recommended for compromised devices

Technical Details

CWE-20 (Improper Input Validation). The ESG processes incoming email attachments including .tar archives for malware scanning. A flaw in the filename handling code passes the filename from within a TAR archive unsanitized to a Perl qx{} operator (equivalent to backtick shell execution). An attacker who sends an email with a TAR attachment containing a specially crafted filename can inject arbitrary shell commands that execute when the ESG processes the attachment.

The attack requires no authentication and no user interaction — simply sending an email to any address handled by the ESG triggers the vulnerability as the appliance scans the incoming message. The injected commands execute with the ESG process's privileges, providing OS-level access to the appliance.

Discovery

UNC4841 had been operating undetected since October 2022. Barracuda's security team identified anomalous network traffic from ESG appliances in May 2023 and traced it to active compromise. Mandiant was engaged to investigate and attributed the campaign to UNC4841 — a China-nexus espionage group with a history of targeting email infrastructure for intelligence collection.

Exploitation Context

UNC4841's campaign represents one of the most significant email security appliance compromises documented. Key characteristics:

  • Global scale: Compromised ESG appliances in at least 16 countries across government, military, defense industrial base, high-tech, and critical infrastructure sectors
  • Intelligence priority: Specifically targeted email accounts of individuals involved in U.S.-China policy, Taiwan policy, Southeast Asian policy, and human rights
  • Persistent multi-stage implants: Installed custom malware families including SALTWATER (backdoored SMTP module), SEASPY (passive backdoor), and SEASIDE (reverse shell launcher) that survived Barracuda's patches
  • Deep persistence: Implants survived the automatic May 2023 patch — some devices required physical replacement to remediate

The recommendation to replace rather than patch was driven by the depth of firmware and OS-level compromise on affected appliances, where re-imaging was insufficient to guarantee removal of all backdoors.

Remediation

  1. If you have not already: replace any Barracuda ESG appliances that received the May 2023 indicator-of-compromise notification — software patching alone is insufficient for compromised devices.
  2. For organizations with compromised appliances: treat all email processed by the ESG during the October 2022 – May 2023 window as potentially intercepted; review for credential exposure, data theft, and lateral movement indicators.
  3. Review UNC4841 IOCs published by Mandiant and CISA to check for malware persistence on compromised ESG appliances and connected internal systems.
  4. Isolate any ESG appliance pending replacement from internal networks to prevent lateral movement via any remaining implants.
  5. After replacement: rotate all credentials accessible via the compromised ESG — email account passwords, LDAP/AD integration credentials, and any secrets stored in ESG configuration.

Key Details

PropertyValue
CVE ID CVE-2023-2868
Vendor / Product Barracuda Networks — Email Security Gateway (ESG) Appliance
NVD Published2023-05-24
NVD Last Modified2025-10-24
CVSS 3.1 Score9.4
CVSS 3.1 VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
SeverityCRITICAL
CWE CWE-20 find similar ↗
CISA KEV Added2023-05-26
CISA KEV Deadline2023-06-16
Known Ransomware Use No

CVSS 3.1 Breakdown

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
Low

Required Action

CISA BOD 22-01 Deadline: 2023-06-16. Apply updates per vendor instructions.

Timeline

DateEvent
2022-10UNC4841 begins exploiting CVE-2023-2868 as a zero-day against Barracuda ESG appliances worldwide
2023-05-19Barracuda detects anomalous ESG traffic and identifies the vulnerability
2023-05-20Barracuda deploys automatic remediation patch to all ESG appliances
2023-05-24CVE-2023-2868 published; Barracuda notifies affected customers
2023-05-26CISA adds to Known Exploited Vulnerabilities catalog
2023-06-06Barracuda takes unprecedented step: recommends all affected customers REPLACE their ESG appliances entirely
2023-06-16CISA BOD 22-01 remediation deadline
2023-08-29Mandiant publishes detailed UNC4841 attribution report covering worldwide espionage campaign