[nullhaven]
All challenges
Web★★★☆☆75 pts

Union all the things

Godmode · 1d ago · 3 solved

No live database here: reason it through. This is the login endpoint of a legacy app.
php
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
$sql  = "SELECT id, user, notes FROM users WHERE user = '$user' AND pass = '$pass'";
$row  = mysqli_fetch_assoc(mysqli_query($conn, $sql));
if ($row) { echo "Welcome " . $row['user'] . " — note: " . $row['notes']; }

And this is the users table, in insertion order:
python
id | user    | pass             | notes
---+---------+------------------+--------------------------------------------------
1  | admin   | 9f2c1b...        | bnVsbGhhdmVue3VuaW9uX3NlbGVjdF9ldmVyeXRoaW5nfQ==
2  | alice   | 4d51aa...        | cGxlYXNlIHJvdGF0ZSBteSBrZXk=
3  | bob     | 77e0f3...        | bm90aGluZyB0byBzZWUgaGVyZQ==

An attacker posts user=' OR 1=1 -- with any password. Work out exactly what the page prints, and decode it.

Submitting a flag needs an account

That's what records your points and lets you claim the first blood under your name.

Free, no e-mail verification. You land back on this challenge.

Solved by · 3

  1. 1
    SP
    sphulg First blood1d ago
  2. 2
    PI
    pierce051d ago
  3. 3
    JE
    Jetboy011d ago