当前位置:网站首页>[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}}

边栏推荐
- Platofarm community ecological gospel, users can get premium income with elephant swap
- It is found that the data of decimal type in the database can be obtained through resultset.getdouble, but this attribute cannot be obtained through GetObject.
- Code generator
- [hcip] MPLS Foundation
- Comprehensive upgrade, complete collection of Taobao / tmall API interfaces
- 把逻辑做在Sigma-DSP中的优化实例-数据分配器
- [hcip] OSPF experiment under mGRE environment, including multi process bidirectional republication and OSPF special area
- 【公开课预告】:快手GPU/FPGA/ASIC异构平台的应用探索
- 【Golang】- runtime.Goexit()
- 【Web技术】1395- Esbuild Bundler HMR
猜你喜欢

Embedded sharing collection 23

Moonbeam上的多链用例解析——Derek在Polkadot Decoded 2022的演讲文字回顾

Focus on differentiated product design, intelligent technology efficiency improvement and literacy education around new citizen Finance

body中基本标签

覆盖接入2w+交通监测设备,EMQ为深圳市打造交通全要素数字化新引擎

Anaconda environment installation problem

AlphaFold揭示了蛋白质结构宇宙-从近100万个结构扩展到超过2亿个结构

Event express | Apache Doris Performance Optimization Practice Series live broadcast course is open at the beginning. You are cordially invited to participate!

What are the common cyber threats faced by manufacturers and how do they protect themselves

【GoLang】网络连接 net.Dial
随机推荐
golang启动报错【已解决】
ValueError: Colors must be aRGB hex values
Super technology network security risk assessment service, comprehensively understand the security risks faced by the network system
Alphafold revealed the universe of protein structure - from nearly 1million structures to more than 200million structures
如何选择专业、安全、高性能的远程控制软件
560 and K
10 major network security incidents in the past 10 years
Anaconda environment installation problem
CSDN modify column name
PCL 点云转强度图像
[search] - DFS pruning and optimization
【观察】三年跃居纯公有云SaaS第一,用友YonSuite的“飞轮效应”
[hcip] MPLS Foundation
The information security and Standardization Commission issued the draft for comments on the management guide for app personal information processing activities
【7.21-26】代码源 - 【平方计数】【字典序最小】【“Z”型矩阵】
ELS stop at all
LeetCode 113:路径总和 II
els 到底停止
【7.21-26】代码源 - 【好序列】【社交圈】【namonamo】
【HCIP】MGRE环境下OSPF实验,含多进程双向重发布及OSPF特殊区域