GHSA-rh42-6rj2-xwmc: Kimai/kimai Kimai Leaks API Token Hash Vulnerability

LOW
CVSS 2.0
CWE-184
Published
Advisory Summary

GHSA-rh42-6rj2-xwmc is a LOW (CVSS 2.0) kimai leaks api token hash vulnerability (CWE-184: Incomplete List of Disallowed Inputs) affecting Kimai/kimai libraries in the Packagist ecosystem. The issue involves kimai leaks api token hash via invoice twig template. Remediation is available by upgrading affected packages to version 2.53.0.

GHSA-rh42-6rj2-xwmc at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rh42-6rj2-xwmc
Severity LOW
CVSS v3.1 Base Score 2.0
CWE Classification CWE-184: Incomplete List of Disallowed Inputs
Affected Product Kimai/kimai
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 2.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-rh42-6rj2-xwmc

To remediate this vulnerability, upgrade all affected Kimai/kimai dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

kimai/kimai fixed: 2.53.0
Upgrade kimai/kimai to 2.53.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for kimai/kimai

How to Check if You Are Affected

To determine whether your application is affected by GHSA-rh42-6rj2-xwmc, inspect your project dependencies for Kimai/kimai:

inspect dependencies for kimai/kimai

Analyze the terminal output to locate any version of Kimai/kimai in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.53.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-184: Incomplete List of Disallowed Inputs, where the product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete. In Kimai/kimai, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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 that customer and generate an invoice. 5. Observe that the rendered invoice contains the user's API token in plaintext. ## Impact An admin can silently embed token-exfiltration code in a shared invoice template. Every user who subsequently generates an invoice using that template will have their hashed API token leaked into the invoice output. - API passwords are [deprecated since April 2024](https://www.kimai.org/en/changelog/2024/cloud-update-104) and not in wide use anymore (especially by new users) - The function `getPlainApiToken()` does NEVER return any data - The function `getApiToken()` might return a bcrypt or sodium hashed API password, if the user (who created the invoice) has configured one - this cannot be used, but needs to be cracked using rainbow tables - The cloud does not allow Twig template upload, this is only relevant for OnPremise installations with template upload activated ## Fix The SecurityPolicy was changed to exclude methods that contains certain trigger words instead of using the hard-coded list, see https://github.com/kimai/kimai/pull/5878 This disables access to both the `getApiToken()` and `getPlainApiToken()` function.

GHSA-rh42-6rj2-xwmc Affected Kimai/kimai Versions

1 component(s)
Fixed Versions:
2.53.0
Product / Package Ecosystem Affected Versions Fixed Version
kimai/kimai
Packagist
< 2.53.0
2.53.0

References

Frequently Asked Questions

What is GHSA-rh42-6rj2-xwmc?
GHSA-rh42-6rj2-xwmc is a security vulnerability in Kimai/kimai involving Kimai leaks API Token Hash via Invoice Twig Template under CWE-184: Incomplete List of Disallowed Inputs.
Which Kimai/kimai versions are affected?
Affected versions include releases prior to 2.53.0 across affected packages: kimai/kimai.
What version fixes GHSA-rh42-6rj2-xwmc?
Upgrading to 2.53.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is kimai/kimai affected?
Yes, kimai/kimai is affected in releases prior to 2.53.0. Upgrade your dependency to 2.53.0 or later.
What is the CVSS score of GHSA-rh42-6rj2-xwmc?
GHSA-rh42-6rj2-xwmc has a CVSS v3.1 base score of 2.0 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:N/A:N.
What CWE is associated with GHSA-rh42-6rj2-xwmc?
GHSA-rh42-6rj2-xwmc is classified under CWE-184: Incomplete List of Disallowed Inputs (The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete.).
How can I check Packagist dependencies for GHSA-rh42-6rj2-xwmc?
Run the dependency tree command: 'inspect dependencies for kimai/kimai'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rh42-6rj2-xwmc",
  "modified" : "2026-04-14T01:06:25Z",
  "published" : "2026-04-14T01:06:25Z",
  "aliases" : [ ],
  "summary" : "Kimai leaks API Token Hash via Invoice Twig Template",
  "details" : "## Summary\n\nThe 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.\n\nOnly relevant for OnPremise installations with template upload activated.\n\n## Background\n\nKimai 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.\n\n`StrictPolicy` explicitly blocks:\n\n```php\n// src/Twig/SecurityPolicy/StrictPolicy.php:156\nif (\\in_array($lcm, [\n    'getpassword',\n    'gettotpsecret',\n    'getplainpassword',\n    'getconfirmationtoken',\n    'gettotpauthenticationconfiguration'\n], true)) {\n    throw new SecurityNotAllowedMethodError(...);\n}\n```\n\n`getApiToken()` and `getPlainApiToken()` are **not** in this list and are freely callable.\n\n## Vulnerable Code\n\n`StrictPolicy.php` — missing entries in the User method blocklist:\n\n```php\n// Current\n['getpassword', 'gettotpsecret', 'getplainpassword', 'getconfirmationtoken', 'gettotpauthenticationconfiguration']\n\n// Should also include:\n'getapitoken', 'getplainapitoken'\n```\n\nThe invoice model passes a `User` object through `model.user`, accessible in any twig invoice template.\n\n## Steps to Reproduce\n\n1. Log in as an admin with the `manage_invoice_template` permission.\n2. Create a new Twig invoice template (HTML or PDF) containing:\n\n```twig\nAPI Token: {{ model.user.getApiToken() }}\nPlain Token: {{ model.user.getPlainApiToken() }}\n```\n\n3. Save the template and set it as the default for a customer.\n4. Log in as a regular user assigned to that customer and generate an invoice.\n5. Observe that the rendered invoice contains the user's API token in plaintext.\n\n## Impact\n\nAn admin can silently embed token-exfiltration code in a shared invoice template. Every user who subsequently generates an invoice using that template will have their hashed API token leaked into the invoice output. \n\n- API passwords are [deprecated since April 2024](https://www.kimai.org/en/changelog/2024/cloud-update-104) and not in wide use anymore (especially by new users)\n- The function `getPlainApiToken()` does NEVER return any data\n- The function `getApiToken()` might return a bcrypt or sodium hashed API password, if the user (who created the invoice) has configured one - this cannot be used, but needs to be cracked using rainbow tables\n- The cloud does not allow Twig template upload, this is only relevant for OnPremise installations with template upload activated\n\n## Fix\n\nThe SecurityPolicy was changed to exclude methods that contains certain trigger words instead of using the hard-coded list, see https://github.com/kimai/kimai/pull/5878 \n\nThis disables access to both the `getApiToken()` and `getPlainApiToken()` function.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "kimai/kimai"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.53.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.52.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/kimai/kimai/security/advisories/GHSA-rh42-6rj2-xwmc"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kimai/kimai/pull/5878"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kimai/kimai"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-184" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T01:06:25Z",
    "nvd_published_at" : null
  }
}