cbcvebase.
CVE-2017-7692
published 2017-04-20

CVE-2017-7692: SquirrelMail 1.4.22 (and other versions before 20170427_0200-SVN) allows post-authentication remote code execution via a sendmail.cf file that is mishandled in…

PriorityP183high8.8CVSS 3.0
AVNACLPRLUINSUCHIHAH
ITWEXPLOITVulnCheck KEV
Exploited in the wild
EPSS
32.16%
98.1th percentile
SquirrelMail 1.4.22 (and other versions before 20170427_0200-SVN) allows post-authentication remote code execution via a sendmail.cf file that is mishandled in a popen call. It's possible to exploit this vulnerability to execute arbitrary shell commands on the remote server. The problem is in the Deliver_SendMail.class.php with the initStream function that uses escapeshellcmd() to sanitize the sendmail command before executing it. The use of escapeshellcmd() is not correct in this case since it doesn't escape whitespaces, allowing the injection of arbitrary command parameters. The problem is in -f$envelopefrom within the sendmail command line. Hence, if the target server uses sendmail and SquirrelMail is configured to use it as a command-line program, it's possible to trick sendmail into using an attacker-provided configuration file that triggers the execution of an arbitrary command. For exploitation, the attacker must upload a sendmail.cf file as an email attachment, and inject the sendmail.cf filename with the -C option within the "Options > Personal Informations > Email Address" setting.

Affected

4 ranges
VendorProductVersion rangeFixed in
oauth2-server_projectoauth2-server0 – 3.1.1
squirrelmailsquirrelmail
squirrelmailsquirrelmail>= 0 < 2:1.4.23~svn20120406-2+deb8u1build0.14.04.12:1.4.23~svn20120406-2+deb8u1build0.14.04.1
squirrelmailsquirrelmail>= 0 < 2:1.4.23~svn20120406-2+deb8u1ubuntu0.16.04.12:1.4.23~svn20120406-2+deb8u1ubuntu0.16.04.1

Detection & IOCsextracted from sources · hover to see the quote

filenamesendmail.cf
path/tmp/sqpoc
cookieSQMSESSID
url/src/options.php?optpage=personal
url/src/compose.php
  • Monitor for injection of the -C flag into the SquirrelMail 'Email Address' field (Options > Personal Information), which is used to supply an attacker-controlled sendmail.cf configuration file to sendmail.
  • Detect POST requests to /src/options.php?optpage=personal containing the -C parameter in the new_email_address field, which is the injection point for CVE-2017-7692 exploitation.
  • Detect the Webworm threat actor executing the LegalHackers CVE-2017-7692 PoC script (_1.sh) via nuclei or bash against webmail targets; look for nuclei scans combined with dirsearch activity from the same host.
  • Monitor outbound connections from SquirrelMail web servers to port 80 on 64.176.85[.]158, which was used as a Webworm proxy server hosting open-directory exploitation utilities.
  • Flag any sendmail.cf file uploaded as an email attachment in SquirrelMail, as this is the attacker-supplied configuration file used to trigger arbitrary command execution via the -C sendmail option.
  • The vulnerable code path is Deliver_SendMail.class.php initStream function; audit popen() calls in this file for unsanitised -f$envelopefrom arguments that allow whitespace-delimited parameter injection.
  • ·CVE-2017-7692 is only exploitable when SquirrelMail is configured to use sendmail as a command-line program; installations using SMTP delivery are not affected by this specific attack vector.
  • ·Exploitation requires prior authentication to SquirrelMail; unauthenticated attackers cannot trigger the RCE directly.
  • ·Red Hat Enterprise Linux 5 will not fix this issue; defenders on RHEL 5 should apply compensating controls rather than expecting a vendor patch.

CVSS provenance

nvdv3.08.8HIGHCVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
nvdv2.09.0CRITICALAV:N/AC:L/Au:S/C:C/I:C/A:C
ghsa9.1CRITICAL
osv8.8HIGH
vulncheck8.8HIGH
vendor_redhat8.8HIGH
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.