---
description: >-
  https://portswigger.net/web-security/sql-injection/examining-the-database/lab-querying-database-version-mysql-microsoft
---

# SQL injection attack, querying the database type and version on MySQL and Microsoft

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FWgYGR3Q0thS01VQ03evB%2F1.png?alt=media&#x26;token=8b9e8467-8349-49e5-b802-d58aa647e4f2" alt=""><figcaption></figcaption></figure>

Let's filter for `Accessories`.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FIbhjshzFnzijpebpEWnZ%2F2.png?alt=media&#x26;token=0368d343-40e5-47b8-a41c-450e6263ea58" alt=""><figcaption></figcaption></figure>

Since we are proxying the traffic through Burp Suite, we can go to the `Proxy > HTTP History` tab to view this request.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FjOFMAPmc2AdtXoVD56pR%2F3.png?alt=media&#x26;token=4c7ab2b1-6ca5-4c34-985c-f14fead085d8" alt=""><figcaption></figcaption></figure>

Let's forward the request to the `Repeater` for further modification.&#x20;

Once in the `Repeater`, let's set the `category` parameter to the following:

```
' UNION SELECT 'test','test'#
```

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F2bIBLom6JXzqif4G0b7c%2F4.png?alt=media&#x26;token=9c44b6f8-ac0e-465b-9ff3-836fda02b69e" alt=""><figcaption></figcaption></figure>

Now that we know there are two columns, we can set the `category` parameter to the following:

```
' UNION SELECT `@@version`, NULL#
```

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FmQX6Tjb9SDFosPDZix5H%2F5.png?alt=media&#x26;token=b527d458-bfee-433d-9342-e3779c56da53" alt=""><figcaption></figcaption></figure>

We have solved the lab.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FJ8jGin7ph3IRnsAChv7M%2F6.png?alt=media&#x26;token=b31af8f4-77d5-484d-99f3-07478c1ff094" alt=""><figcaption></figcaption></figure>
