当前位置:网站首页>[WesternCTF2018]shrine
[WesternCTF2018]shrine
2022-07-29 01:49:00 【pakho_ C】
[WesternCTF2018]shrine
flask frame 
import flask
import os
app = flask.Flask(__name__)
app.config['FLAG'] = os.environ.pop('FLAG')
@app.route('/')
def index():
return open(__file__).read()
@app.route('/shrine/<path:shrine>')
def shrine(shrine):
def safe_jinja(s):
s = s.replace('(', '').replace(')', '')
blacklist = ['config', 'self']
return ''.join(['{
{% set {}=None%}}'.format(c) for c in blacklist]) + s
return flask.render_template_string(safe_jinja(shrine))
if __name__ == '__main__':
app.run(debug=True)
os.environ.pop(‘FLAG’) Get environment variables Stored in a file named FLAG Of config in
Then the purpose is to obtain config The value in
flask The framework first considers template injection ssti
test :

There are two blacklists for executing functions :config and self
however python There are also some built-in functions , such as url_for and get_flashed_messages
Use url_for test :
shrine/{
{
url_for.__globals__}}

It can be executed , see current_app Configuration information :
shrine/{
{
url_for.__globals__['current_app'].config}}

边栏推荐
- Behind the second round of okaleido tiger sales is the strategic support of ecological institutions
- Timer of BOM series
- 动态内存与智能指针
- What are source code, inverse code and complement code
- Nacos installation guide on win system
- How to choose professional, safe and high-performance remote control software
- 科研环境对人的影响是很大的
- In depth analysis of C language memory alignment
- LeetCode 112:路径总和
- Cloud native application comprehensive exercise
猜你喜欢

活动速递| Apache Doris 性能优化实战系列直播课程初公开,诚邀您来参加!

规划数学期末考试模拟二
![[search] - DFS pruning and optimization](/img/d4/7c2fec02f5a6bcfa2d5e204398af01.png)
[search] - DFS pruning and optimization

TypeError: can only concatenate str (not “int“) to str

【HCIP】MGRE环境下OSPF实验,含多进程双向重发布及OSPF特殊区域

九天后我们一起,聚焦音视频、探秘技术新发展

【7.21-26】代码源 - 【体育节】【丹钓战】【最大权值划分】

2022年最火的十大测试工具,你掌握了几个

DSP震动座椅

【观察】三年跃居纯公有云SaaS第一,用友YonSuite的“飞轮效应”
随机推荐
Nacos installation guide on win system
我们总结了 3 大Nacos使用建议,并首次公开 Nacos 3.0 规划图 Nacos 开源 4 周年
【7.27】代码源 - 【删数】【括号序列】【数字替换】【游戏】【画画】
Timer of BOM series
【7.21-26】代码源 - 【体育节】【丹钓战】【最大权值划分】
AlphaFold揭示了蛋白质结构宇宙-从近100万个结构扩展到超过2亿个结构
Read the recent trends of okaleido tiger and tap the value and potential behind it
Openpyxl library fill color
Comprehensive upgrade, all you can imagine is here -- JD API interface
Super technology network security risk assessment service, comprehensively understand the security risks faced by the network system
Reinforcement learning (I): Q-learning, with source code interpretation
560 和为 K 的子数组
New 1688 API access instructions
Top network security prediction: nearly one-third of countries will regulate blackmail software response within three years
【7.21-26】代码源 - 【好序列】【社交圈】【namonamo】
Use of resttemplate and Eureka
Comprehensive upgrade, complete collection of Taobao / tmall API interfaces
【搜索】—— 迭代加深/双向DFS/IDA*
body中基本标签
StoneDB 邀请您参与开源社区月会!