This module exploits CVE-2023-2868, a command injection vulnerability in Barracuda Email Security Gateway (ESG) appliances. The vulnerability exists in how the ESG processes TAR file attachments - filenames containing shell metacharacters (backticks) are passed directly to shell commands during extraction, allowing remote command execution. The exploit sends an email with a specially crafted TAR attachment where the filename contains a backtick-wrapped command. When the ESG processes this attachment, the command is executed as the mail processing user. Note: Payload execution may take 30-90 seconds after email delivery. Amavisd queues and processes attachments asynchronously. Affected versions: Barracuda ESG firmware prior to May 2023 patch. Payloads containing single quotes or backticks are incompatible with the injection mechanism. Use cmd/unix/generic with a custom CMD for specialized payload requirements.
Vulnerability
CVE-2023-2868
Remote Code injection in Barracuda Email Security Gateway
Vulnerability details
- Score
- 9.4
- Severity
- critical
CVSS 3.1 · Google
Vector string
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:LDescription
A remote command injection vulnerability exists in the Barracuda Email Security Gateway (appliance form factor only) product effecting versions 5.1.3.001-9.2.0.006. The vulnerability arises out of a failure to comprehensively sanitize the processing of .tar file (tape archives). The vulnerability stems from incomplete input validation of a user-supplied .tar file as it pertains to the names of the files contained within the archive. As a consequence, a remote attacker can specifically format these file names in a particular manner that will result in remotely executing a system command through Perl's qx operator with the privileges of the Email Security Gateway product. This issue was fixed as part of BNSF-36456 patch. This patch was automatically applied to all customer appliances.
CVE ProgramExploit source choices
2 sourcescfielding-r7/poc-cve-2023-2868 source repository