GHSA-8RGJ-G632-3QFP
Safe Mode Sandbox Bypass via Nested Callable in SafeCollection
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:L/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8RGJ-G632-3QFP divulgada · CVSS 3.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
The Twig sandbox proxy `SafeCollection` stripped callables from arguments at the top level only, using a single `is_callable($param)` check. A callable nested inside an array argument passed through unstripped. `Illuminate\Support\Collection::sortBy()` accepts an array of comparisons whose elements may themselves be callables and invokes them with two values from the collection. A Safe Mode template could therefore call `collect([$a, $b]).sortBy([[['Class', 'method']]])` to invoke an arbitrary `Class::method($a, $b)` with attacker-controlled string arguments. Chained with `File::put` as a gadget, the primitive could write a CMS template file containing a PHP code section directly to disk, bypassing the save-time Safe Mode check (which only runs through the Halcyon model layer, not against raw file writes), and execute on the next page render.
This issue only affects installations running with `cms.safe_mode` enabled. Safe Mode is a niche opt-in feature, primarily used for demo installations and multi-tenant or shared-editor scenarios where untrusted users are deliberately granted access to the CMS markup editor. In standard production deployments Safe Mode is off, backend access is restricted to trusted administrators, and a markup editor can already execute arbitrary PHP directly. The disclosure path closed here is the Safe Mode boundary itself, so installations without Safe Mode enabled are not exposed.
### Impact
- Arbitrary `Class::method($a, $b)` invocation from a Safe Mode Twig template, with the two arguments being attacker-controlled strings selected from the source collection.
- Chained with a string-string method such as `File::put`, this allows arbitrary file write under the web server identity, which can be parlayed into PHP code execution by writing a CMS template that carries a PHP code section.
- Requires `cms.safe_mode` to be enabled, and a backend user with CMS markup editing access who is not intended to be trusted as a full administrator.
- Not exploitable when Safe Mode is disabled.
### Patches
The vulnerability has been patched in v4.2.25. `SafeCollection` now strips callables from arguments recursively, walking nested arrays and nulling any callable found at any depth before forwarding the call to the underlying collection. The hybrid-method string-keep behaviour (allowing class-name strings as attribute lookups in methods such as `contains` and `groupBy`) is preserved.
### Workarounds
If upgrading immediately is not possible, restrict CMS markup editing access to fully trusted administrators only, the standard October CMS recommendation for any deployment.
### References
- Reported by repo4Chu
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistoctober/system |
Corregida | 4.2.25 | — | — |
4.2.25Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/octobercms/october/security/advisories/GHSA-8rgj-g632-3qfpLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
