背景
前兩周(2021年2月末)诀豁,突然我的電腦(MacBook Pro v10.15.7)打開不了Safari,重啟之后又可以了窥妇。一開始沒(méi)在意舷胜,后面每次重啟電腦之后及時(shí)打開Safari,中間似乎莫名其妙被強(qiáng)制退出活翩,中間咨詢Apple客服烹骨,回答模棱兩可(1.重置硬件SMC、安全啟動(dòng))似乎都沒(méi)效果材泄。后面異常問(wèn)題逐漸凸顯沮焕,最終鎖定是‘XCSSET Malware’。
XCSSET Mac Malware: Infects Xcode Projects, Performs UXSS Attack on Safari, Other Browsers, Leverages Zero-day Exploits - TrendLabs Security Intelligence Blog
事件經(jīng)過(guò)
從問(wèn)題開始到最終確定原因拉宗,大致花了半個(gè)月峦树,以下是我個(gè)人的事件經(jīng)過(guò):
Safari異常
Safari無(wú)故被強(qiáng)退,重新打開后旦事,沒(méi)法同步ITunes賬號(hào)信息魁巩,導(dǎo)致Safari的個(gè)人收藏?zé)o法顯示。同時(shí)程序塢出現(xiàn)兩個(gè)Safari圖標(biāo)姐浮,一個(gè)可以點(diǎn)擊谷遂,另外一個(gè)無(wú)效
系統(tǒng)異常
系統(tǒng)的隱私多出很多com.net.core.xxx.app的異常APP程序,例如:/Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared
開機(jī)自啟動(dòng)的進(jìn)程卖鲤,強(qiáng)制刪除這些進(jìn)程肾扰,Safari可以正常打開
在“活動(dòng)監(jiān)視器”>“信息”>“打開文件和端口”中檢查
cwd / txt /Applications/Finder.app/Contents/MacOS/com.net.core.cputime.app/Contents/MacOS/applet txt /Library/Preferences/Logging/.plist-cache.r65cTIFH txt /usr/share/icu/icudt64l.dat txt /System/Library/Components/AppleScript.component/Contents/MacOS/AppleScript txt /Library/Application Support/CrashReporter/SubmitDiagInfo.domains txt /private/var/db/analyticsd/events.whitelist txt /private/var/db/timezone/tz/2021a.1.0/icutz/icutz44l.dat txt /System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/SystemAppearance.car txt /System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAquaAppearance.car txt /private/var/folders/h2/9pg_fk2x7sjbnskd5kn65xq40000gn/0/com.apple.LaunchServices.dv/com.apple.LaunchServices-1082-v2.csstore txt /usr/lib/libobjc-trampolines.dylib txt /System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/Assets.car txt /System/Library/Fonts/SFNS.ttf txt /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc txt /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/zh_CN.lproj/Localized.rsrc txt /private/var/folders/h2/9pg_fk2x7sjbnskd5kn65xq40000gn/C/com.apple.IntlDataCache.le.kbdx txt /System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/FunctionRowAppearance.car txt /private/var/db/mds/messages/501/se_SecurityMessages txt /private/var/folders/h2/9pg_fk2x7sjbnskd5kn65xq40000gn/C/com.apple.scriptmanager2.le.cache txt /System/Library/CoreServices/SystemAppearance.bundle/Contents/Resources/DarkAppearance.car txt /System/Library/Fonts/PingFang.ttc txt /System/Library/Fonts/Helvetica.ttc txt /System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat txt /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/MacOS/StandardAdditions txt /usr/lib/dyld 0 /dev/null 1 /dev/null 2 /dev/null 3 /Library/Application Support/CrashReporter/SubmitDiagInfo.domains 4 /Applications/Finder.app/Contents/MacOS/com.net.core.cputime.app/Contents/Resources/applet.rsrc 5 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/HIToolbox.rsrc 6 /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/zh_CN.lproj/Localized.rsrc </pre>
對(duì)應(yīng)打開的/Users/yjs/Library/Containers/com.apple.routerd/Containers/
還會(huì)隱藏在其他常見的APP,例如微信
同時(shí)還會(huì)偽裝成Finder.app在/Applications/Finder.app(實(shí)際位置:/System/Library/CoreServices/Finder.app)
有時(shí)候開機(jī)啟動(dòng)自動(dòng)彈出對(duì)應(yīng)的腳本程序?qū)υ捒?/p>
Xcode異常
剛好自己最近和小伙伴在開發(fā)一個(gè)Xcode項(xiàng)目(iOS混淆工具)扫尖,前一陣子逐漸發(fā)現(xiàn)異樣白对。
項(xiàng)目build之后工程文件下出現(xiàn):xcuserdata/.xcassets/Assets.xcassetsimage.pngimage.png
以及confuse_test.xcodeproj->project.pbxproj文件出現(xiàn)看似‘正常的Build Phase’
image.png
image.png
刪除又會(huì)報(bào)錯(cuò)誤:
xcuserdata/.xcassets/Asset.xcasset: No such file or directory
image.png
一開始沒(méi)在意以為是新版Xcode一些特性,因?yàn)樗械捻?xiàng)目都出現(xiàn)這個(gè)項(xiàng)目换怖,同事也一樣(他的Safari又正常)甩恼,可見這個(gè)病毒很雞賊啊。關(guān)鍵還是隱藏目錄沉颂,名字還Assets.xcassets
甚是親民条摸,欺負(fù)誠(chéng)實(shí)的程序員,套路很深铸屉。后面我好奇打開看了下钉蒲,
妥妥的執(zhí)行程序malloc準(zhǔn)沒(méi)好事
image.png
關(guān)鍵是刪除之后,只要是其他項(xiàng)目打開有死灰復(fù)燃彻坛,打不死的小強(qiáng)image.png
別人拷貝你的項(xiàng)目顷啼,也會(huì)中招踏枣,類似新冠病毒XCSSET_Technical_Brief.pdf報(bào)告說(shuō)了會(huì)影響很多地方,無(wú)奈啊
掙扎過(guò)程
問(wèn)題找到了‘趨勢(shì)科技披露了一件與 Xcode 開發(fā)者項(xiàng)目有關(guān)的惡意感染事件’钙蒙,原本想問(wèn)問(wèn)Apple能有什么靈丹妙藥茵瀑,回復(fù)以下:
試了下malwarebytes,沒(méi)有掃出來(lái)躬厌,難道我用的方式不對(duì)马昨。如果有小伙伴發(fā)現(xiàn)有用,麻煩告知一聲扛施,多謝了鸿捧。
朋友試了Trend Micro Home Security for Mac,好像沒(méi)啥用
查看哪些項(xiàng)目感染:命令執(zhí)行
> sudo find 此處填寫文件夾路徑 -name '.xcassets'
> grep "xcuserdata/.xcassets" -rl 此處填寫文件夾路徑
> ps -ef | grep "com\..*\.core\..*\.app
> sudo find / -name '.xcassets'
/System/Volumes/Data/Users/yjs/Downloads/Swift-30-Projects-master/Project 22 - HonoluluArt/HonoluluArt.xcodeproj/xcuserdata/.xcassets
/System/Volumes/Data/Users/yjs/Downloads/Swift-30-Projects-master/Project 07 - PokedexGo/PokedexGo.xcodeproj/xcuserdata/.xcassets
...
> grep "xcuserdata/.xcassets" -rl ~/Desktop/coding520
/Users/yjs/Desktop/coding520/confuse_ios.zip
/Users/yjs/Desktop/coding520/confuse_mac/confuse_mac.xcodeproj/project.pbxproj
/Users/yjs/Desktop/coding520/confuse_template/confuse_template.xcodeproj/project.pbxproj
...
> ps -ef | grep "com\..*\.core\..*\.app"
501 58798 1 0 8:14下午 ?? 0:02.04 /Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared/Containers/com.service.core.graphics.app/Contents/MacOS/applet -psn_0_655520
501 61691 1 0 8:20下午 ?? 0:26.42 /Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared/Containers/com.net.core.security.app/Contents/MacOS/applet -psn_0_700587
501 61752 1 0 8:20下午 ?? 0:02.69 /Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared/Containers/com.net.core.bootcamp.app/Contents/MacOS/applet -psn_0_704684
501 76817 1 0 8:36下午 ?? 0:00.82 /Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared/Containers/com.net.core.graphics.app/Contents/MacOS/applet -psn_0_725169
501 82036 1 0 8:42下午 ?? 0:03.93 /Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared/Containers/com.service.core.security.app/Contents/MacOS/applet -psn_0_770236
501 82150 1 0 8:42下午 ?? 0:03.87 /Users/yjs/Library/Application Scripts/com.apple.AddressBook.Shared/Containers/com.service.core.bootcamp.app/Contents/MacOS/applet -psn_0_774333
...
我的全部中招
我的解決方式(很雞肋疙渣,待更新):
-
準(zhǔn)備階段:
- 修改root密碼
- 壓縮備份代碼
- 創(chuàng)建備用倉(cāng)庫(kù)反砌,備份當(dāng)前git歷史記錄
-
Xcode項(xiàng)目益兄,解決方式兩種:
- 穩(wěn)妥:移除Pod、.git,新建工程只拷貝源碼和自己的資源括丁,xxx.xcodeproj丟棄沿量,重置當(dāng)前的倉(cāng)庫(kù)
- 快捷:使用本人的開發(fā)‘工具’查殺黄绩,效果如下:
-
Mac系統(tǒng):
-
慢慢移除非必要軟件噪奄,最后一口氣重裝系統(tǒng)(中毒太深了,無(wú)法保證徹底查殺)
image.png
-
最近了解
蘋果修復(fù)被 XCSSET 惡意軟件濫用的3個(gè) 0day
- 該惡意軟件最早現(xiàn)身于2020年8月刷钢,隱藏在托管在 GitHub 上的惡意 Xcode 項(xiàng)目中笋颤。
- 它被指利用了兩個(gè) 0day exploit。第一個(gè)用于竊取 Safari 瀏覽器 cookie内地,第二個(gè)用于繞過(guò)提示安裝開發(fā)者版本的 Safari 應(yīng)用程序伴澄。
- 該 0day 打包為一個(gè) AppleScript,可使惡意軟件繞過(guò) Transparency Consent 和Control阱缓。它是一種 macOS 服務(wù)非凌,每當(dāng) app 想要執(zhí)行入侵行動(dòng)時(shí)就會(huì)彈出權(quán)限提示,這些入侵行為包括使用攝像頭荆针、麥克風(fēng)或者記錄用戶的屏幕和按下鍵盤敞嗡。
- XCSSET 惡意軟件團(tuán)伙濫用 CVE-2021-30713 搜素 macOS 中其它 app 的 ID。這些 app 接受了一個(gè)危險(xiǎn)權(quán)限航背,之后在其中一個(gè)合法 app 中植入一個(gè)惡意小程序執(zhí)行惡意動(dòng)作喉悴。
蘋果公司已經(jīng)在 macOS Big Sur 11.4 安全更新中修復(fù)了 TCC。仍然運(yùn)行老舊版本 macOS 的蘋果用戶易受攻擊玖媚,建議更新系統(tǒng)箕肃。
雖然 XCSSET 惡意軟件及其分發(fā)活動(dòng)主要是針對(duì)開發(fā)人員,但其它惡意軟件團(tuán)伙也可能利用報(bào)告中提供的信息更新代碼今魔,并濫用 CVE-2021-30713 執(zhí)行攻擊勺像。這也是為何建議 macOS 用戶更新至最新版本 macOS Big Sur 11.4 的原因所在障贸。
求助
有哪位大神能夠妙手回春,懇請(qǐng)閣下出山吟宦,拯救黎明蒼生惹想,不勝感激
參考
- https://www.reddit.com/r/iOSProgramming/comments/i9mwqt/xcsset_mac_malware_infects_xcode_projects/
- https://www.trendmicro.com/en_us/research/20/h/xcsset-mac-malware--infects-xcode-projects--uses-0-days.html
- 年度盤點(diǎn) | 2020重大網(wǎng)絡(luò)安全事件 · 互聯(lián)網(wǎng)篇
- https://www.trendmicro.com/en_us/research/20/h/xcsset-mac-malware--infects-xcode-projects--uses-0-days.html
- https://therecord.media/apple-fixes-macos-zero-day-abused-by-xcsset-malware/