← Vulnerability feed

Vulnerability record · CVE-2021-26120 · published 22 February 2021

CVE-2021-26120: Smarty template engine code injection via function name

Smarty · Smarty

Smarty before 3.1.39 allows code injection through an unexpected function name following a {function name= substring in a template. Because Smarty is a PHP template engine, injected code executes in the context of the hosting application, making this a serious remote code execution risk wherever untrusted template content is processed.

9.8 CVSS 3.1 Critical EPSS 82% · top 0.3% CWE-94 · Code injection
9.8CVSS 3.1 base score, v2 7.5
82%EPSS exploitation probability, 30 days
NoNot in CISA KEV
2Affected product versions listed by NVD
10References
17 Jun 2026Last modified by NVD

Description

Smarty before 3.1.39 allows code injection via an unexpected function name after a {function name= substring.

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Automated analysis

Generated by VULONE's analysis model from the NVD record, CISA KEV and EPSS data on 18 September 2026. Confidence: high.

critical priorityCVSS 9.8 with network reachability, no authentication or interaction, and full code execution impact, plus a very high EPSS score, make this an urgent patch target despite no KEV listing.

What it is

Smarty before 3.1.39 allows code injection through an unexpected function name following a {function name= substring in a template. Because Smarty is a PHP template engine, injected code executes in the context of the hosting application, making this a serious remote code execution risk wherever untrusted template content is processed.

Impact

An attacker can inject and execute arbitrary code in the PHP process running the application, leading to full compromise of confidentiality, integrity and availability of the affected host.

Attack surface

The flaw is reachable over the network with no authentication and no user interaction per the CVSS vector (AV:N/AC:L/PR:N/UI:N). It is triggered by supplying crafted template content containing a {function name= substring, so any application that lets untrusted input reach Smarty template compilation is exposed.

Exploitation

Not listed in CISA KEV and no ransomware associations are documented, but EPSS is very high at 0.823 (99.6th percentile), indicating strong predicted exploitation activity. Reference tags are release notes, mailing lists and patch advisories only; no public exploit reference is included in the record.

What to do

  • Upgrade Smarty to 3.1.39 or later; apply the vendor release containing the fix.
  • Apply the Debian and Gentoo security updates (DSA-5151, GLSA 202105-06) on distributions shipping the affected package.
  • Do not pass user-controlled or otherwise untrusted content into Smarty templates; treat template sources as trusted code.
  • Where feasible, sandbox or restrict the PHP process running Smarty to limit the blast radius of code execution.

Detection

  • Search application and web logs for template input containing the string {function name= or unusual function names in template parameters.
  • Monitor for unexpected child processes, outbound connections or file writes originating from the PHP/web server process.
  • Audit template storage and upload paths for recently modified or newly introduced template files.
  • Alert on Smarty version strings below 3.1.39 in deployed applications and dependency manifests.

This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.

Affected products

2 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

Track CVE-2021-26120 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

10.0CVE-2025-32433Erlang/OTP SSH server missing authentication allows remote code executionErlang/OTP SSH servers before OTP-27.3.3, OTP-26.2.5.11 and OTP-25.3.2.20 mishandle SSH protocol messages, letting an unauthenticated attacker execut…KEVEPSS 99%analysed10.0CVE-2025-24201Apple WebKit out-of-bounds write allows sandbox escapeCVE-2025-24201 is an out-of-bounds write in Apple's WebKit that was addressed with improved checks. Maliciously crafted web content may break out of …KEVEPSS 3.8%analysed10.0CVE-2021-44228Apache Log4j2 JNDI lookup remote code executionApache Log4j2 versions 2.0-beta9 through 2.15.0 (excluding 2.12.2, 2.12.3, and 2.3.1) do not protect against attacker-controlled LDAP and other JNDI …KEVEPSS 100%analysed9.8CVE-2026-24061GNU Inetutils telnetd argument injection allows remote auth bypasstelnetd in GNU Inetutils through 2.7 fails to sanitize the USER environment variable, so a value such as "-f root" is passed as an argument to login …KEVEPSS 99%analysed9.8CVE-2025-39682Linux kernel TLS zero-length record handling flaw on rx_listThe Linux kernel TLS receive path mishandles zero-length records that arrive from the rx_list, breaking the assumption that a record type change cann…KEVEPSS 2.9%analysed9.8CVE-2025-24813Apache Tomcat Default Servlet path equivalence enables RCE and file disclosureApache Tomcat mishandles path equivalence for names containing an internal dot, letting a remote unauthenticated attacker write files through the Def…KEVEPSS 100%analysed9.8CVE-2024-9680Mozilla Firefox and Thunderbird use-after-free in Animation timelinesA use-after-free flaw in Animation timelines allows an attacker to execute code in the content process of Firefox and Thunderbird. Mozilla reports ex…KEVEPSS 23%analysed9.8CVE-2023-46604Apache ActiveMQ OpenWire deserialization remote code executionThe Java OpenWire protocol marshaller in Apache ActiveMQ deserializes untrusted data, letting an attacker manipulate serialized class types so the br…KEVEPSS 100%analysed

Source: NIST National Vulnerability Database (record CVE-2021-26120), CISA KEV, FIRST EPSS (scores of 2026-09-26). This page is refreshed as NVD updates the record.