跳至主要內容

隱根 (roothide) 環境有何特殊?

隱根 (roothide) 是有別於有根 (rootful) 和無根 (rootless) 的第三種越獄環境。


與有根 (rootful) 及無根 (rootless) 的區別

與傳統越獄不同,roothide 環境中越狱根 (jbroot)系统根 (rootfs) 是相互隔離的。
越狱根 掛載於 系统根 中的一個隨機路徑,同時 系统根 也反向掛載於 越狱根/rootfs/ 路徑上。

系統根 rootfs

在 roothide 環境中,系统根 即 iOS 系統的原始根目錄,未經任何修改,不包含額外路徑。

越獄根 jbroot

越狱根 掛載於 系统根 下的一個隨機路徑,
通常位於 /var/containers/Bundle/Application/.jbroot-XXXXXXXXXXXXXXXX/(長串 X 為隨機值)。
通過 jbroot 函式,可以將普通路徑轉換為越獄根中的對應路徑。
例如,要訪問越獄根中的 /var/mobile/Media/1.txt,應使用 jbroot("/var/mobile/Media/1.txt")
在腳本中執行 f = io.open(jbroot("/var/mobile/Media/1.txt"), "r") 時,實際打開的檔案為:

/var/containers/Bundle/Application/.jbroot-XXXXXXXXXXXXXXXX/var/mobile/Media/1.txt

Shell 環境

如前所述,越獄根掛載於系統根中的一個隨機路徑。
然而在 Shell 環境中(例如 deb 安裝腳本),無法預知越獄根在系統根中的具體位置。
因此,roothide 將 Shell 腳本的運行時根設定為越狱根
也就是說,deb 中的 /Applications/XXTExplorer.app 實際會被安裝到:

/var/containers/Bundle/Application/.jbroot-XXXXXXXXXXXXXXXX/Applications/XXTExplorer.app

這確保了 deb 安裝的越獄插件不會污染系统根
但這也引入了一個問題:在 XXTouch 中使用 os.executeio.popen 時,
由於這些函式通過 bash/zsh 執行 Shell 腳本,
呼叫 os.execute("/usr/bin/hidutil list") 實際執行的命令是:

/var/containers/Bundle/Application/.jbroot-XXXXXXXXXXXXXXXX/usr/bin/hidutil list

這導致無法直接從 Shell 中訪問系統根路徑。
為此,roothide 將系统根反向掛載到了越狱根/rootfs/
於是,在腳本中執行 os.execute("/rootfs/usr/bin/hidutil list") 時,實際運行的命令就是:

/usr/bin/hidutil list

檔案及目錄鏡像

越狱根中的部分檔案和目錄路徑已設定為指向原始系统根的符號連結:

越獄根中的路徑
/dev
/private/preboot
/var/containers
/var/mobile/Containers
/usr/share/misc/trace.codes
/usr/share/zoneinfo
/etc/hosts.equiv
/etc/hosts
/var/run/utmpx
/var/db/timezone
/System/Library/CoreServices/SystemVersion.plist

此外,XXTouch 的腳本路徑 /var/mobile/Media/1ferver 也會在系统根中建立對應的符號連結。
上述路徑在越狱根系统根中均可直接訪問。
參考來源

XXTouch 於 Bootstrap 環境說明

無自動啟動

使用 Bootstrap-Roothide 半越獄的裝置在重啟並重新激活 Bootstrap 後,XXTouch 後台服務不會自動啟動。
需要手動打開 XXTouch App,應用會自動退出並顯示 Starting XXTouch Daemon...,約 20 秒後後台服務即可就緒。

無桌面服務

若使用 Bootstrap 但未通過 Serotonin 激活桌面注入服務,XXTouch 腳本中與介面相關的功能將不可用:

  • dialogwebview 等在頂層視窗建立介面的功能會受到影響
  • alerthelper 處理桌面彈窗的功能無法工作

使用 XXTouch 清理 Bootstrap-Roothide 環境中可能被 App 檢測到的檔案

local noexecute = require('no_os_execute')

function remove_sys_app_caches(name)
noexecute.rm_rf('/var/root/Library/WebKit/'..name)
noexecute.rm_rf('/var/root/Library/Caches/'..name)
noexecute.rm_rf('/var/root/Library/HTTPStorages/'..name)
noexecute.rm_rf('/var/root/Library/SplashBoard/Snapshots/'..name)
noexecute.rm_rf('/var/root/Library/Saved Application State/'..name..'.savedState')
noexecute.rm_rf('/var/root/Library/Preferences/'..name..'.plist')

noexecute.rm_rf('/var/root/Library/WebKit/'..name)
noexecute.rm_rf('/var/mobile/Library/Caches/'..name)
noexecute.rm_rf('/var/mobile/Library/HTTPStorages/'..name)
noexecute.rm_rf('/var/mobile/Library/SplashBoard/Snapshots/'..name)
noexecute.rm_rf('/var/mobile/Library/Saved Application State/'..name..'.savedState')
noexecute.rm_rf('/var/mobile/Library/Preferences/'..name..'.plist')
end

remove_sys_app_caches('com.opa334.Dopamine')
remove_sys_app_caches('org.coolstar.SileoStore')
remove_sys_app_caches('ws.hbang.Terminal')
remove_sys_app_caches('pisshill.usprebooter')
remove_sys_app_caches('com.samiiau.loader')
remove_sys_app_caches('kr.xsf1re.vnodebypass')
remove_sys_app_caches('com.serena.Antoine')
remove_sys_app_caches('wiki.qaq.TrollFools')
remove_sys_app_caches('com.tigisoftware.Filza')
remove_sys_app_caches('com.tigisoftware.Filza000')
remove_sys_app_caches('com.tigisoftware.ADManager')
remove_sys_app_caches('com.ichitaso.otadisablerts')
remove_sys_app_caches('chaoge.ChargeLimiter')
remove_sys_app_caches('com.xxtouch.XXTExplorer')

noexecute.rm_rf('/private/var/mobile/Library/Filza')
noexecute.rm_rf('/private/var/mobile/.ssh')
noexecute.rm_rf('/private/var/root/.ssh')
noexecute.rm_rf('/private/var/mobile/offsets.txt')
noexecute.rm_rf('/private/var/mobile/offsets.txt')
noexecute.rm_rf('/private/var/mobile/Serotonin.jp2')
noexecute.rm_rf('/private/var/mobile/Documents/kfund_offsets.plist')
noexecute.rm_rf('/private/var/iomfb_bics_daemon')

為甚麼會存在這些檔案?
雖然 Roothide 將越獄應用安裝到了隨機路徑中,但並未限制這些應用的運行時行為。
因此,越獄應用運行後產生的快取或其他檔案,仍然會寫入到系統根的對應位置。

此外,App 還可能檢測 SSH 連接埠。如有必要,可在 Bootstrap 設定介面中關閉 SSH 服務以避免被檢測。