Server-Side Template Injection (IAST)
Summary#
This script is possibly vulnerable to Server-side template injection attacks.
Server-side template injection occurs when user-controlled input is embedded into a server-side template, allowing users to inject template directives. This allows an attacker to inject malicious template directives and possibly execute arbitrary code on the affected server.
Impact#
An attacker may inject malicious template directives and possibly execute arbitrary code on the affected server.
Actions To Take#
- See the remedy for solution.
- If you are not using a database access layer (DAL), consider using one. This will help you centralize the issue. You can also use ORM (object relational mapping). Most of the ORM systems use only parameterized queries and this can solve the whole SQL injection problem.
- Locate all of the dynamically generated SQL queries and convert them to parameterized queries. (If you decide to use a DAL/ORM, change all legacy code to use these new libraries.)
- Use your weblogs and application logs to see if there were any previous but undetected attacks to this resource.
Remediation#
Templates should not be created from user-controlled input. User input should be passed to the template using template parameters.
Required Skills for Successful Exploitation#
There are numerous freely available tools to exploit SQL injection vulnerabilities. This is a complex area with many dependencies; however, it should be noted that the numerous resources available in this area have raised both attacker awareness of the issues and their ability to discover and leverage them. SQL injection is one of the most common web application vulnerabilities.