Skip to content
ayvoren

Learn · Hack Lab

Break it, then fix it

You defend a system better once you have attacked one. Each mission is a fake app that lives only in this page: break in, read why it worked, then try the same attack on the fixed version.

0 of 3 broken into · 0 of 3 defended

Everything here is simulated in your browser. Only ever test systems you own or are allowed to test.

Mission 1

Log in as admin without the password

Your goal: The login glues what you type into an SQL query. Get in as admin. You do not know the password.

What the database receives

SELECT * FROM users WHERE name = '' AND password = ''

Wrong name or password.

Stuck? Think about what a single quote does to the query, and what -- means in SQL.

Mission 2

Make a script run in every visitor's browser

Your goal: This comment box puts your text into the page as HTML. Write a comment that would run code.

What the page sends to visitors

<div class="comment"></div>

Nothing posted yet.

This box never runs anything. It only reads your text and tells you what a real browser would do with it.

Mission 3

Read an invoice that is not yours

Your goal: You are logged in as user 7. Your invoice is number 1001. Find someone else's.

Response

200 OK
{
  "id": 1001,
  "owner": 7,
  "customer": "You",
  "amount": "450 MAD"
}

This one is yours.