Jinja
Syntax
The content below is based on OffSec's WEB-200 course.
<h1>Hey {{ name }}</h1>
{% if reasons %}
Here are a couple of reasons why you are great:
<ul>
{% for r in reasons %}
<li>{{r}}</li>
{% endfor %}
</ul>
{% endif %}
SSTI
The example below is based on OffSec's WEB-200 course.
Jinja uses Python which strictly handles variables, unline PHP, Java, and JavaScript, something we can use to identify it (Figure 1).
{{5*'5'}}

Jinja is typically used with the Flask framework, and the latter sets six global variables: config
, request
, session
, g
, url_for()
, and get_flashed_messages()
. Therefore, another way to identify this templating engine is by accessing those variables (Figure 2).

The config
global variable may contain application secrets, such as private keys or database passwords, so it is always a worthwhile check (Figure 3).
{{config|pprint}}

config
global variable's contentsRCE is covered in WEB-300.
Last updated
Was this helpful?