Skip to content
SQL injection Write-up Intermediate

[Bugbounty]SQLI — Data Exfiltration via DNS

A SQL injection vulnerability was found in the Culture parameter, allowing an attacker to execute SQL commands and exfiltrate data via DNS requests to an external webhook. The attacker could retrieve database information such as host name and database name.

kauenavarro Follow

Published on medium.com

Injeção de SQL (SQLi) é uma vulnerabilidade na qual um aplicativo aceita entrada em uma instrução SQL e trata essa entrada como parte da instrução. Normalmente, o SQLi permite que um invasor malicioso visualize, modifique ou exclua dados que não deveriam poder ser recuperados.

Kauê Navarro, 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 failed to sanitise user input in the Culture parameter before using it in a SQL query, allowing injection of arbitrary SQL commands.

Impact

An attacker could exfiltrate sensitive database information and potentially execute remote code on the database server, depending on configuration.

What the attacker needed

Access to the vulnerable endpoint; Ability to send crafted requests; External webhook or DNS server

The fix

The report was closed as not applicable, but the vulnerability should be fixed by properly sanitising input and using parameterised queries.

How it was found

  1. The attacker used Burp Scanner on the endpoint and received a pingback, indicating possible SQL injection.
  2. They crafted a payload that breaks out of the query with a single quote and parenthesis.
  3. The payload declares a variable, selects the host name into it, and uses xp_dirtree to make a DNS request to an external webhook with the data as a subdomain.
  4. The attacker observed the DNS request containing the extracted data on their webhook server.
  5. They repeated the process with different SQL functions to extract database name and user name.

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. Here, the attacker could trick the database into sending information to a server they control, using a feature that makes the database look up a domain name. This let them steal data even though the website didn't show any error messages.

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 kauenavarro

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.