CVE-2024-35226: Smarty/smarty Smarty Vulnerable To PHP Code Vulnerability
HIGHCVE-2024-35226 is a HIGH (CVSS 7.3) smarty vulnerable to php code vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Smarty/smarty libraries in the Packagist ecosystem. The issue involves smarty vulnerable to php code injection by malicious attribute in extends-tag. Remediation is available by upgrading affected packages to version 5.1.1, 4.5.3.
CVE-2024-35226 at a Glance
Security Impact
CVSS: 7.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N).
How to Fix CVE-2024-35226
To remediate this vulnerability, upgrade all affected Smarty/smarty dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade smarty/smarty to 5.1.1
Upgrade smarty/smarty to 4.5.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for smarty/smarty
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-35226, inspect your project dependencies for Smarty/smarty:
inspect dependencies for smarty/smarty
Analyze the terminal output to locate any version of Smarty/smarty in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.1.1), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Smarty/smarty, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-35226 Affected Smarty/smarty Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
smarty/smarty
|
Packagist |
≥ 5.0.0
< 5.1.1
|
5.1.1
|
|
smarty/smarty
|
Packagist |
≥ 3.0.0
< 4.5.3
|
4.5.3
|
References
Frequently Asked Questions
What is CVE-2024-35226?
Which Smarty/smarty versions are affected?
What version fixes CVE-2024-35226?
Is smarty/smarty affected?
What is the CVSS score of CVE-2024-35226?
What CWE is associated with CVE-2024-35226?
How can I check Packagist dependencies for CVE-2024-35226?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4rmg-292m-wg3w",
"modified" : "2025-11-04T16:50:38Z",
"published" : "2024-05-29T18:44:30Z",
"aliases" : [ "CVE-2024-35226" ],
"summary" : "Smarty vulnerable to PHP Code Injection by malicious attribute in extends-tag",
"details" : "### Impact\nTemplate authors could inject php code by choosing a malicous file name for an extends-tag. Users that cannot fully trust template authors should update asap.\n\n### Patches\nPlease upgrade to the most recent version of Smarty v4 or v5. There is no patch for v3.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "smarty/smarty"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "5.0.0"
}, {
"fixed" : "5.1.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "smarty/smarty"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "4.5.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/smarty-php/smarty/security/advisories/GHSA-4rmg-292m-wg3w"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35226"
}, {
"type" : "WEB",
"url" : "https://github.com/smarty-php/smarty/commit/0be92bc8a6fb83e6e0d883946f7e7c09ba4e857a"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/smarty-php/smarty"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2024/11/msg00013.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-05-29T18:44:30Z",
"nvd_published_at" : "2024-05-28T21:16:30Z"
}
}