Skip to content
SQL injection Write-up Intermediate

How I Chained an Information Disclosure Bug with SQL Injection

An exposed Git repository revealed unauthenticated endpoints, one of which leaked a MySQL error message. Adding a parameter to the URL caused the error to reflect the parameter's content, and automated tools then extracted the database name and user.

Mba-oji Chiagoziem Follow

Published on goziem.medium.com

I’d like to appreciate God for helping me find this bug and I’ll be sharing how I was able to do so.

Mba-oji Chiagoziem, on goziem.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 concatenated user input directly into SQL queries without sanitisation, and an exposed Git repository revealed the vulnerable endpoint.

Impact

An attacker could extract database names and user information, and potentially further data, from the vulnerable endpoint.

What the attacker needed

Exposed Git repository; vulnerable endpoint accessible

How it was found

  1. Find subdomains of the target and visit a login page endpoint.
  2. Use a browser extension to detect an exposed Git repository and download the .git/index file.
  3. View the file to find unauthenticated directories and visit each endpoint.
  4. Identify an endpoint that discloses a MySQL error message.
  5. Add the nom_hachage parameter with a single quote to the URL and observe the error message reflecting the parameter content.
  6. Run automated SQL injection tools against the parameter to retrieve the database name and user.

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.

A website's code repository was accidentally left public, and one of its pages showed a database error. When the tester added a special character to a URL parameter, the error message changed to show what they typed, which is a sign that the input is being inserted into a database query. Tools then used that to read 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 Mba-oji Chiagoziem

View all

1 more disclosed report, 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.