GHSA-rh42-6rj2-xwmc
## Summary The Twig sandbox used for invoice templates blocks certain sensitive `User` methods (password, TOTP secret, etc.) via a blocklist in `StrictPolicy::checkMethodAllowed()`. However, `getApiToken()` and `getPlainApiToken()` are not on the blocklist. An admin who creates an invoice template can embed calls to these methods, causing the bcrypt or sodium hashed API password of any user who generates an invoice using that template to be included in the rendered output. Only relevant for OnPremise installations with template upload activated. ## Background Kimai allows admins (`ROLE_ADMIN` and above) with the `manage_invoice_template` permission to create Twig-based invoice templates. These templates are rendered in a sandboxed Twig environment with `StrictPolicy` controlling which methods and properties are accessible. `StrictPolicy` explicitly blocks: ```php // src/Twig/SecurityPolicy/StrictPolicy.php:156 if (\in_array($lcm, [ 'getpassword', 'gettotpsecret', 'getplainpassword', 'getconfirmationtoken', 'gettotpauthenticationconfiguration' ], true)) { throw new SecurityNotAllowedMethodError(...); } ``` `getApiToken()` and `getPlainApiToken()` are **not** in this list and are freely callable. ## Vulnerable Code `StrictPolicy.php` — missing entries in the User method blocklist: ```php // Current ['getpassword', 'gettotpsecret', 'getplainpassword', 'getconfirmationtoken', 'gettotpauthenticationconfiguration'] // Should also include: 'getapitoken', 'getplainapitoken' ``` The invoice model passes a `User` object through `model.user`, accessible in any twig invoice template. ## Steps to Reproduce 1. Log in as an admin with the `manage_invoice_template` permission. 2. Create a new Twig invoice template (HTML or PDF) containing: ```twig API Token: {{ model.user.getApiToken() }} Plain Token: {{ model.user.getPlainApiToken() }} ``` 3. Save the template and set it as the default for a customer. 4. Log in as a regular user assigned to
Properties
- ghsa_id
- GHSA-rh42-6rj2-xwmc
- severity
- low
- summary
- Kimai leaks API Token Hash via Invoice Twig Template
- cvss_score
- 2
- cve_id
- GHSA-rh42-6rj2-xwmc
- cvss_vector
- CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:N/A:N
- is_ghsa_only
- true
- ghsa_published
- 2026-04-14T01:06:25Z
- source_url
- https://github.com/advisories/GHSA-rh42-6rj2-xwmc
- ghsa_updated
- 2026-04-14T01:06:27Z
Related Entities (4)
VULNERABLE_TO (1)
AFFECTS (1)
HAS_WEAKNESS (1)
REPORTED_BY (1)
Explore deeper with Ninja Signal's threat intelligence graph