CVE-2024-35226 PHP Code Injection by malicious attribute in extends-tag in Smarty

High 7.3 Published Updated

Malicious template authors can inject PHP code via the extends-tag, allowing remote code execution on applications using the Smarty library.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2024-35226?

CVE-2024-35226 is a high-severity code injection vulnerability in smarty-php smarty, published on 28 May 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

Official description

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. In affected versions template authors could inject php code by choosing a malicious file name for an extends-tag. Sites that cannot fully trust template authors should update asap. All users are advised to update. There is no patch for users on the v3 branch. There are no known workarounds for this vulnerability.

Weakness: CWE-94

Which versions are affected by CVE-2024-35226?

4 open source packages ship an affected version, including smarty/smarty.

PackageAffectedFixed in
smarty/smarty PackagistFrom 3.0.04.5.3
smarty/smarty PackagistFrom 3.0.04.5.3
smarty/smarty PackagistFrom 5.0.05.1.1
smarty/smarty PackagistFrom 5.0.05.1.1

How do I fix CVE-2024-35226?

Upgrade smarty/smarty to a fixed version for your release line: 4.5.3 or 5.1.1.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2024-35226 being exploited?

There is no known exploitation of CVE-2024-35226 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2024-35226, DSA-5830-1, GHSA-4rmg-292m-wg3w, UBUNTU-CVE-2024-35226, USN-7377-1.

Is CVE-2024-35226 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free