Description
Dolibarr before 23.0.4 authorizes REST API document deletion against the wrong permission. Documents::delete() in htdocs/api/class/api_documents.class.php calls dol_check_secure_access_document() with the mode argument 'read' when handling DELETE /api/index.php/documents, while the sibling builddoc() path passes 'write', the correct mode for an operation that modifies stored data. An authenticated API user who holds only a read permission for a document-bearing module, for example societe:lire or facture:lire, and no create, write, delete or admin permission, therefore passes the check and can permanently delete that module's documents: third-party files, invoices, orders, proposals, project files and generated PDFs, with no recovery path. The call site is htdocs/api/class/api_documents.class.php:1276 in 23.0.3 and passes 'write' from 23.0.4 onward.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| Dolibarr | dolibarr | < 23.0.4 | 23.0.4 |
References
- Patch Commit patch
- https://github.com/Dolibarr/dolibarr product
- https://github.com/Dolibarr/dolibarr/blob/23.0.3/htdocs/api/class/api_documents.class.php#L1276 technical-description
- VulnCheck Advisory: Dolibarr before 23.0.4 Incorrect Authorization on REST API Document Deletion third-party-advisory