Skip to content
OpenAdvisories
Critical USN-5348-1 6 CVEs

smarty3 vulnerabilities

Published Mar 28, 2022 · Updated Feb 10, 2026

Summary

David Gnedt and Thomas Konrad discovered that Smarty was incorrectly
sanitizing the paths present in the templates. An attacker could possibly
use this use to read arbitrary files when controlling the executed
template. (CVE-2018-13982)

It was discovered that Smarty was incorrectly sanitizing the paths
present in the templates. An attacker could possibly use this use to read
arbitrary files when controlling the executed template. (CVE-2018-16831)

It was discovered that Smarty was incorrectly validating security policy
data, allowing the execution of static classes even when not permitted by
the security settings. An attacker could possibly use this issue to
execute arbitrary code. (CVE-2021-21408)

It was discovered that Smarty was incorrectly managing access control to
template objects, which allowed users to perform a sandbox escape. An
attacker could possibly use this issue to send specially crafted input to
applications that use Smarty and execute arbitrary code. (CVE-2021-26119)

It was discovered that Smarty was not checking for special characters
when setting function names during plugin compile operations. An attacker
could possibly use this issue to send specially crafted input to
applications that use Smarty and execute arbitrary code. (CVE-2021-26120)

It was discovered that Smarty was incorrectly sanitizing characters in
math strings processed by the math function. An attacker could possibly
use this issue to send specially crafted input to applications that use
Smarty and execute arbitrary code. (CVE-2021-29454)

Fixed packages 1

ReleasePackageFixed in
Ubuntu · 18.04 LTS 18.04:LTS smarty3 3.1.31+20161214.1.c7d42e4+selfpack1-3ubuntu0.1

Vulnerabilities 6

  • Critical 9.8
    CVE-2021-26120 EPSS 82%

    PHP Code Injection by malicious function name in smarty

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

  • High 8.8

    Access to restricted PHP code by dynamic static class access in smarty

    Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Prior to versions 3.1.43 and 4.0.3, template authors could run restricted static php methods. Users should upgrade to version 3.1.43 or 4.0.3 t…

  • High 8.1

    Sandbox Escape by math function in smarty

    Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Prior to versions 3.1.42 and 4.0.2, template authors could run arbitrary PHP code by crafting a malicious math string. If a math string was pas…

  • High 7.5

    Smarty Path Traversal Vulnerability

    Smarty_Security::isTrustedResourceDir() in Smarty before 3.1.33 is prone to a path traversal vulnerability due to insufficient template code sanitization. This allows attackers controlling the executed template code to bypass the trusted directory security re…

  • High 7.5

    Sandbox escape through template_object in smarty

    Smarty before 3.1.39 allows a Sandbox Escape because $smarty.template_object can be accessed in sandbox mode.

  • Medium 5.9

    Smarty Path Traversal Vulnerability

    Smarty before 3.1.33-dev-4 allows attackers to bypass the trusted_dir protection mechanism via a file:./../ substring in an include statement.

References

  • report
    https://ubuntu.com/security/CVE-2018-13982
  • report
    https://ubuntu.com/security/CVE-2018-16831
  • report
    https://ubuntu.com/security/CVE-2021-21408
  • report
    https://ubuntu.com/security/CVE-2021-26119
  • report
    https://ubuntu.com/security/CVE-2021-26120
  • report
    https://ubuntu.com/security/CVE-2021-29454