GHSA-PQ2V-P84W-89VJ
Incomplete fix for GHSA-8737: eTemplate Widget::expand_name() eval sanitizer bypassed via ${} interpolation (authenticated RCE)
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-PQ2V-P84W-89VJ divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
[HIGH] Incomplete fix for GHSA-8737 — `Widget::expand_name()` eval sanitizer bypassed via `${}` interpolation (authenticated RCE)
- CWE: CWE-95 Improper Neutralization of Directives in Dynamically Evaluated Code (Eval Injection); CWE-94.
- CVSS v3.1: `AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H` = 7.2 High (standalone, admin-privileged).
- Affected component: `api/src/Etemplate/Widget.php::expand_name()` line 720.
- Relationship: Incomplete remediation of GHSA-8737-2x9g-xjj7 (patched 26.4.20260413). The
## Summary
GHSA-8737 reported OS RCE because eTemplate widget attribute values are expanded through a PHP
`eval()` and backticks execute shell commands. The applied fix escapes double quotes and **strips
backticks**:
// api/src/Etemplate/Widget.php:720
eval('$name = "' . strtr($name, ['"' => '\\"', '`' => '']) . '";');This is insufficient. PHP double-quoted strings also perform **`${expr}` and `{$expr}`
interpolation**, which executes arbitrary PHP — with no backtick and no double quote required. A
template attribute value of `${system('id')}` (or `${file_put_contents(...)}`, `${phpinfo()}`) runs
that code when the widget is rendered. The eval branch fires for any attribute value containing `$`
(`Widget.php:706`), which is exactly the template feature the sanitizer was meant to keep safe.
## Reachability
Identical to GHSA-8737: an authenticated administrator (VFS write access to the `/etemplates`
mount) uploads/edits a `.xet` template. `Template::relPath()` (`api/src/Etemplate/Widget/Template.php:161-188`)
prefers the VFS `/etemplates` mount over the on-disk template, so an attacker-supplied `.xet` is
loaded. During expansion, `expand_name()` is invoked on widget attribute values / `id` / `type`
(`Widget.php:231,617,625-626,655`); any value containing `$` reaches line 720's `eval`. The
`${...}` payload executes.
Guard analysis:
- `strtr(['"' => '\\"'])` — escapes double quotes. Bypassed: `${...}` payloads use single quotes
or no quotes (`${phpinfo()}`, `${system('id')}`).
- `strtr(['`' => ''])` — strips backticks. Bypassed: `${}`/`{$}` interpolation needs no backtick.
- `error_reporting(0)` + `try/catch(\Throwable)` — only suppresses/《catches》 errors; valid payloads
are not errors, they execute before any throw.
## Root cause
Using `eval()` on a double-quoted string as a template-expansion mechanism. Character blocklisting
(quotes, backticks) cannot make `eval` safe because PHP string interpolation (`${}`, `{$}`) is itself
a code-execution construct.
## Impact
Arbitrary PHP execution → OS command execution in the web server context (confirmed: `system()`,
arbitrary file write). Full server compromise.
## Preconditions
- Admin-level VFS write to `/etemplates` (same as GHSA-8737). With EGW-001, any authenticated user
can first become admin, making this a non-admin → RCE chain.
## Evidence
- `api/src/Etemplate/Widget.php:703-728` — `expand_name`; eval branch on `strpos($name,'$')`; line 720 sanitizer.
- `api/src/Etemplate/Widget/Template.php:137,161-188` — VFS `/etemplates` preferred over filesystem.
## Proof of Concept (safe, local; benign sentinel)
`scratchpad/evaltest2.php` runs the exact production sanitizer on attacker payloads (PHP 8.4):
- `${system('echo RCE_SENTINEL_$((21*2))')}` → prints `RCE_SENTINEL_42` (command executed).
- `${file_put_contents('/tmp/egw_xet_rce_proof.txt','pwned-by-expand_name')}` → sentinel file created.
- `${phpinfo()}` → `phpinfo()` executed.
Backtick payload `` `id` `` is neutralised (confirming the partial fix), while `${}` payloads execute —
demonstrating the bypass. No destructive payload used.
## Adversarial re-read
- *Does `error_reporting(0)`/catch stop execution?* No — the payload is syntactically valid; it runs
inside `eval` before returning; `system`/`file_put_contents` side effects already happened. Proven.
- *Is `${}` interpolation still active on modern PHP?* Simple `"${var}"` is deprecated in 8.2+, but
the code-executing forms used here evaluate the expression to produce a variable name and still run
on PHP 8.4 (empirically confirmed on 8.4.5). Even under future removal, `{$}` complex syntax and
other interpolation vectors remain.
- *Is the reachability real post-fix?* Yes — the fix changed only the sanitizer, not the eval or the
`/etemplates` load path; both are unchanged in this tree.
- Result: no concrete blocker. CONFIRMED (incomplete fix).
## Remediation
Eliminate `eval` from `expand_name`. Replace with an explicit, non-eval expander that only resolves
the documented tokens (`$row`, `$col`, `$cont[...]`, `$row_cont`, etc.) via `str_replace`/`preg`
against an allowlist, or a proper templating primitive. At minimum, reject any `$name` containing
`${`, `{$`, or `\` before expansion — but a real parser is the correct fix.
## Confidence
High — production sanitizer reproduced verbatim; RCE observable fired on PHP 8.4.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistegroupware/egroupware |
Corregida | 23.1.20260710, 26.7.20260710 | — | — |
23.1.2026071026.7.20260710Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/EGroupware/egroupware/security/advisories/GHSA-pq2v-p84w-89vjLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
