# CVE-2026-40479: Kimai has Stored XSS via Incomplete HTML Attribute Escaping in Team Member Widget

Source: https://junglewise.ai/threats/cve-2026-40479-kimai-has-stored-xss-via-incomplete-html-attribute-escaping-in  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-15. Updated: 2026-05-11  
License: CC BY 4.0 with a link back

CVE-2026-40479 · Severity: medium · CVSS 5.4 · Published 2026-04-15

### Summary
The client-side `escapeForHtml()` function in `KimaiEscape.js`, introduced in commit `89bfa82c` (#2959) to fix a JavaScript XSS vulnerability, only escapes `<`, `>`, and `&` but does not escape `"` (double quote) or `'` (single quote). When user-controlled data (profile alias) is placed in an HTML attribute context (`title="__DISPLAY__"`) via the team member form prototype and rendered through `innerHTML`, the missing quote escaping allows HTML attribute injection, resulting in Stored XSS.

### Details
Incomplete security patch. The `escapeForHtml()` function was meant to prevent XSS but missed quote characters, which are critical for HTML attribute context escaping.

**Vulnerable code** — `assets/js/plugins/KimaiEscape.js:29-33`:
```javascript
const tagsToReplace = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    // MISSING: '"': '&quot;'
    // MISSING: "'": '&#039;'
};
```

**Affected code files**:
- `assets/js/plugins/KimaiEscape.js:24-38` — incomplete escape function
- `assets/js/forms/KimaiTeamForm.js:77,86` — replacement + innerHTML
- `templates/macros/widgets.html.twig:126` — `title="{{ tooltip }}"` in avatar macro
- `templates/form/blocks.html.twig:104` — `{{ widgets.avatar('__INITIALS__', '__COLOR__', '__DISPLAY__') }}`

### PoC
[poc.zip](https://github.com/user-attachments/files/26537515/poc.zip)

Please extract the uploaded compressed file before proceeding

1. ./setup.sh
2. ./poc_xss.sh

<img width="751" height="155" alt="스크린샷 2026-04-07 오후 9 06 27" src="https://github.com/user-attachments/assets/c09a23fb-f60b-49dd-9018-8c723e35b4c4" />

### Impact
- Stored XSS: payload persists in the database (user alias field)
- Privilege escalation: ROLE_USER injects XSS that executes in ROLE_ADMIN/ROLE_SUPER_ADMIN browser session

Technologies: [kimai/kimai (Packagist)](https://junglewise.ai/threats/technologies/kimai-kimai). Vendors: [Packagist](https://junglewise.ai/threats/vendors/packagist).

## Quick answers

**Is CVE-2026-40479 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40479 being exploited in the wild.

**How severe is CVE-2026-40479?** Medium severity, with a CVSS score of 5.4, published 15 April 2026.

**Which products and versions are affected?** kimai/kimai (Packagist) < 2.53.0, ECOSYSTEM:introduced=0,fixed=2.53.0.

**Is there a fix for CVE-2026-40479?** Yes. kimai/kimai (Packagist): upgrade to 2.53.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**Am I affected by CVE-2026-40479?** Check whether you run kimai/kimai (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- kimai/kimai (Packagist): upgrade to 2.53.0 or later

  ```sh
  composer require kimai/kimai:^2.53.0
  ```


## Affected products

- kimai/kimai (Packagist) < 2.53.0, ECOSYSTEM:introduced=0,fixed=2.53.0

## Identifiers

- CVE-2026-40479
- GHSA-g82g-m9vx-vhjg

## References

- [https://github.com/kimai/kimai/security/advisories/GHSA-g82g-m9vx-vhjg](https://github.com/kimai/kimai/security/advisories/GHSA-g82g-m9vx-vhjg)
- [https://github.com/kimai/kimai/pull/2959](https://github.com/kimai/kimai/pull/2959)
- [https://github.com/kimai/kimai/releases/tag/2.53.0](https://github.com/kimai/kimai/releases/tag/2.53.0)
- [https://api.github.com/repos/kimai/kimai/security-advisories/GHSA-g82g-m9vx-vhjg](https://api.github.com/repos/kimai/kimai/security-advisories/GHSA-g82g-m9vx-vhjg)

## Related threats

- [Kimai missing authorization check in ExportController export templates](https://junglewise.ai/threats/cve-2026-52828-kimai-missing-authorization-check-in-exportcontroller-export)
- [Kimai 2FA bypass in REST API via session cookie replay](https://junglewise.ai/threats/cve-2026-52827-kimai-2fa-bypass-in-rest-api-via-session-cookie-replay)
- [Kimai improper authorization in rate edit endpoints](https://junglewise.ai/threats/cve-2026-52826-kimai-improper-authorization-in-rate-edit-endpoints)
- [Kimai improper authorization in Team assignment APIs](https://junglewise.ai/threats/cve-2026-52825-kimai-improper-authorization-in-team-assignment-apis)
- [Kimai insecure default APP_SECRET in Docker image](https://junglewise.ai/threats/cve-2026-52824-kimai-insecure-default-app-secret-in-docker-image)
