This challenge is quite like a python version of prototype pollution, you can also say that it uses some idea from pyjail, over all, it’s a really interesting one.
Let’s have a look of the source:
app.py
from flask import Flask, render_template, request, redirect from taskmanager import TaskManager import os app = Flask(__name__) @app.before_first_request def init(): if app.env == 'yolo': app.add_template_global(eval) @app.route("/<path:path>") def render_page(path): if not os.path.exists("templates/" + path): return "not found", 404 return render_template(path) @app.
For this challenge, we must get rce using ([.^])',, but in php8. Even more, warning is not allowed which means we couldn’t use something like [].''. So, the first thing I do is to figure out how many chars can we get and how many functions can we use:
In [206]: mapping = {} ...: for a, b in combinations('[(,.^)]', 2): ...: x = chr(ord(a) ^ ord(b)) ...: if x in mapping: .