You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: javascript/ql/src/experimental/Security/CWE-94/ServerSideTemplateInjection.qhelp
+20-3Lines changed: 20 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
<overview>
7
7
<p>
8
-
Server-Side Template Injection vulnerabilities occur when user input is embedded
8
+
Server-Side Template Injection vulnerabilities occur when user input is embedded
9
9
in a template in an unsafe manner allowing attackers to access the template context and
10
10
run arbitrary code on the application server.
11
11
</p>
@@ -21,21 +21,38 @@ render engine with sandbox options.
21
21
22
22
<example>
23
23
<p>
24
-
The following example shows a page being rendered with user input allowing attackers to access the
24
+
The following example shows a page being rendered with user input allowing attackers to access the
25
25
template context and run arbitrary code on the application server.
26
+
Pug template engine (and other template engines) provides Interpolation feature - insertion of variable values into a string of some kind.
27
+
For example, `Hello #{user.username}!`, could be used for printing username from scoped variable user, but `user.username` expression will be executed as valid javascript code.
28
+
Unsafe injection of user input provides attacker ability to inject conteqnt like #{some_js_expression}.
29
+
Injection of `#{global.process.exit(1)}` leads to code execution of `global.process.exit(1)` by server.
<ahref="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/18-Testing_for_Server_Side_Template_Injection">Server Side Template Injection</a>.
0 commit comments