medium CVSS 5.4 EPSS 0.30%

CVE-2026-47730·PHP vulnerability

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.

Severity
medium
Software
PHP
Fixed in
3.26.0
Published

How likely is exploitation

FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at 0.30% — higher than 22% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.

Affected versions

From: 3.0.0

Until: 3.26.0

Fixed in: 3.26.0

How to fix this CVE

Update PHP and the Twig templating engine to version 3.26.0 or later to address an HTML injection vulnerability in the profiler output component. The vulnerability allows attackers to inject malicious HTML content through unescaped template and profile names that appear in profiler dumps. Apply the security patch immediately if you use Twig's profiling features in development or production environments.

sudo dnf update php php-pecl-twig

Defensia detects this vulnerability

WAF mitigation (if patching is not yet possible)

Add this rule to your WAF to block exploitation attempts while you schedule the patch.

Implement HTML encoding/escaping rules on any endpoint that outputs profiler data. Configure WAF rules to block or sanitize requests with suspicious characters (<, >, ", ', &) in template or profile name parameters passed to profiling endpoints.

How to check if you are affected

  1. Check the installed Twig version by running: php -r "echo phpversion('twig');" or grep -i 'twig' /composer.lock | grep -A2 '"version"'
  2. Verify if the profiler is enabled in your PHP/Twig configuration: grep -r 'Profiler\|profiler' config/ src/ --include='*.php' | grep -v test
  3. Search web server logs for requests to profiler endpoints (typically /_profiler or similar): grep -i '_profiler\|profile' /var/log/apache2/access.log /var/log/nginx/access.log
  4. Confirm the patch by running php -r "echo 'Twig version: ' . (class_exists('Twig\\Profiler\\Dumper\\HtmlDumper') ? 'present' : 'not found');" and verify version >= 3.26.0 with composer show twig/twig

FAQ

What is CVE-2026-47730?

This is an HTML injection vulnerability in Twig's profiler output component that fails to escape template and profile names before rendering them in HTML. An attacker can craft malicious template or profile names to inject arbitrary HTML/JavaScript that executes in a browser viewing the profiler dump.

Is CVE-2026-47730 being actively exploited?

No, according to CISA's Known Exploited Vulnerabilities (KEV) database, this vulnerability is not currently being actively exploited in the wild, and no public exploit code is available.

What versions of PHP are affected by CVE-2026-47730?

Twig versions 3.0.0 through 3.25.x are affected. The vulnerability is fixed in Twig 3.26.0 and later. Check your installed Twig version independent of the PHP version, as Twig is often installed via Composer.

How do I check if my server is vulnerable to CVE-2026-47730?

Run `composer show twig/twig` to display the installed Twig version. If it is between 3.0.0 and 3.25.x, your server is vulnerable. Additionally, verify the profiler is enabled by checking for Twig\Profiler\Dumper\HtmlDumper usage in your codebase.

Does Defensia detect CVE-2026-47730?

Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Twig is installed on a monitored server and its version is below 3.26.0, CVE-2026-47730 will appear in your dashboard with remediation steps.

Related PHP CVEs

CVE-2026-39337CVSS 10ChurchCRM is an open-source church management system. Prior to 7.1.0, critical pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The "$dbPassword" variable is not sanitized. This vulnerability exists due to an incomplete fix for CVE-2025-62521. This vulnerability is fixed in 7.1.0.
CVE-2025-25174CVSS 10Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') vulnerability in beeteam368 BeeTeam368 Extensions beeteam368-extensions allows PHP Local File Inclusion.This issue affects BeeTeam368 Extensions: from n/a through <= 1.9.4.
CVE-2025-62521CVSS 10ChurchCRM is an open-source church management system. Prior to version 5.21.0, a pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The vulnerability exists in `setup/routes/setup.php` where user input from the setup form is directly concatenated into a PHP configuration template without any validation or sanitization. Any parameter in the setup form can be used to inject PHP code that gets written to `Include/Config.php`, which is then executed on every page load. This is more severe than typical authenticated RCE vulnerabilities because it requires no credentials and affects the installation process that administrators must complete. Version 5.21.0 patches the issue.
CVE-2025-47916CVSS 10Invision Community 5.0.0 before 5.0.7 allows remote code execution via crafted template strings to themeeditor.php. The issue lies within the themeeditor controller (file: /applications/core/modules/front/system/themeeditor.php), where a protected method named customCss can be invoked by unauthenticated users. This method passes the value of the content parameter to the Theme::makeProcessFunction() method; hence it is evaluated by the template engine. Accordingly, this can be exploited by unauthenticated attackers to inject and execute arbitrary PHP code by providing crafted template strings.
CVE-2024-5932CVSS 10The GiveWP – Donation Plugin and Fundraising Platform plugin for WordPress is vulnerable to PHP Object Injection in all versions up to, and including, 3.14.1 via deserialization of untrusted input from the 'give_title' parameter. This makes it possible for unauthenticated attackers to inject a PHP Object. The additional presence of a POP chain allows attackers to execute code remotely, and to delete arbitrary files.

References

Track CVEs across your fleet automatically

Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-47730. Free for 1 server.

Get started free