No-Threshold

Description

Prepare for the finest magic products out there. However, please be aware that we've implemented a specialized protective spell within our web application to guard against any black magic aimed at our web shop.🔮🎩

Source

entrypoint.sh

#!/bin/sh

DB_PATH="/opt/www/app/nothreshold.db"

sqlite3 "$DB_PATH" <<EOF
CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    username TEXT NOT NULL,
    password TEXT NOT NULL
);
INSERT INTO users (username, password) VALUES ('admin', '$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)');
.quit
EOF

uwsgi --ini /opt/www/app/uwsgi.ini &

haproxy -f /etc/haproxy/haproxy.cfg 

tail -f /dev/null

conf/uwsgi.ini

conf/haproxy.cfg

challenge/__init__.py

challenge/blueprints/dashboard.py

challenge/blueprints/login.py

challenge/blueprints/verify2fa.py

Solution

No-Threshold.png

So first of all we can't do anything in the Shop, because we need to Login. To login we need to bypass the 403 set by HAProxy.

The login is denied to any request coming from outside, but only to /auth/login, meaning we can tamper with the URL such as //auth/login and it will not get blocked and we are able to bypass the proxy rule.

No-Threshold-1.png

Because login does raw SQL queries we can just do simplest SQLi and bypass it, but the web redirects us to url without // as prefix so catch the request via burp and modify the path:

No-Threshold-2.png

Now we need to get 2FA Code somehow

No-Threshold-3.png

The code is set by uwsgi API, it's 4 digits long (because login creates it: set_2fa_code(4))

The server didn't like async code... so brute with non async 😭

circle-check

Last updated