Templating engines are used to embed dynamic content into web pages and emails. Template injection occurs when user input is embedded in a template in an unsafe manner.
The templating is a vulnerability that can easily be overlooked as a poor XSS vulnerability. SSTI is essentially server-side template injection inside a sandbox.
There are two distinct contexts: plaintext (inject directly into HTML) and code context (placed within a template statement as a variable name). Both of these being used incorrectly can lead to XSS and/or RCE.
The first aspect is figuring out which template engine is being used (identify). The article has a flow chart to figure out which engine is being used.
The second part of this is exploitation. The article shows several steps to to attacking: reading, exploring and attacking.
Read: Each language and templating engine has many complex built in functions, leading to many possible outcomes. So, understanding the template injection and reading the documentation on this is very important. This includes basic syntax, security considerations, builtin methods and plugins.
Explore: Explore the environment that is being used on the application. What is in the namespace? What objects are available?
Attack: Understand the application as a whole and proceed to normal exploitation techniques.
There are several cases of applications being exploited within this application. I always enjoy the real world exploitation within the Portswigger articles!