CVE-2011-1028: Smarty3 Arbitrary PHP Code Execution in smarty/smarty

smarty/smarty Updated 02 Oct 2025

Summary

22/04/2022
Yes i
Critical
9.8

CVE-2011-1028: Smarty3 Arbitrary PHP Code Execution. Affects smarty/smarty versions < 3.0.7. Fixed in 3.0.7. How to fix ↓

Also tracked for

The same CVE-2011-1028 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Smarty is a popular PHP template engine used for separating application logic from presentation. It provides a simple and efficient way to generate dynamic web pages. The vulnerability affects the smarty/smarty package, specifically the $smarty.template variable in Smarty3. This variable allows attackers to potentially execute arbitrary PHP code by exploiting the sysplugins/smarty_internal_compile_private_special_variable.php file.

Vulnerability Detail

The vulnerability arises from a lack of proper input validation and sanitization in the affected file. Attackers can manipulate the $smarty.template variable to inject malicious PHP code, which is then executed within the context of the application. This can lead to various security risks, including remote code execution, unauthorized access to sensitive data, and potential compromise of the entire system.

How To Fix

Minimum fixed version

3.0.7

This is the first release that contains the fix.

composer require smarty/smarty:3.0.7

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

Workaround

If upgrading to the latest version is not immediately feasible, a temporary workaround is to disable the use of the $smarty.template variable in your application. This can be achieved by modifying the affected file sysplugins/smarty_internal_compile_private_special_variable.php and removing or commenting out the code that references the $smarty.template variable. However, this workaround should only be considered as a temporary solution, and upgrading to the latest version is strongly recommended.

Conclusion

The Smarty3 Arbitrary PHP Code Execution vulnerability in the smarty/smarty package can have severe consequences for your application's security. It is crucial to upgrade to the latest version (3.0.7 or later) or apply the temporary workaround to mitigate the risk. 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 PHP template engine that separates the presentation layer from the application logic. It provides a clean and efficient way to generate dynamic web pages.

The vulnerability allows attackers to potentially execute arbitrary PHP code within the context of your application. This can lead to remote code execution, unauthorized access to sensitive data, and compromise of your system.

To fix this vulnerability, you should upgrade the smarty/smarty package to version 3.0.7 or later. Update your composer.json file and run composer update to install the latest version.

If upgrading immediately is not possible, you can temporarily disable the use of the $smarty.template variable in your application. Modify the affected file sysplugins/smarty_internal_compile_private_special_variable.php and remove or comment out the code that references the variable.

Related vulnerabilities

Recent vulnerabilities recorded for smarty/smarty.

How To Fix

Minimum fixed version

3.0.7

This is the first release that contains the fix.

composer require smarty/smarty:3.0.7

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