PATCH//NOTES Open it in the app
← All hands-on practice
Web security · 15 min

Break into the shop: SQL injection

Wrenfield & Co's shop pastes what you type straight into its SQL. Use the site, watch the SQL change behind the scenes, break in, then fix the code.

Start it: free, in your browser, no account

What you will do

  1. Sign in normally with the test account, and see the SQL the login sends.
  2. Make the site show a database error.
  3. Sign in as admin without knowing the admin password.
  4. In the shop search, make a UNION SELECT that the database accepts.
  5. Use the search to list every username and password hash from the users table.
  6. Tick "Fix the code" and try your admin sign-in again.

Exam objectives it practises

  • CompTIA Security+ 2.3 Types of vulnerabilities
  • CompTIA Security+ 2.4 Indicators of malicious activity
  • CompTIA Security+ 4.9 Data sources for investigations
  • CompTIA PenTest+ 4.5 Web application attacks

Wrenfield & Co and its people are fictional, and everything runs in this page: nothing is sent anywhere. The database is a small model of MySQL 8.0 (SELECT, WHERE, UNION, ORDER BY, LIMIT, comments, a few functions and information_schema) with MySQL's own error codes and wording; real databases support far more. The shop's PHP is shown, not run. Real sites should also hide database errors from visitors and store passwords with a slow, salted hash (see the hashing lab), not plain SHA-256.