CVE-2014-8350: Smarty arbitrary PHP code execution

smarty/smarty Updated 02 Oct 2025

Summary

17/05/2022
Yes i
High
Not published

CVE-2014-8350: Smarty arbitrary PHP code execution. Affects smarty/smarty versions < 3.1.21. Fixed in 3.1.21. How to fix ↓

Also tracked for

The same CVE-2014-8350 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Smarty is a popular template engine for PHP that allows developers to separate the presentation layer from the application logic. It provides a simple and efficient way to generate dynamic web pages by combining HTML templates with PHP code. However, Smarty versions before 3.1.21 are vulnerable to an arbitrary PHP code execution issue. This vulnerability allows remote attackers to bypass secure mode restrictions and execute arbitrary PHP code by injecting malicious code into a template.

Vulnerability Detail

The vulnerability (CVE-2014-8350) in Smarty arises from a failure to properly validate and sanitize user input in templates. By exploiting this issue, an attacker can inject PHP code into a template, which will be executed when the template is rendered. This can lead to various security risks, including remote code execution, data leakage, and unauthorized access to sensitive information. It is important to note that this vulnerability can only be exploited in versions of Smarty before 3.1.21.

How To Fix

Minimum fixed version

3.1.21

This is the first release that contains the fix.

composer require smarty/smarty:3.1.21

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version of Smarty is not immediately feasible, a temporary workaround is to manually validate and sanitize user input in templates. This can be done by implementing strict input validation and using appropriate sanitization functions to remove any potentially malicious code. However, it is important to note that this workaround is not a permanent solution and upgrading to a patched version of Smarty is strongly recommended.

Conclusion

The vulnerability (CVE-2014-8350) in Smarty allows remote attackers to execute arbitrary PHP code by injecting malicious code into a template. To mitigate this risk, it is crucial to upgrade to Smarty version 3.1.21 or later. Alternatively, strict input validation and sanitization can be implemented as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for smarty/smarty →

Share this vulnerability

FAQ

Smarty is a template engine for PHP that separates the presentation layer from the application logic. It allows developers to create dynamic web pages by combining HTML templates with PHP code.

The vulnerability allows remote attackers to execute arbitrary PHP code by injecting malicious code into a template. This can lead to various security risks, including remote code execution, data leakage, and unauthorized access to sensitive information.

Versions of Smarty before 3.1.21 are affected by this vulnerability.

To fix this vulnerability, it is recommended to upgrade to Smarty version 3.1.21 or later. This version includes a fix for the arbitrary PHP code execution issue.

If upgrading to the latest version of Smarty is not immediately feasible, a temporary workaround is to manually validate and sanitize user input in templates.

Related vulnerabilities

Recent vulnerabilities recorded for smarty/smarty.

How To Fix

Minimum fixed version

3.1.21

This is the first release that contains the fix.

composer require smarty/smarty:3.1.21

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.