{"id":"CVE-2021-29440","aliases":["CVE-2021-29440","GHSA-g8r4-p96j-xfxc"],"related":[],"kind":"vulnerability","state":"published","title":"Twig allowing dangerous PHP functions by default","summary":"Grav is a file based Web-platform. Twig processing of static pages can be enabled in the front matter by any administrative user allowed to create or edit pages. As the Twig processor runs unsandboxed, this behavior can be used to gain arbitrary code execution and elevate privileges on the instance. The issue was addressed in version 1.7.11.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Grav is a file based Web-platform. Twig processing of static pages can be enabled in the front matter by any administrative user allowed to create or edit pages. As the Twig processor runs unsandboxed, this behavior can be used to gain arbitrary code execution and elevate privileges on the instance. The issue was addressed in version 1.7.11.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nTwig processing of static pages can be enabled in the front matter by any administrative user allowed to create or edit pages. \nAs the Twig processor runs unsandboxed, this behavior can be used to gain arbitrary code execution and elevate privileges on the instance.\n\n### Patches\n\nThe issue was addressed by preventing dangerous functions from being called in Twig templates. A configuration option has been added to manually allow arbitrary PHP functions (`system.twig.safe_functions`) and filters (`system.twig.safe_filters`). \n\nFutures major versions of Grav may disable this functionality by default. \n\n### Workarounds\n\nBlocking access to the `/admin` path from untrusted sources will reduce the probability of exploitation. \n\n### References\n\n- https://portswigger.net/research/server-side-template-injection\n- https://blog.sonarsource.com/grav-cms-code-execution-vulnerabilities\n\n### For more information\n\nIf you have any questions or comments about this advisory, you can contact:\n  - The original reporters, by sending an email to vulnerability.research [at] sonarsource.com;\n  - The maintainers, by opening an issue on this repository.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Grav es una plataforma web basada en archivos.&#xa0;El procesamiento de Twig de páginas estáticas puede ser habilitado en la materia inicial por cualquier usuario administrativo autorizado para crear o editar páginas.&#xa0;Como el procesador Twig se ejecuta sin sandbox, este comportamiento puede ser usado para obtener una ejecución de código arbitraria y elevar los privilegios en la instancia.&#xa0;El problema se solucionó en la versión 1.7.11","source":"nvd"}],"published":"2021-04-13T19:55:13.000Z","modified":"2026-06-17T03:47:38.757Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:H","score":8.4,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","score":7.2,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:S/C:P/I:P/A:P","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 1.7.11","status":"affected"}],"vendor":"getgrav","product":"grav","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.7.11"}],"ecosystem":"Packagist","package":"getgrav/grav","purl":"pkg:composer/getgrav/grav","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.7.11"}],"vendor":"getgrav","product":"grav","cpe":"cpe:2.3:a:getgrav:grav:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/getgrav/grav/security/advisories/GHSA-g8r4-p96j-xfxc","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://packagist.org/packages/getgrav/grav","tags":["product","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"http://packetstormsecurity.com/files/162987/Grav-CMS-1.7.10-Server-Side-Template-Injection.html","tags":["exploit","third-party-advisory","vdb-entry","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://blog.sonarsource.com/grav-cms-code-execution-vulnerabilities","tags":["exploit","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29440","tags":["advisory"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-29440","url":"https://www.cve.org/CVERecord?id=CVE-2021-29440","licence":"CVE Terms of Use","modified":"2024-08-03T22:02:51.882Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-g8r4-p96j-xfxc","url":"https://github.com/advisories/GHSA-g8r4-p96j-xfxc","licence":"CC-BY-4.0","modified":"2026-05-04T08:45:55.155Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-29440","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-29440","licence":"Public domain","modified":"2026-06-17T03:47:38.757Z"}],"updatedAt":"2026-11-25T22:58:00.802Z","epss":{"score":0.29896,"percentile":0.98237,"date":"2026-12-01T12:00:22.000Z"}}