{"id":"CVE-2026-47730","aliases":["CVE-2026-47730","GHSA-2g2g-8p8h-fgwm"],"related":[],"kind":"vulnerability","state":"published","title":"Twig: XSS in profiler HtmlDumper via unescaped template and profile names","summary":"Twig is a template language for PHP. From 3.0.0 until 3.26.0, Twig\\Profiler\\Dumper\\HtmlDumper writes Profile::getTemplate() and Profile::getName() into HTML output without escaping, allowing attacker-controlled template or profile names to inject arbitrary HTML when a browser renders the profiler dump. This issue is fixed in version 3.26.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Twig is a template language for PHP. From 3.0.0 until 3.26.0, Twig\\Profiler\\Dumper\\HtmlDumper writes Profile::getTemplate() and Profile::getName() into HTML output without escaping, allowing attacker-controlled template or profile names to inject arbitrary HTML when a browser renders the profiler dump. This issue is fixed in version 3.26.0.","source":"cvelist"},{"lang":"en","text":"### Description\n\n`Twig\\Profiler\\Dumper\\HtmlDumper` writes `Profile::getTemplate()` and `Profile::getName()` straight into its HTML output without escaping:\n\n```php\nprotected function formatTemplate(Profile $profile, $prefix): string\n{\n    return \\sprintf('%s└ <span style=\"background-color: %s\">%s</span>', $prefix, self::$colors['template'], $profile->getTemplate());\n}\n```\n\nThe template name comes from the loader (the array key for `ArrayLoader`, a row id for a database-backed loader, etc.). When that name is attacker-controlled, the profiler dump emits arbitrary HTML, and any browser that renders it executes the injected markup. This is an output-encoding bug in profiler/debug tooling, not a sandbox escape.\n\n### Resolution\n\n`HtmlDumper` now runs both `Profile::getTemplate()` and `Profile::getName()` through `htmlspecialchars()` before inserting them into the HTML output.\n\n### Credits\n\nTwig would like to thank El Kharoubi Iosif for reporting the issue and Nicolas Grekas for fixing it.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Twig es un lenguaje de plantillas para PHP. Desde 3.0.0 hasta 3.26.0, Twig\\Profiler\\Dumper\\HtmlDumper escribe Profile::getTemplate() y Profile::getName() en la salida HTML sin escapar, permitiendo que nombres de plantillas o perfiles controlados por el atacante inyecten HTML arbitrario cuando un navegador renderiza el volcado del perfilador. Este problema está solucionado en la versión 3.26.0.","source":"nvd"}],"published":"2026-06-05T21:46:26.000Z","modified":"2026-10-24T22:10:00.210Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"rating","rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":">= 3.0.0, < 3.26.0","status":"affected"}],"vendor":"twigphp","product":"Twig","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.0.0","status":"affected","fixed":"3.26.0"}],"ecosystem":"Packagist","package":"twig/twig","purl":"pkg:composer/twig/twig","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"3.0.0","fixed":"3.26.0"}],"vendor":"symfony","product":"twig","cpe":"cpe:2.3:a:symfony:twig:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/twigphp/Twig/security/advisories/GHSA-2g2g-8p8h-fgwm","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/twigphp/Twig/commit/a5f6e8793e603ef34fa86aed2a72f9fbe0b43745","tags":["patch","x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/twigphp/Twig/releases/tag/v3.26.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/twig/twig/CVE-2026-47730.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/twigphp/Twig","tags":["package"],"sources":["ghsa"]},{"url":"https://symfony.com/cve-2026-47730","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-21T14:44:57.049Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-47730","url":"https://www.cve.org/CVERecord?id=CVE-2026-47730","licence":"CVE Terms of Use","modified":"2026-07-21T14:45:11.407Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2g2g-8p8h-fgwm","url":"https://github.com/advisories/GHSA-2g2g-8p8h-fgwm","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:07.469Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-47730","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-47730","licence":"Public domain","modified":"2026-10-24T22:10:00.210Z"}],"updatedAt":"2026-11-25T22:59:28.241Z","epss":{"score":0.00169,"percentile":0.06575,"date":"2026-12-02T12:00:21.000Z"}}