Skip to content
SQL injection Write-up Beginner

Sql Injection Vulnerability via Registration Form

The NPWPD field in a registration form was vulnerable to SQL injection, allowing an attacker to manipulate the backend query. The attacker could retrieve database names and dump tables, exposing sensitive data.

kevstrs_ Follow

Published on medium.com

In this article, I’ll explain how I discovered an SQL Injection vulnerability in a registration form. Registration forms are used to create accounts, but if developers don’t secure the input fields, attackers can take advantage of them.

kevstrs_, on medium.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

Likely the application built SQL queries by concatenating user input directly, without using parameterised queries or validating the input.

Impact

An attacker could retrieve sensitive data such as user credentials, personal data, and financial records, and learn the database structure to aid further attacks.

What the attacker needed

Access to the registration form; no authentication needed

The fix

The application should use prepared statements with parameterised queries, validate input to expected format, and hide detailed error messages.

How it was found

  1. Enter a normal value in the NPWPD field and observe a JSON response.
  2. Enter a single quote in the NPWPD field and observe an SQL error.
  3. Enter a boolean-based SQL injection payload and observe a different response.
  4. Save the POST request and run sqlmap to confirm the injection.
  5. Use sqlmap to retrieve the database name.
  6. Use sqlmap to list databases and dump tables.

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 is when a user's input is inserted directly into a database command, so an attacker can type special characters to change what the command does. Here, the registration form's tax ID field was not checked, so an attacker could trick the database into revealing its contents.

What is SQL injection?

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

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.