Skip to content
SQL injection Write-up Beginner

My Cybersecurity Journey: Exploring SQL Injection in a Web Application

The author found a SQL injection vulnerability in a web application's search parameter and used SQLMap to confirm it and explore database enumeration. The text does not state what data was actually exposed or the real-world impact.

Subodh Follow

Published on medium.com

I’ve been exploring the field of cybersecurity through practical exercises, focusing on web application vulnerabilities and understanding how security weaknesses can be identified and exploited within controlled lab environments.

Subodh, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

This is a learning exercise rather than a bug bounty submission. The author set out to explore web application vulnerabilities through practical work in controlled lab environments, and this article records one such exercise: reconnaissance of a target web application, identification of a SQL Injection vulnerability in its search functionality, and an attempt to understand the impact of that weakness.

The report does not name the target application, its owner, or the lab environment it ran in. What it does describe is the feature involved: the application's search functionality, and specifically the search parameter that the application accepts and passes into a database query.

Setup

The exercise was carried out with the following tools and technologies, as listed by the author:

  • Kali Linux
  • SQLMap
  • FFUF
  • cURL
  • Linux Terminal
  • Browser Developer Tools

No account, role, credential or application version is described. The work was performed in a controlled lab environment, which is the precondition the author states for the whole exercise.

Finding it

The author started with reconnaissance: examining the target application to understand its structure, identify accessible pages, and discover potentially interesting endpoints. The stated purpose was to see how the application communicates with its server and how information exposed through application resources can inform a security assessment. The report does not list the specific endpoints, directories or responses that this phase produced.

Attention then moved to the application's search functionality. There, the author identified a SQL Injection vulnerability in the search parameter. The report does not show the request that first suggested the parameter was injectable, nor the response that confirmed it by hand; the transition from observation to tooling is not documented in detail.

Exploitation

Step 1: Investigate the search parameter with SQLMap

With the vulnerable search parameter identified, the author used SQLMap to investigate the vulnerability and to work through different SQL Injection techniques. The report does not reproduce the SQLMap command line, the URL, the parameter name, or any tool output, so the exact invocation cannot be reconstructed from it.

The techniques the author explored with the tool were:

  1. Boolean-based Blind SQL Injection
  2. Error-based SQL Injection
  3. UNION-based SQL Injection
  4. Time-based Blind SQL Injection

Step 2: Enumerate the database

Beyond confirming injectability, the author explored database enumeration, to understand how improperly handled database queries can expose sensitive information. As with the previous step, the report gives no commands and no enumerated output; it describes the activity and the lesson drawn from it rather than the artefacts.

Root cause

The report does not analyse the application's code. What it does say, in its takeaways, is that the weakness lies in how user-supplied input reaches the database: input was not treated as untrusted and validated before processing, and the database queries were improperly constructed, which is what allowed the search parameter to be manipulated. The author frames the remedy in terms of parameterized queries, prepared statements and secure coding practices, without describing how the query was actually built.

Impact

The author's stated concern is that manipulation of improperly constructed queries can compromise the confidentiality and integrity of data, and that database enumeration is the way a tester evaluates the potential impact and scope of such a vulnerability. The report does not quantify what data was reachable in this lab, does not describe any real user or system affected, and does not assign a severity. Because the exercise ran in a controlled environment, no production impact is claimed.

Fix

No fix is reported and no change to the application is described. The preventive measures the author names are parameterized queries, prepared statements and secure coding practices, together with validating all user-supplied input before processing it. These are presented as general mitigations for the class of vulnerability, not as something that was applied to this target.

Variants to test

These follow from the techniques the author worked through, applied to other targets:

  1. Boolean-based blind injection in a search parameter. Send a search term that is true under the application's logic and one that is false, and compare the two responses. A positive result is a consistent, reproducible difference in the page content or result count between the true and false conditions.
  2. Error-based injection. Supply input containing quote characters and other syntax that would break a naively built query. A positive result is a database error message surfacing in the response, which also tells you the backend in use.
  3. UNION-based injection. Attempt to append a UNION SELECT with a matching column count to the search term. A positive result is data from another table or expression appearing where search results should be.
  4. Time-based blind injection. Use a condition that causes a deliberate delay only when true. A positive result is a repeatable difference in response time that tracks the condition, which is useful when the application returns neither errors nor visible content differences.
  5. Database enumeration once injection is confirmed. Use the injection to walk metadata such as schema and table names before touching row data. A positive result is retrieval of schema information the search feature was never meant to expose.

In each case, run the test only against systems you are authorised to test, as the author did within a lab.

From the original on medium.com

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

This article is a learning diary, not a bug bounty report. The author wanted to understand how a common web security weakness called SQL Injection works, so they practised on a web application inside a controlled lab environment: a safe, isolated setup where you are allowed to break things. The report does not name the application, its owner, or the lab it ran in.

The short version of the story: the author looked around the application to see what pages and features it had (this looking-around is called reconnaissance), found a search box whose input is passed into a database query, and discovered that the search term could be manipulated to change that query. They then used a tool called SQLMap to explore the weakness and to see what information the database would give up. Finally, they wrote down what they learned about preventing this kind of bug.

If you have never done any security work, the useful thing to take from this is the shape of the process: understand the application, find a place where your input goes somewhere it should not be trusted, test carefully, and then think about the fix. Everything below explains each of those ideas from zero.

Setup

The author lists the tools and technologies used for the exercise:

  • Kali Linux
  • SQLMap
  • FFUF
  • cURL
  • Linux Terminal
  • Browser Developer Tools

What each of these is, in plain terms:

  • Kali Linux is a version of the Linux operating system that comes with many security testing tools pre-installed. Think of it as a toolbox computer rather than a normal desktop.
  • SQLMap is a command-line program that automates the testing of a parameter for SQL Injection. Instead of typing suspicious characters into a search box by hand and squinting at the results, you point SQLMap at a URL and it tries many techniques for you.
  • FFUF is a command-line tool for sending lots of requests quickly, commonly used to discover pages and files on a web server by trying many names. The report lists it as a tool used but does not show any FFUF command or output.
  • cURL is a command-line tool for making web requests. It is like a browser without the window: you give it a URL and it prints the server's response as text.
  • Linux Terminal is the text window where you type commands. All the command-line tools above are run from it.
  • Browser Developer Tools are the panels built into browsers (usually opened with F12) that show the requests a page makes, the responses it receives, and the HTML behind what you see. They are how you watch a web application's traffic without any extra software.

The report gives no account, role, credential or application version. The one precondition the author states for the whole exercise is that it ran in a controlled lab environment.

Finding it

Reconnaissance

The author began with reconnaissance: examining the target application to understand its structure, identify accessible pages, and discover potentially interesting endpoints.

A few terms first:

  • Reconnaissance is the information-gathering phase. Before testing anything, you learn what the application is made of: which pages exist, what features it offers, and where it accepts input from you. It is like walking around a building and reading the signs before you try any doors.
  • An endpoint is a specific address on a server that does one thing. When you type a web address, the part that identifies the particular page or action is the endpoint. A shop site might have one endpoint for the product list, another for search, another for checkout.
  • A parameter is a named piece of input attached to a request. In a URL, parameters usually come after a question mark, like ?q=shoes, where q is the parameter name and shoes is the value you supplied. A search box on a page typically ends up sending your words as a parameter.

The stated purpose of this phase was to see how the application communicates with its server and how information exposed through application resources can inform a security assessment. In other words: the pages, links and responses the application shows you are themselves clues about how it is built and where it might be weak. The report does not list the specific endpoints, directories or responses this phase produced.

The search functionality

Attention then moved to the application's search functionality. There, the author identified a SQL Injection vulnerability in the search parameter.

To understand why a search box is a classic place to look, you need to know roughly what happens behind it. A web application usually stores its content in a database: an organised store of data that can be asked questions. When you search, the application takes the word you typed and builds a question for the database, written in a language called SQL (Structured Query Language). The database answers, and the application shows you the matching results.

The danger is in how that question is built. If the application glues your text directly into the SQL sentence, then anything you type becomes part of the instruction, not just data to look for. SQL Injection is the name for that: supplying input that changes the meaning of the database query instead of merely being searched for. A simple comparison: if a form letter says "Dear [name]" and you write a whole extra paragraph in the name field, the letter now contains your paragraph as if the sender wrote it. The application has no way to tell your words from its own instructions.

The report does not show the request that first suggested the parameter was injectable, nor the response that confirmed it by hand. The move from observation to tooling is not documented in detail.

Exploitation

Step 1: Investigate the search parameter with SQLMap

With the vulnerable search parameter identified, the author used SQLMap to investigate the vulnerability and to work through different SQL Injection techniques. The report does not reproduce the SQLMap command line, the URL, the parameter name, or any tool output, so the exact invocation cannot be reconstructed from it.

The techniques the author explored with the tool were:

  1. Boolean-based Blind SQL Injection
  2. Error-based SQL Injection
  3. UNION-based SQL Injection
  4. Time-based Blind SQL Injection

Here is what each of those means, because the names sound worse than they are:

  • Boolean-based blind SQL Injection. A boolean is a yes/no value: true or false. Blind means the application does not show you the database's answer directly; you only see the normal page. The trick is to make the query ask a yes/no question, such as "is the first letter of the database name greater than 'm'?", and then watch whether the page changes. If a true condition gives a different page from a false one, you can ask questions one at a time and read data out of the answers. It is like guessing a word by asking "is it longer than five letters?" over and over.
  • Error-based SQL Injection. Here you deliberately send input that breaks the query's syntax. If the application shows the database's error message on the page, that message can reveal information about the database, and the fact that an error appeared at all tells you your input reached the query. It is the difference between a locked door that stays silent and one that rattles when pushed.
  • UNION-based SQL Injection. SQL has a UNION keyword that combines the results of two queries into one list. If you can append your own query to the application's query, the results of your query can appear on the page alongside the normal search results. This is the most direct technique when it works, because you see the data rather than inferring it.
  • Time-based blind SQL Injection. When the page shows no difference and no errors, you can still ask questions using time. You craft a condition that makes the database pause (for example, wait a few seconds) only when the condition is true. If the response comes back slowly, the answer was yes. It is slow and indirect, but it works when nothing else is visible.

SQLMap automates all of this: it sends many requests, compares responses, and reports which techniques the parameter is vulnerable to. The report does not include any of its output.

Step 2: Enumerate the database

Beyond confirming injectability, the author explored database enumeration, to understand how improperly handled database queries can expose sensitive information.

Enumeration means listing things out one by one: the names of the databases, then the tables inside one, then the columns inside a table, and only then the actual rows of data. Databases keep this structural information (called metadata) in their own catalogue, and an injection that lets you run your own queries can often read that catalogue too. Testers enumerate first because it maps the territory: you learn what exists before deciding what matters. As with the previous step, the report gives no commands and no enumerated output; it describes the activity and the lesson drawn from it rather than the artefacts.

Root cause

The report does not analyse the application's code. What it does say, in its takeaways, is that the weakness lies in how user-supplied input reaches the database: input was not treated as untrusted and validated before processing, and the database queries were improperly constructed, which is what allowed the search parameter to be manipulated.

The author frames the remedy in terms of parameterized queries, prepared statements and secure coding practices. Those two ideas are worth understanding:

  • A parameterized query (also called a prepared statement) is a way of writing a database query where the instruction and the data are kept separate. You write the SQL sentence with a placeholder, and then hand the database the user's value separately. The database treats that value strictly as data, so even if it contains SQL keywords, it cannot change the sentence. Going back to the form-letter comparison: instead of gluing the name into the text, you give the printer a blank line and a separate note saying what to fill in.
  • Input validation means checking what a user supplied before you use it: is it the right type, the right length, the right format? It is a useful layer, but for SQL Injection the decisive fix is keeping data out of the query text.

Impact

The author's stated concern is that manipulation of improperly constructed queries can compromise the confidentiality and integrity of data, and that database enumeration is the way a tester evaluates the potential impact and scope of such a vulnerability.

In plain terms: confidentiality means data staying private to those allowed to see it, and integrity means data staying correct and unaltered. A SQL Injection can threaten both, because improperly constructed queries can potentially compromise the confidentiality and integrity of data. The report does not quantify what data was reachable in this lab, does not describe any real user or system affected, and does not assign a severity. Because the exercise ran in a controlled environment, no production impact is claimed.

Fix

No fix is reported and no change to the application is described. The preventive measures the author names are parameterized queries, prepared statements and secure coding practices, together with validating all user-supplied input before processing it. These are presented as general mitigations for the class of vulnerability, not as something that was applied to this target.

Variants to test

These follow from the techniques the author worked through, applied to other targets:

  1. Boolean-based blind injection in a search parameter. Send a search term that is true under the application's logic and one that is false, and compare the two responses. A positive result is a consistent, reproducible difference in the page content or result count between the true and false conditions.
  2. Error-based injection. Supply input containing quote characters and other syntax that would break a naively built query. A positive result is a database error message surfacing in the response, which also tells you the backend in use.
  3. UNION-based injection. Attempt to append a UNION SELECT with a matching column count to the search term. A positive result is data from another table or expression appearing where search results should be.
  4. Time-based blind injection. Use a condition that causes a deliberate delay only when true. A positive result is a repeatable difference in response time that tracks the condition, which is useful when the application returns neither errors nor visible content differences.
  5. Database enumeration once injection is confirmed. Use the injection to walk metadata such as schema and table names before touching row data. A positive result is retrieval of schema information the search feature was never meant to expose.

In each case, run the test only against systems you are authorised to test, as the author did within a lab.

Key takeaways

The author closes with the lessons the exercise reinforced:

  • Input validation: treat all user-supplied input as untrusted and validate it appropriately before processing.
  • SQL Injection mechanisms: improperly constructed database queries can be manipulated, potentially compromising data confidentiality and integrity.
  • Security testing tools: familiarity with SQLMap and its role in identifying and assessing SQL Injection vulnerabilities.
  • Database enumeration: it helps a tester evaluate the potential impact and scope of a SQL Injection vulnerability.
  • Preventive security measures: parameterized queries, prepared statements and secure coding practices mitigate SQL Injection risks.

The author's own summary is that understanding a vulnerability is not just about knowing how it works, but also about recognising its potential impact and learning how to prevent it.

From the original on medium.com

Glossary

  • Boolean: a value that is either true or false.
  • Blind SQL Injection: injection where the application does not show the database's answer directly, so the tester infers it from indirect signals such as page differences or response timing.
  • cURL: a command-line tool for making web requests and printing the response.
  • Database: an organised store of data that an application can query.
  • Database enumeration: listing a database's structure (databases, tables, columns) and then its data, step by step.
  • Endpoint: a specific address on a server that performs one action or serves one resource.
  • Error-based SQL Injection: injection that deliberately breaks the query syntax so a database error message appears, revealing information or confirming the input reaches the query.
  • FFUF: a command-line tool for sending many web requests quickly, often used to discover pages and files.
  • Input validation: checking user-supplied input for type, length and format before using it.
  • Integrity: the property of data being correct and unaltered.
  • Kali Linux: a Linux distribution that ships with security testing tools.
  • Metadata: structural information about data, such as the names of databases, tables and columns.
  • Parameter: a named piece of input attached to a request, such as q in ?q=shoes.
  • Parameterized query: a database query written with placeholders so that user input is passed separately and cannot change the query's meaning.
  • Prepared statement: another name for a parameterized query.
  • Reconnaissance: the information-gathering phase of a security assessment, learning an application's structure and features.
  • SQL (Structured Query Language): the language used to ask questions of a database.
  • SQL Injection: supplying input that changes the meaning of a database query instead of being treated as plain data.
  • SQLMap: a command-line tool that automates testing a parameter for SQL Injection.
  • Time-based blind SQL Injection: injection that makes the database pause only when a condition is true, so response timing reveals the answer.
  • UNION-based SQL Injection: injection that appends a second query with the UNION keyword so its results appear alongside the application's own results.
  • Confidentiality: the property of data being visible only to those allowed to see it.

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.