What are Template Injections (SSTI)?
What are templates?
Old-fashioned web applications built (and partly still build) HTML responses like this.
1html = "<h1> Welcome, " + name + "</h1> return htmlThis type of HTML structure is not only rigid but also terribly insecure. Such applications are usually quite easy to inject the attacker's own HTML/JavaScript code, which leads to XSS vulnerabilities.
A more modern approach is to use templates. Templates are separate HTML files that are also partly code files. The desired data is then given to the template, and the template builds the HTML. There is no vulnerability in this code because the template can safely build the HTML in a way that it doesn't matter what the attacker has entered as a name, it doesn't become dangerously part of the HTML structure.
1template = "<h1> Welcome, {{name}}</h1> " return render_template(template, name=name)Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.