Fix OS command injection in swatchrc dosnmp() (CVE-2026-73570) - #332
Open
mgamboa wants to merge 2 commits into
Open
Fix OS command injection in swatchrc dosnmp() (CVE-2026-73570)#332mgamboa wants to merge 2 commits into
mgamboa wants to merge 2 commits into
Conversation
Replace the backtick shell string in dosnmp() with a list-form system(@cmd) call. The previous construction interpolated parsed log fields ($args{SERVICE}) directly into a /bin/sh command line, allowing unauthenticated remote command execution as the zimbra user via log injection through SMTP-supplied strings. The list-form call passes every argument directly to execvp() without any shell interpretation, preserving identical SNMP trap behavior. Validated in production on two independent ZCS 10.1.20 FOSS servers (RHEL 9): byte-identical patched configuration across hosts, swatchdog compiles cleanly, watchers stable, SNMP notification path exercised end-to-end. Note: the vulnerable template is still shipped by current GA builds; a 10.1.5 -> 10.1.20_GA_0326.RHEL9_64_20260825120723 upgrade regenerated the exploitable configuration on the day of this writing. Signed-off-by: Mario Gamboa Pang <mario.gamboa@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix OS command injection in
swatchrcdosnmp()(CVE-2026-73570)Summary
This PR replaces the backtick shell-string construction inside the
dosnmp()subroutine ofrpmconf/Conf/swatchrcwith a list-formsystem(@cmd)call, eliminating OS command injection through parsed log fields.Vulnerability
The vulnerable line interpolated
$args{SERVICE}— a field parsed out of matched syslog lines by swatchdog'swatchforrules — directly into a double-quoted backtick expression:`$snmptrap $snmpsvctrap $snmpsvcname s $args{SERVICE} $snmpsvcstatus i $statuses{$args{STATUS}}`Perl passes backtick content to
/bin/sh, so any shell metacharacters surviving in the field are executed with the privileges of thezimbrauser.Because
postfix/smtpdlogs attacker-controlled SMTP dialog strings verbatim to/var/log/zimbra.log— the same stream swatchdog parses — an unauthenticated attacker with reachability to TCP/25 can forge log lines that satisfy the service-change watch rules and populate$args{SERVICE}with arbitrary shell payloads. This yields unauthenticated RCE. Notably, exploitation does not require SNMP to be configured or functional: both compromised environments observed had no trap receiver at all.This is tracked as CVE-2026-73570 and has been actively exploited in the wild. Full technical details were reported to security@zimbra.com per the Responsible Disclosure Policy.
Upgrade regression
The vulnerable template is still shipped by current GA builds. During a real-world upgrade from
10.1.5_GAto10.1.20_GA_0326.RHEL9_64_20260825120723performed on 2026-08-25, both/opt/zimbra/conf/swatchrcand/opt/zimbra/conf/swatchrc.inwere regenerated with the exploitable line still present, requiring an out-of-band emergency re-patch. This fix ensures future builds and upgrades ship a safe template.The fix
A list-form
system(@cmd)bypasses the shell entirely (execvp()semantics), so no argument can introduce metacharacters while producing byte-for-byte equivalentsnmptrapinvocations.Validation
Validated in production on two independent ZCS FOSS servers (RHEL 9, single-server installs):
md5: a94195b75831fa41840cfd42b10e79c9of the patched line).dosnmp();snmptrapreceives well-formed arguments).Related observation
rpmconf/Conf/auditswatchrcinterpolates unvalidated parsed fields ($1,$2= IP/account from auth-failure log lines) intoexec /bin/echo "..."actions. swatchdog executes these through the shell as well; a similar hardening pass there would close the same bug class for brute-force notification paths.