# CVE-2026-40187: Authenticated RCE via Malicious eTemplate Upload in EGroupware

> Authenticated administrators can execute arbitrary OS commands by uploading malicious eTemplate files due to unsafe PHP eval usage.

- **Severity:** High 8.6 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Jul 2026
- **Updated:** 20 Jul 2026
- **Also known as:** GHSA-8737-2x9g-xjj7

## What is CVE-2026-40187?

CVE-2026-40187 is a high-severity code injection vulnerability in egroupware, published on 20 Jul 2026. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

In egroupware version 26.0 and earlier, an authenticated administrator can achieve OS-level Remote Code Execution (RCE) by uploading a malicious eTemplate XML file (`.xet`) to the VFS `/etemplates` mount. The `Widget::expand_name()` method passes template widget attribute values directly into a PHP `eval()` call with only double-quote escaping applied - **backtick characters are not escaped**. In PHP, backticks inside a double-quoted `eval()` string execute shell commands. This allows an admin-level user to escalate from web application access to arbitrary OS command execution on the server.

Weakness: CWE-95 (Improper Neutralization of Directives in Dynamically Evaluated Code), CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

## Which versions are affected by CVE-2026-40187?

4 open source packages ship an affected version, including egroupware/egroupware.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `egroupware/egroupware` | Packagist | All versions | 23.1.20260601 |
| `egroupware/egroupware` | Packagist | All versions | 23.1.20260601 |
| `egroupware/egroupware` | Packagist | From 26.0.20251208 | 26.4.20260413 |
| `egroupware/egroupware` | Packagist | From 26.0.20251208 | 26.4.20260413 |

## How do I fix CVE-2026-40187?

Upgrade egroupware/egroupware to a fixed version for your release line: 23.1.20260601 or 26.4.20260413.

## Is CVE-2026-40187 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40187 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40187 and fix it if it is affected.

What it is: CVE-2026-40187 is a high-severity code injection vulnerability in egroupware, published on 20 Jul 2026. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-40187 exists.

Affected packages and fixed versions:
- egroupware/egroupware (Packagist): affected all versions; fixed in 23.1.20260601
- egroupware/egroupware (Packagist): affected all versions; fixed in 23.1.20260601
- egroupware/egroupware (Packagist): affected from 26.0.20251208; fixed in 26.4.20260413
- egroupware/egroupware (Packagist): affected from 26.0.20251208; fixed in 26.4.20260413

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40187/ (Markdown: https://insights.sbomify.com/CVE-2026-40187/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40187
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40187
- OSV: https://osv.dev/vulnerability/CVE-2026-40187

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40187/
Summaries are generated and may contain mistakes; the official description above is the record.
