This module exploits CVE-2023-7102, an arbitrary code execution vulnerability in Barracuda Email Security Gateway (ESG) appliances. The vulnerability exists in how the Amavis scanner processes Excel attachments using the Perl Spreadsheet::ParseExcel library. The library's Utility.pm contains an unsafe eval() that processes Excel Number format strings without validation. By crafting a malicious XLS file with a specially formatted Number format string containing Perl code, an attacker can achieve remote code execution when the ESG scans the email attachment. This module dynamically generates a minimal BIFF8 XLS file with the payload embedded in a FORMAT record using Rex::OLE. Payload constraints: no ']' (terminates format string) or single quotes (breaks Perl eval injection). This vulnerability was exploited in the wild by UNC4841 (China-nexus threat actor) starting November 2023. Barracuda deployed automatic patches on December 21, 2023. Affected versions: Barracuda ESG 5.1.3.001 through 9.2.1.001
Exploit database
Vulnerability
CVE-2023-7102
Remote Code Execution (RCE) Vulnerability
Vulnerability details
- Score
- 9.8
- Severity
- critical
CVSS 3.1 · NVD
Vector string
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HDescription
Use of a Third Party library produced a vulnerability in Barracuda Networks Inc. Barracuda ESG Appliance which allowed Parameter Injection.This issue affected Barracuda ESG Appliance, from 5.1.3.001 through 9.2.1.001, until Barracuda removed the vulnerable logic.
CVE ProgramExploit source choices
1 sourceBarracuda ESG Spreadsheet::ParseExcel Arbitrary Code Execution
2023-12-24barracuda_esg_spreadsheet_rce.rb