Symantec Web Gateway <= 5.2.2 (new_whitelist.php) OS Command Injection Vulnerability

• Software Link:

• Affected Versions:

Version, and Other versions might be affected.

• Vulnerability Description:

The vulnerable code is located in the /spywall/new_whitelist.php script:

	$isNew = $_POST['isNew'];
	$sid   = $_POST['sid'];
	$exceptions = array();
	$last_modified = time();
	/* validate input */

	if (!$sid && !isValidWhiteDomain($white_ip) && !isIpSubnet($white_ip)) {
		$errors['white_ip'] = 'Please enter a valid domain or IP address or IP/mask.';

The vulnerability exists because the validation checks may be bypassed by setting the ‘sid’ POST parameter to a value different from zero. In this way, even though the ‘white_ip’ POST parameter (assigned to the $white_ip variable) is not a valid domain or IP address, it will be passed to the add_whitelist() function as its $url parameter:

	function add_whitelist ($signature, $url, $whitelist, $ignore_auth, $restoreConfig = 0) {
		if (!isCiu()){
			if ($restoreConfig) {
				syscall("sudo /usr/local/bin/updateDB 2 1 $url $whitelist $ignore_auth [...]
			} else {
				syscall("sudo /usr/local/bin/updateDB 2 1 $url $whitelist $ignore_auth [...]

This can be exploited to inject and execute arbitrary OS commands with the privileges of the “root” user on the appliance. Successful exploitation of this vulnerability requires an user account with read-write permissions (POLICY_LEVEL).

• Solution:

Update to version 5.2.5.

• Disclosure Timeline:

[09/07/2016] – Vendor notified
[11/07/2016] – Vendor response
[09/09/2016] – Vendor asks to confirm this is fixed in version 5.2.5
[15/09/2016] – Feedback sent to the vendor
[05/10/2016] – Publication of vendor’s advisory:
[06/10/2016] – Publication of this advisory

• CVE Reference:

The Common Vulnerabilities and Exposures project (
has assigned the name CVE-2016-5313 to this vulnerability.

• Credits:

Vulnerability discovered by Egidio Romano.