作者:
國士無雙
·
2013/12/16 16:52
0x00 楔子
近日,小明有了一樁煩心事,擾的他寢食難安。原來是女神的某安卓手機出了怪病,簡訊收不到,發出去別人也收不到,更可氣的是女神用來準備網購的錢都被神秘刷走。當女神滿心焦躁翻遍通訊錄時,驀然發現了小明的備註:千斤頂17號-電腦、刷機。於是在女神可憐巴巴大眼睛的注視下,小明把胸脯拍的山響,承諾一天搞定。
於是,小明拿到了夢寐以求的女神手機。可沒想到,後面發生的事讓他始料未及。
0x01 鎖定元兇
拿到手機的第一件事,就是找到收不到簡訊的原因。翻了翻系統簡訊設定和APP,裝的東西都很正常,沒有發現可疑的空白圖示,用軟體管理工具檢視,也沒有發現可疑的跡象。於是小明從系統程式開始排查,果不然,在開啟“谷歌商店”時,發現了狐狸尾巴。
如下圖所示,第一,在未聯網時點選這種APP會提示“手機無法聯網”。


第二,在聯網時點選這種APP會提示一大堆許可權要求和出現“網路正常”提示

看到這,小明笑了,這不就是最正火的簡訊攔截馬嘛。於是果斷把手機透過豌豆莢匯出目標APK檔案包。如圖所示


看著桌面上不到100KB的簡訊馬,小明默默的繫上了圍裙(安卓虛擬環境),找出了手術刀(反編譯工具dex2jar+Xjad),把馬兒按到在解剖臺(Eclipse)上。

0x02 庖丁解牛
首先,小明把APK檔案解壓,然後找到關鍵的classes.dex檔案。他是APK檔案的java原始碼編譯檔案。

然後把classes.dex 複製到dex2jar目錄下,然後cmd進入dex2jar目錄後再輸入:dex2jar.bat classes.dex 回車,同目錄下就得到我們想要的原始碼包:classes_dex2jar.jar


再請出我們的jar反編譯Xjad,點選檔案-反編譯jar-選擇上把生成的jar檔案,就會反編譯成原始碼資料夾。


到這一步,我們的牛算是初步分解成功了,下面就是如何找出我們要的菲力牛排~
0x03 輕撫菊花
反編譯後分析出木馬和後臺互動是透過呼叫c#的WebService協議,而且菊花的IP是加密的,呼叫程式碼圖如下:

直接把加密程式碼,按圖索驥找到加密函式後,反編譯過來發現如下:

執行後,直接爆到伺服器端的地址http://103.X.X.X/priv1/baseservice.asmx
至此,找準了菊花的所在。下面開始研究爆菊啦
0x04 長驅注入( 爆菊部分由sql test大牛完成)
既然找到後臺地址了,下面怎麼來拿下這後臺,這是頭疼的問題,用工具掃描了下沒發現什麼漏洞,本人能力有限。看樣子只能從站點下手了,重新整理下思路,把http://103.X.X.X/priv1/baseservice.asmx輸入到瀏覽器發現

有這麼幾個方法,既然有方法可以我直接用下,開啟程式引用了WebService 程式碼如下:

本來想試試XSS ,用AddCall方法插入到資料庫,程式碼如下

呼叫了下發現報錯

無語了,既然有SQL 注入,下面我們來說下這WebService SQL 注入。
挑選了一個獲取方法getOrders ,呼叫的時候把引數加了一個單引號提示MYSQL錯誤,這注入點也太多了吧
以下就改造了查詢語句

返回了XML:
<?xml version="1.0" encoding="UTF-8"?><RootJob><Job><Type>9</Type><Content>3</Content><Phone>2</Phone><JobID>1</JobID></Job></RootJob>
這個一看就知道了,下面的步驟就不詳細寫,是root注入。
寫入一句話,目標是IIS,我也沒找到目錄程式目錄,直接試了C:Inetpubwwwroot 寫了一個Aspx馬上去了,在瀏覽器上訪問成功了。

基本上完成了,剩下的就是提權了,在一個朋友的幫助下提權成功。
0x05 擴大戰果
這時已經透過mysql拿到了伺服器的許可權,檢視登錄檔發現埠是55555,伺服器版本為2003R2,加了個使用者就進去看看。

東西不復雜,IIS+mysql+C#的WebService

把mysql做了個遠端,本地連上看看。一看之下,這個團伙透過簡訊馬監控到被害者的內容令小明大吃一驚。

在SO這個庫裡,小明發現N多受害人的資訊,包括大額的銀行轉賬提示。如果這種簡訊被攔截的話,那後果可想而知。

0x06 挖掘產業鏈
但凡一個行業必須是有利可圖的,小明既然發掘到了源頭,就逆流而上,去深挖一下,安卓簡訊攔截馬的整個產業鏈條。
說幹就幹,小明在電腦上輸入簡訊攔截馬、簡訊馬 出售等相關關鍵詞,發現有很多人在釋出相關的需求。

而是各種地下論壇裡,很多相關求馬的帖子。
他們買來主要就是為了詐騙。
或冒充熟人詐騙,或為了誘騙網銀,或為了某些不可告人的秘密勾當。
隨機找了個例子。

小明透過對程式碼的分析,發現簡訊馬的執行方式是這樣的。
一旦安裝了木馬的手機,並授權給木馬後,木馬會立刻上傳受害手機的通訊錄。該手機的所有簡訊來往都會發給指定的手機號,而且該手機號可以使用程式碼,來指揮木馬進行偽造簡訊。從而實施詐騙的目的


本文章來源於烏雲知識庫,此映象為了方便大家學習研究,文章版權歸烏雲知識庫!