summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-12-25 15:02:21 +0100
committerGyorgy Sarvari <skandigraun@gmail.com>2026-01-08 22:03:02 +0100
commit6ba8215d318b8af6ee7773eb97ebca7fe708cba7 (patch)
tree2ff7a8bb9b0fd2a4beb948ab6c5125640840d240
parent2acc0c37204e9536665fa25516d81de2426a7775 (diff)
downloadmeta-openembedded-6ba8215d318b8af6ee7773eb97ebca7fe708cba7.tar.gz
smarty: patch CVE-2023-28447
Details: https://nvd.nist.gov/vuln/detail/CVE-2023-28447 Pick the patch that is referenced by the NVD report. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
-rw-r--r--meta-oe/recipes-support/smarty/smarty/CVE-2023-28447.patch74
-rw-r--r--meta-oe/recipes-support/smarty/smarty_4.1.1.bb1
2 files changed, 75 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/smarty/smarty/CVE-2023-28447.patch b/meta-oe/recipes-support/smarty/smarty/CVE-2023-28447.patch
new file mode 100644
index 0000000000..837019d88a
--- /dev/null
+++ b/meta-oe/recipes-support/smarty/smarty/CVE-2023-28447.patch
@@ -0,0 +1,74 @@
1From 456aad251e7dd399fef136f652a1684c05fefa5a Mon Sep 17 00:00:00 2001
2From: Simon Wisselink <s.wisselink@iwink.nl>
3Date: Fri, 24 Mar 2023 12:19:34 +0100
4Subject: [PATCH] Implement fix and tests
5
6CVE: CVE-2023-28447
7Upstream-Status: Backport [https://github.com/smarty-php/smarty/commit/685662466f653597428966d75a661073104d713d]
8Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
9---
10 libs/plugins/modifier.escape.php | 4 +++-
11 libs/plugins/modifiercompiler.escape.php | 4 +++-
12 .../PluginModifierEscapeTest.php | 21 +++++++++++++++++++
13 3 files changed, 27 insertions(+), 2 deletions(-)
14
15diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php
16index 3ce48382..70d2db92 100644
17--- a/libs/plugins/modifier.escape.php
18+++ b/libs/plugins/modifier.escape.php
19@@ -188,7 +188,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
20 // see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
21 '<!--' => '<\!--',
22 '<s' => '<\s',
23- '<S' => '<\S'
24+ '<S' => '<\S',
25+ "`" => "\\\\`",
26+ "\${" => "\\\\\\$\\{"
27 )
28 );
29 case 'mail':
30diff --git a/libs/plugins/modifiercompiler.escape.php b/libs/plugins/modifiercompiler.escape.php
31index 1fc5e781..0e13c829 100644
32--- a/libs/plugins/modifiercompiler.escape.php
33+++ b/libs/plugins/modifiercompiler.escape.php
34@@ -89,7 +89,9 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
35 // see https://html.spec.whatwg.org/multipage/scripting.html#restrictions-for-contents-of-script-elements
36 return 'strtr((string)' .
37 $params[ 0 ] .
38- ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/", "<!--" => "<\!--", "<s" => "<\s", "<S" => "<\S" ))';
39+ ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r",
40+ "\\n" => "\\\n", "</" => "<\/", "<!--" => "<\!--", "<s" => "<\s", "<S" => "<\S",
41+ "`" => "\\\\`", "\${" => "\\\\\\$\\{"))';
42 }
43 } catch (SmartyException $e) {
44 // pass through to regular plugin fallback
45diff --git a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php
46index 46a8297f..752e1bfe 100644
47--- a/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php
48+++ b/tests/UnitTests/TemplateSource/TagTests/PluginModifier/PluginModifierEscapeTest.php
49@@ -207,4 +207,25 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
50 $this->assertEquals("sma'rty@&#187;example&#171;.com", $this->smarty->fetch($tpl));
51 Smarty::$_MBSTRING = true;
52 }
53+
54+ public function testTemplateLiteralBackticks()
55+ {
56+ $tpl = $this->smarty->createTemplate('string:{"`Hello, World!`"|escape:"javascript"}');
57+ $this->assertEquals("\\`Hello, World!\\`", $this->smarty->fetch($tpl));
58+ }
59+
60+ public function testTemplateLiteralInterpolation()
61+ {
62+ $tpl = $this->smarty->createTemplate('string:{$vector|escape:"javascript"}');
63+ $this->smarty->assign('vector', "`Hello, \${name}!`");
64+ $this->assertEquals("\\`Hello, \\\$\\{name}!\\`", $this->smarty->fetch($tpl));
65+ }
66+
67+ public function testTemplateLiteralBackticksAndInterpolation()
68+ {
69+ $this->smarty->assign('vector', '`${alert(`Hello, ${name}!`)}${`\n`}`');
70+ $tpl = $this->smarty->createTemplate('string:{$vector|escape:"javascript"}');
71+ $this->assertEquals("\\`\\\$\\{alert(\\`Hello, \\\$\\{name}!\\`)}\\\$\\{\\`\\\\n\\`}\\`", $this->smarty->fetch($tpl));
72+ }
73+
74 }
diff --git a/meta-oe/recipes-support/smarty/smarty_4.1.1.bb b/meta-oe/recipes-support/smarty/smarty_4.1.1.bb
index 1d044e18ce..014a449b30 100644
--- a/meta-oe/recipes-support/smarty/smarty_4.1.1.bb
+++ b/meta-oe/recipes-support/smarty/smarty_4.1.1.bb
@@ -9,6 +9,7 @@ DEPENDS += "php"
9 9
10SRC_URI = "git://github.com/smarty-php/smarty.git;protocol=https;branch=master \ 10SRC_URI = "git://github.com/smarty-php/smarty.git;protocol=https;branch=master \
11 file://CVE-2018-25047.patch \ 11 file://CVE-2018-25047.patch \
12 file://CVE-2023-28447.patch \
12 " 13 "
13 14
14SRCREV = "71036be8be02bf93735c47b0b745f722efbc729f" 15SRCREV = "71036be8be02bf93735c47b0b745f722efbc729f"