Skip to content
SQL injection Write-up Beginner

Inyección Sql Divertida 3 Mssql Ejemplo Practico

A website parameter was vulnerable to SQL injection against an MSSQL database, as shown by database error messages. An attacker could use UNION-based injection to read the database version, database names, and potentially table and column names.

_Y000_ Follow

Published on infosecwriteups.com

Hola querido lector, de verdad me da mucho gusto que me regales un poco de tu valioso tiempo para leer el siguiente escrito. En esta ocasión seguiré con la serie de inyecciones SQL, para ser mas especifico analizaremos un sitio web vulnerable a inyecciones SQL con una base de datos MSSQL de fondo.

_Y000_, 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

Likely the application inserted the URL parameter into an SQL query without validation or parameterisation, and it also displayed raw database errors.

Impact

An attacker could read database metadata and potentially sensitive table and column names, though the author omitted screenshots to avoid exposing sensitive site information.

What the attacker needed

A vulnerable URL parameter; database errors are displayed

How it was found

  1. Identify that the site is vulnerable and uses MSSQL by observing the database error message.
  2. Use ORDER BY with increasing numbers to find the number of columns, which was 22.
  3. Use UNION SELECT with 22 values to see which columns are reflected on the page.
  4. Place @@version in a reflected column to read the database version.
  5. Use DB_NAME with different numbers to list database names.
  6. Use information_schema queries to retrieve table and column names.

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 website puts user input directly into a database command without checking it, so an attacker can add their own database instructions. Here the site showed database error messages, which confirmed the input was reaching the database. The author then used those errors to work out how many columns the query returned and to make the page display database information.

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 _Y000_

View all

3 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.