The vulnerability is a reflected XSS in the installation module of Subrion CMS. The user-provided dbuser, dbpwd, and dbname parameters are used to establish a database connection during the 'configuration' step of the installation process. The code for this is located in install/modules/module.install.php.
When a user submits the database configuration form, the application attempts to connect to the database using the provided credentials. If an error occurs during this process (e.g., invalid credentials), the error message from the MySQLi driver is included in the response sent back to the user.
The vulnerability exists because these error messages can contain the user-supplied dbuser or dbname values without proper HTML entity encoding. An attacker can submit a malicious script as the value for dbuser, for example. The mysqli_connect() function will fail, and the mysqli_connect_error() function will return an error message containing the attacker's script. This message is then rendered in the browser, executing the script in the context of the user's session.
The vulnerable code snippet is:
$link = @mysqli_connect(iaHelper::getPost('dbhost'), iaHelper::getPost('dbuser'), iaHelper::getPost('dbpwd'), '', iaHelper::getPost('dbport', 3306));
if (mysqli_connect_errno()) {
$error = true;
$message = 'MySQL server: ' . mysqli_connect_error() . '<br>';
}
And for dbname:
if (!$error && !mysqli_select_db($link, iaHelper::getPost('dbname'))) {
$error = true;
$message = 'Could not select database ' . iaHelper::_html(iaHelper::getPost('dbname')) . ': ' . mysqli_error($link);
}
While dbname is passed through iaHelper::_html(), the vulnerability report implies this is not sufficient. The primary vulnerability is with dbuser and dbpwd which are not sanitized before being part of the error message from mysqli_connect_error().
Since the vulnerable code is not within a defined function but in the global scope of the module.install.php script, a profiler would likely attribute the execution time to the script itself. Therefore, module.install.php is identified as the vulnerable component.