Cloudanix VulnDB

CVE-2024-35226

High · 7.3

CVSS

7.3

EPSS

0.5%

Published

May 28, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A bug in a common PHP template tool lets people who create templates run their own programs on the server, which could let attackers take control of affected websites.

Exploitation
Requires User Interaction
Attacker needs
Low Privilege
Complexity
Moderate
Impact
Remote Code Execution
Component
Library
Class
RCE
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Template authors can inject arbitrary PHP code by supplying a malicious filename to an extends-tag, resulting in code execution during template processing.

Why it matters to the business

Organizations using Smarty templates risk complete server compromise if template authors cannot be fully trusted, potentially exposing sensitive data or disrupting web services.

How an attack unfolds

An attacker with template authoring access crafts a specially named file that, when referenced via an extends-tag, causes the template engine to interpret and execute embedded PHP during rendering.

How to fix it

Upgrade smarty-php/smarty to commit 0be92bc8a6fb83e6e0d883946f7e7c09ba4e857a or later; no patch exists for the v3 branch and no workarounds are available.

How to confirm the fix worked

Verify the Smarty installation is at or beyond the fixed commit, attempt to reproduce the vulnerability with a test malicious filename in an extends-tag, and confirm the code no longer executes.

Typical attack path

  1. Locate a web application using the Smarty template engine
  2. Obtain or assume template authoring privileges
  3. Create or upload a file with a malicious name containing PHP code
  4. Reference the file using an extends-tag in a template
  5. Trigger template compilation or rendering to execute the injected code

How to detect it

Review web server and application logs for unusual template filenames or extends-tag references; inspect template compilation artifacts and server process activity for unexpected PHP execution traces.

What your security team should do

  • Immediately update Smarty to the fixed commit across all instances
  • Restrict template authoring permissions to trusted users only
  • Audit all existing templates for suspicious extends-tag usage
  • Implement runtime monitoring for unexpected PHP execution in template contexts

The record

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.

Affected packages

Ecosystem Package Introduced Fixed
Packagist smarty/smarty 3.0.0 4.5.3
Packagist smarty/smarty 5.0.0 5.1.1
Debian:11 smarty3 0 No fix
Debian:11 smarty3 0 3.1.39-2+deb11u2
Debian:12 smarty3 0 No fix
Debian:12 smarty3 0 3.1.47-2+deb12u1
Debian:12 smarty4 0 No fix
Debian:12 smarty4 0 4.3.0-1+deb12u2
Debian:13 smarty3 0 3.1.48-2
Debian:13 smarty4 0 4.5.4-1
Ubuntu:20.04:LTS smarty3 0 No fix
Ubuntu:20.04:LTS smarty3 0 3.1.34+20190228.1.c9f0de05+selfpack1-1ubuntu0.1
Ubuntu:22.04:LTS smarty3 0 No fix
Ubuntu:22.04:LTS smarty3 0 3.1.39-2ubuntu1.22.04.2
Ubuntu:24.04:LTS smarty3 0 No fix
Ubuntu:24.04:LTS smarty3 0 3.1.48-1ubuntu0.24.04.1
Ubuntu:24.04:LTS smarty4 0 No fix
Ubuntu:24.04:LTS smarty4 0 4.3.1-1ubuntu0.24.04.1
Ubuntu:24.10 smarty3 0 No fix
Ubuntu:24.10 smarty3 0 3.1.48-1ubuntu0.24.10.1
Ubuntu:24.10 smarty4 0 No fix
Ubuntu:25.04 smarty3 0 No fix
Ubuntu:25.10 smarty3 0 No fix
Ubuntu:Pro:16.04:LTS smarty3 0 No fix
Ubuntu:Pro:18.04:LTS smarty3 0 No fix
Ubuntu:Pro:18.04:LTS smarty3 0 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1+esm1
packagist smarty/smarty 3.0.0 4.5.3
packagist smarty/smarty 5.0.0 5.1.1

Related vulnerabilities