Skip to content

Commit

Permalink
enforce hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Sep 2, 2024
1 parent 7a15f0f commit 90a5658
Show file tree
Hide file tree
Showing 25 changed files with 75 additions and 25 deletions.
4 changes: 3 additions & 1 deletion web-security/auth-bypass-cookie/server
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/cmdi-ls-filter/server
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ def challenge():
os.setuid(os.geteuid())
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/cmdi-ls-pipe/server
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ def challenge():
os.setuid(os.geteuid())
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/cmdi-ls-quote/server
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ def challenge():
os.setuid(os.geteuid())
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/cmdi-ls-semicolon/server
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ def challenge():
os.setuid(os.geteuid())
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/cmdi-touch-blind/server
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ def challenge():
os.setuid(os.geteuid())
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/csrf-reflected-alert/server
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-1/server
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ def challenge(path="index.html"):
flask.abort(500, requested_path + ":" + str(e))

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-10/server
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-11/server
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-12/server
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-2/server
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ def challenge():
os.setuid(os.geteuid())
os.environ["PATH"] = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-3/server
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-4/server
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-5/server
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ def challenge():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-6/server
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ def challenge():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-7/server
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-8/server
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/level-9/server
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/path-traversal-2/server
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ def challenge(path="index.html"):
flask.abort(500, requested_path + ":" + str(e))

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/sqli-pin/server
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ def challenge_get():
"""

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/xss-exfil-cookie/server
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/xss-rf-post/server
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/xss-stored-alert/server
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)
4 changes: 3 additions & 1 deletion web-security/xss-stored-html/server
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ def challenge_get():
return page + "</body></html>"

app.secret_key = os.urandom(8)
app.run("challenge.localhost", 8080 if os.geteuid() else 80)
port = 8080 if os.geteuid() else 80
app.config['SERVER_NAME'] = f"challenge.localhost:{port}"
app.run("challenge.localhost", port)

0 comments on commit 90a5658

Please sign in to comment.