{"id":"CVE-2022-23614","aliases":["CVE-2022-23614","GHSA-5mv2-rx3q-4w2v"],"related":[],"kind":"vulnerability","state":"published","title":"Code injection in Twig","summary":"Twig is an open source template language for PHP. When in a sandbox mode, the `arrow` parameter of the `sort` filter must be a closure to avoid attackers being able to run arbitrary PHP functions. In affected versions this constraint was not properly enforced and could lead to code injection of arbitrary PHP code. Patched versions now disallow calling non Closure in the `sort` filter as is the case for some other filters. Users are advised to upgrade.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Twig is an open source template language for PHP. When in a sandbox mode, the `arrow` parameter of the `sort` filter must be a closure to avoid attackers being able to run arbitrary PHP functions. In affected versions this constraint was not properly enforced and could lead to code injection of arbitrary PHP code. Patched versions now disallow calling non Closure in the `sort` filter as is the case for some other filters. Users are advised to upgrade.","source":"cvelist"},{"lang":"en","text":"# Description\n\nWhen in a sandbox mode, the `arrow` parameter of the `sort` filter must be a closure to avoid attackers being able to run arbitrary PHP functions.\n\n# Resolution\n\nWe now disallow calling non Closure in the `sort` filter like we already did for some other filters.\n\n# Credits\n\nWe would like to thank Marlon Starkloff for reporting the issue and Fabien Potencier for fixing the issue.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Twig es un lenguaje de plantillas de código abierto para PHP. Cuando está en modo sandbox, el parámetro \"arrow\" del filtro \"sort\" debe ser un cierre para evitar que atacantes puedan ejecutar funciones PHP arbitrarias. En las versiones afectadas, esta restricción no era aplicada correctamente y podía conllevar a una inyección de código PHP arbitrario. Las versiones parcheadas ahora no permiten llamar a un no cierre en el filtro \"sort\" como es el caso de algunos otros filtros. Es recomendado a usuarios actualizar","source":"nvd"}],"published":"2022-02-04T22:25:11.000Z","modified":"2026-06-17T04:30:29.140Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"}],"cwes":["CWE-74","CWE-94"],"affected":[{"ranges":[{"version":">= 3.0.0, < 3.3.8","status":"affected"},{"version":">= 2.0.0, < 2.14.11","status":"affected"}],"vendor":"twigphp","product":"Twig","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.0.0","status":"affected","fixed":"2.14.11"}],"ecosystem":"Packagist","package":"twig/twig","purl":"pkg:composer/twig/twig","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"3.0.0","status":"affected","fixed":"3.3.8"}],"ecosystem":"Packagist","package":"twig/twig","purl":"pkg:composer/twig/twig","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.0.0","fixed":"2.14.11"},{"status":"affected","introduced":"3.0.0","fixed":"3.3.8"}],"vendor":"symfony","product":"twig","cpe":"cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"34"},{"status":"affected","version":"35"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"11.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-5mv2-rx3q-4w2v","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/twigphp/Twig/commit/22b9dc3c03ee66d7e21d9ed2ca76052b134cb9e9","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/twigphp/Twig/commit/2eb33080558611201b55079d07ac88f207b466d5","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/OTN4273U4RHVIXED64T7DSMJ3VYTPRE7/","tags":["vendor-advisory","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/PECHIY2XLWUH2WLCNPDGNFMPHPRPCEDZ/","tags":["vendor-advisory","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I2PVV5DUTRUECTIHMTWRI5Z7DVNYQ2YO/","tags":["vendor-advisory","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/SIGZCFSYLPP7UVJ4E4NLHSOQSKYNXSAD/","tags":["vendor-advisory","x-refsource-fedora","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://www.debian.org/security/2022/dsa-5107","tags":["third-party-advisory","vendor-advisory","web","x-refsource-debian","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-23614","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2022-23614.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/twigphp/Twig","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/I2PVV5DUTRUECTIHMTWRI5Z7DVNYQ2YO","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OTN4273U4RHVIXED64T7DSMJ3VYTPRE7","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PECHIY2XLWUH2WLCNPDGNFMPHPRPCEDZ","tags":["web"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/SIGZCFSYLPP7UVJ4E4NLHSOQSKYNXSAD","tags":["web"],"sources":["ghsa"]},{"url":"https://symfony.com/blog/twig-security-release-disallow-non-closures-in-the-sort-filter","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2025-04-23T15:56:43.403Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-23614","url":"https://www.cve.org/CVERecord?id=CVE-2022-23614","licence":"CVE Terms of Use","modified":"2025-04-23T19:08:27.990Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5mv2-rx3q-4w2v","url":"https://github.com/advisories/GHSA-5mv2-rx3q-4w2v","licence":"CC-BY-4.0","modified":"2024-02-16T08:18:54.981Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-23614","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-23614","licence":"Public domain","modified":"2026-06-17T04:30:29.140Z"}],"updatedAt":"2026-11-25T22:58:09.535Z","epss":{"score":0.08406,"percentile":0.951,"date":"2026-12-01T12:00:22.000Z"}}