Read the docs
TI-2024-39038 Aliases GHSA-534c-hcr7-67jg

Kimai has an XXE Leading to Local File Read

Priority LOW 38CWE-1395Published · Updated

Key facts

Attack vector
—
Privileges required
—
User interaction
—
Attack complexity
—
Impact type
—
Confidentiality · integrity · availability
—
Fix status
Fixed

No CVSS vector from any source. Fix status from GitHub.

Summary

### Summary Kimai uses [PHPSpreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) for importing and exporting invoices. Recently, a [CVE](https://github.com/PHPOffice/PhpSpreadsheet/security/advisories/GHSA-ghg6-32f9-2jp7) was identified in PHPSpreadsheet, which could lead to an XXE vulnerability. ### Details Exploitation requires an Administrator account, allowing the upload of an `XLSX` template containing the payload. The vulnerability is triggered by the following code snippet: ```php // https://github.com/kimai/kimai/blob/b1903ba18359be16dd32ea9c40377c486498f082/src/Invoice/Renderer/AbstractSpreadsheetRenderer.php#L41 public function render(InvoiceDocument $document, InvoiceModel $model): Response { $spreadsheet = IOFactory::load($document->getFilename()); $worksheet = $spreadsheet->getActiveSheet(); $entries = $model->getCalculator()->getEntries(); $sheetReplacer = $model->toArray(); $invoiceItemCount = \count($entries); if ($invoiceItemCount > 1) { $this->addTemplateRows($worksheet, $invoiceItemCount); } } ``` The `IOFactory::load` function utilizes `simplexml_load_string`, which has previously been demonstrated to be vulnerable to XXE attacks. While this is not directly an XXE in Kimai, it does however impact the latest stable version. ### PoC By uploading a malicious `XLSX` template, the payload will be triggered every time an invoice is generated. ```xml <?xml version="1.0" encoding='UTF-7' standalone="yes"?> +ADw-!DOCTYPE foo [ <!ENTITY % xxe SYSTEM "php://filter/......." > %xxe;]>..... ``` For a better a visibility, I will upload both a: - Malicious template sample for testing - An exported invoice, showing the contents of target file during the export. ### Impact Local File Read / RCE in edge cases where `phar://` can be utilized with [gadget chains](https://github.com/ambionics/phpggc) . [export.xlsx](https://github.com/user-attachments/files/16803913/export.xlsx) [sample_template.xlsx](https://github.com/user-attachments/files/16803916/sample_template.xlsx)

Why it matters now

Fix Fixed kimai/kimai (Packagist): 2.21.0

SSVC decision points

Not available: CISA has not published SSVC decision points for this record.

Affected products

VendorProductAffected versionsFixed inStatusSource
—kimai/kimai (Packagist)before 2.21.02.21.0Patch availableGHSA-534c-hcr7-67jg
  • kimai/kimai (Packagist) Vendor— Affected before 2.21.0 Fixed in 2.21.0 Patch available GHSA-534c-hcr7-67jg

Remediation

  • Fix · GHSA-534c-hcr7-67jg kimai/kimai (Packagist) Fixed in 2.21.0 Advisory →

Timeline

  1. 2026-10-03 Threatist record created from GHSA-534c-hcr7-67jg

References

Sources

This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences