Skip to content
SQL injection Write-up Beginner

Sqhell When Every Input Is A Weapon

The web application embedded user input directly into SQL queries across five endpoints, including a login form, an X-Forwarded-For header, a registration AJAX check, and two id parameters. An attacker could bypass authentication and extract flags from the database using error-based, time-based blind, and UNION-based SQL injection.

Roshan Rajbanshi Follow

Published on infosecwriteups.com

SQHell is a web-focused machine built around one core weakness: SQL injection everywhere.

Roshan Rajbanshi, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

User input was concatenated directly into SQL queries without parameterisation or escaping.

Impact

An attacker could bypass authentication and extract sensitive data from the database, including flags, across multiple endpoints.

What the attacker needed

Network access to the target; no authentication needed for some endpoints

The fix

The application should use parameterised queries (prepared statements) so user input is always treated as data, not query logic.

How it was found

  1. Submit a crafted username in the login form to comment out the password check.
  2. Use sqlmap against the terms page with a crafted X-Forwarded-For header to trigger time-based blind injection.
  3. Use sqlmap against the registration username-check endpoint to trigger time-based blind injection.
  4. Manually inject a UNION SELECT into the user id parameter to display the flag in the page.
  5. Use sqlmap against the post id parameter to dump the flag table.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

SQL injection happens when a website builds database commands by gluing together text from users, so a user can sneak in extra database instructions. Here, the login form and several other places did this, letting an attacker skip the password check or read hidden data from the database.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by Roshan Rajbanshi

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.