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-7101
Arbitrary Code Execution (ACE) Vulnerability
Vulnerability details
- Score
- 7.8
- Severity
- high
CVSS 3.1 · CISA-ADP
Vector string
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HDescription
Spreadsheet::ParseExcel version 0.65 is a Perl module used for parsing Excel files. Spreadsheet::ParseExcel is vulnerable to an arbitrary code execution (ACE) vulnerability due to passing unvalidated input from a file into a string-type “eval”. Specifically, the issue stems from the evaluation of Number format strings (not to be confused with printf-style format strings) within the Excel parsing logic.
CVE ProgramExploit source choices
1 sourceBarracuda ESG Spreadsheet::ParseExcel Arbitrary Code Execution
2023-12-24barracuda_esg_spreadsheet_rce.rb