1、mediaserverd是什么 

  mediaserverd(/usr/sbin/mediaserverd)是被root进程launchd启动的一个后台(daemon)进程,其描述文件为com.apple.mediaserverd.plist存放在
  /System/Library/LaunchDaemon目录下,系统在启动的时候会扫描该目录下面所有的plist文件,分别启动所有后台进程,大概有
  50多个,后台进程是iOS系统实现伪后台的真正原因。

  

  com.apple.mediaserverd.plist 描述了mediaserverd启动、以及服务的相关信息,mediaserverd主要为系统提供音视频编解码的服务,包含声音输出录音,视频解码编码等。

  通过plist中 com.apple.airplay.sender.xpc 的描述,可以看出来mediaserverd提供了一个xpc的服务

  XPC是苹果系统上一种进程间通信的技术,XPC 目的是提高 App 的安全性和稳定性。XPC 让进程间通信变得更容易,让我们能够相对容易地将 App 拆分成多个进程的模式。

<key>MachServices</key>
<dict>
<key>com.apple.BTAudioHALPlugin.xpc</key>
<true/>
<key>com.apple.airplay.sender.xpc</key>
<true/>
<key>com.apple.audio.AUPBServer</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.audio.AURemoteIOServer</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.audio.AudioConverterServer</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.audio.AudioFileServer</key>
<true/>
<key>com.apple.audio.AudioQueueServer</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.audio.AudioSession</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.audio.AudioUnitServer</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.audio.SystemSounds</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.admin</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.asset</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.assetimagegenerator</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.audiodeviceclock</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.audioprocessingtap</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.cpe</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.cpeprotector</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.endpoint</key>
<true/>
<key>com.apple.coremedia.formatreader</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.mutablecomposition</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.recorder</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.remaker</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.sandboxserver</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.videocompositor</key>
<true/>
<key>com.apple.coremedia.videoqueue</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.virtualdisplay</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.coremedia.virtualdisplayserver</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.fig.movie</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.mediaserverd</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.videoconference.avconference</key>
<dict>
<key>ResetAtClose</key>
<true/>
</dict>
<key>com.apple.videoconference.camera</key>
<dict/>
</dict>

2、mediaserverd进程的作用和工作原理

  mediaserverd提供音视频服务功能,用户app进程通过调用xpc服务,对视频进行解码编码。

  xpc调用参考:https://objccn.io/issue-14-4/

  音视频的解码涉及到对硬件的操作,mediaserverd中包含大量调用驱动层的代码,通过xpc可以防止用户进行溢出攻击,提高系统的稳定性。因为同一的xpc接口,跨进程,提高了溢出攻击伪造数据的难度。

  在越狱手机上通过对mediaserverd中声音的服务进行hook,可以进行录音,比如通话录音等。

3、mediaserverd 中有用的方法

  通过反汇编发现mediaserverd由C编写,不是mach-o格式的二进制文件,反汇编之后暴露出来的符号较少,通过class-dump无法提取有用信息。

  下面是一段播放系统铃音的代码

int sub_b4fc() {
sp = sp - 0x8;
r0 = *0x23b50;
if (r0 != 0x0) goto loc_b5fc; loc_b514:
r0 = dlopen("/System/Library/PrivateFrameworks/MediaToolbox.framework/MediaToolbox", 0x1);
*(0x23b50 + 0x4) = r0;
if (r0 != 0x0) goto loc_b54a; loc_b528:
r1 = dlopen("/System/Library/PrivateFrameworks/Celestial.framework/Celestial", 0x1);
r0 = 0x21666967;
*(0x23b50 + 0x4) = r1;
if (r1 == 0x0) goto .l3; loc_b54a:
dlerror();
*0x23b50 = dlsym(*(0x23b50 + 0x4), "FigMediaServerStart");
r0 = dlerror();
if ((r0 != 0x0) || (*0x23b50 == 0x0)) goto loc_b600; loc_b56e:
*(0x23b50 + 0x8) = dlsym(*(0x23b50 + 0x4), "FigMediaServerStop");
r0 = dlerror();
if ((r0 != 0x0) || (*(0x23b50 + 0x8) == 0x0)) goto loc_b600; loc_b58e:
*(0x23b50 + 0xc) = dlsym(*(0x23b50 + 0x4), "FigMediaServerSystemSoundIDShouldPlayWithVolume");
r0 = dlerror();
if ((r0 != 0x0) || (*(0x23b50 + 0xc) == 0x0)) goto loc_b600; loc_b5aa:
*(0x23b50 + 0x10) = dlsym(*(0x23b50 + 0x4), "FigMediaServerVibrateForSystemSoundID");
r0 = dlerror();
if ((r0 != 0x0) || (*(0x23b50 + 0x10) == 0x0)) goto loc_b600; loc_b5c6:
*(0x23b50 + 0x14) = dlsym(*(0x23b50 + 0x4), "FigMediaServerSystemSoundIDActivate");
r0 = dlerror();
if ((r0 != 0x0) || (*(0x23b50 + 0x14) == 0x0)) goto loc_b600; loc_b5e2:
r4 = 0x23b50;
asm{ ldrd r0, r1, [r0] };
asm{ stm.w sp, {r0, r1} };
FigRecalcSumIndex();
r0 = *r4;
goto loc_b5fc; loc_b5fc:
r0 = (r0)(r0);
return r0; .l3:
return r0; loc_b600:
r1 = "%s\n";
r3 = *___stderrp;
fprintf(r3, r1);
r0 = 0x21666967;
return r0;
}

  

mediaserverd的更多相关文章

  1. iOS开发-应用崩溃日志揭秘(一)

    作为一名应用开发者,你是否有过如下经历? 为确保你的应用正确无误,在将其提交到应用商店之前,你必定进行了大量的测试工作.它在你的设备上也运行得很好,但是,上了应用商店后,还是有用户抱怨会闪退 ! 如果 ...

  2. iOS开发--应用崩溃日志揭秘(二)

    场景 4: 吃棒棒糖时闪退! 用户邮件说, “当rage master吃棒棒糖时应用就闪退…” 另一用户说, “我让rage master 吃棒棒糖,没几次应用就闪退了!”崩溃日志如下: Incide ...

  3. iOS测试常见崩溃

    什么是崩溃日志,从哪里能得它? iOS设备上的应用闪退时,操作系统会生成一个崩溃报告,也叫崩溃日志,保存在设备上.崩溃日志上有很多有用的信息,包括应用是什么情况下闪退的.通常,上面有每个正在执行线程的 ...

  4. 【转】iOS应用崩溃日志分析

    作为一名应用开发者,你是否有过如下经历?   为确保你的应用正确无误,在将其提交到应用商店之前,你必定进行了大量的测试工作.它在你的设备上也运行得很好,但是,上了应用商店后,还是有用户抱怨会闪退 ! ...

  5. 【转】iOS应用崩溃日志揭秘2

    这篇文章还可以在这里找到 英语 场景 4: 吃棒棒糖时闪退! 用户邮件说, "当rage master吃棒棒糖时应用就闪退-" 另一用户说, "我让rage master ...

  6. 【转】iOS应用崩溃日志揭秘

    这篇文章还可以在这里找到 英语 If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter ...

  7. IOS高级开发~开机启动&无限后台运行&监听进程

    一般来说, IOS很少给App后台运行的权限. 仅有的方式就是 VoIP. IOS少有的为VoIP应用提供了后台socket连接,定期唤醒并且随开机启动的权限.而这些就是IOS上实现VoIP App的 ...

  8. 用 iOS-System-Services 框架获取iOS设备所用的设备信息

    参考资料地址 https://github.com/Shmoopi/iOS-System-Services 百度云盘下载地址 http://pan.baidu.com/s/1c05ot1m This ...

  9. 网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch

    Getting Started: Building for Apple iPhone, iPad and iPod Touch ¶ Getting Started Preparation Get th ...

  10. iOS 越狱Keynote

    [iOS Keynote] 1.2009年暴露的IKee病毒是iOS上公开的第一款蠕虫病毒,它会感染那些已经越狱并且安装了SSH,但是又没有更改其默认root密码"alpine"的 ...

随机推荐

  1. linux 性能自我学习 ———— 软中断 [五]

    前言 linux 性能的自我学习. 正文 什么是软中断呢? 举一个网络的例子. linux 将中断处理过程分为两个阶段: 上半部用来快速处理中断,他在中断禁止模式下运行,注意是处理跟硬件紧密相关或时间 ...

  2. c# MVC BundleConfig详解

    前言 因为有很多库在.net core还没有实现迁移,所以呢,我们有时候还是需要的. 这些事什么意思呢? 举一个例子: bundles.Add(new StyleBundle("~/Cont ...

  3. leetcode每日一题:409. 最长回文串

    409. 最长回文串 给定一个包含大写字母和小写字母的字符串,找到通过这些字母构造成的最长的回文串. 在构造过程中,请注意区分大小写.比如 "Aa" 不能当做一个回文字符串. 注意 ...

  4. js中“??“和“?.“怎么用?

    ??:空值合并操作符 逻辑操作符,左侧为null和undefined时,才返回右侧的数const sum = null ?? 12console.log(sum);//输出12const sum1 = ...

  5. Node 中的 Process 理解,有哪些常用方法?

    一.是什么 process 对象是一个全局变量,提供了有关当前 Node.js进程的信息并对其进行控制,作为一个全局变量 我们都知道,进程计算机系统进行资源分配和调度的基本单位,是操作系统结构的基础, ...

  6. pypinyin 获取拼音,作为智能设备的唤醒比对结果

    from pypinyin import lazy_pinyin,TONE,TONE2,TONE3,NORMAL a = "小七同学" b = "小琦同学" c ...

  7. el-tree选中子级时默认选中父级(角色授权)

    问题1:选中子级时默认选中父级 <el-tree :data="menuData" show-checkbox default-expand-all node-key=&qu ...

  8. 高性能消息中间件-Nats使用

    一.Nats简介 官网:https://nats.io/ 官网下载:https://nats.io/download/ github:https://github.com/nats-io/nats-s ...

  9. 揭露 FileSystem 引起的线上 JVM 内存溢出问题

    作者:来自 vivo 互联网大数据团队-Ye Jidong 本文主要介绍了由FileSystem类引起的一次线上内存泄漏导致内存溢出的问题分析解决全过程. 内存泄漏定义(memory leak):一个 ...

  10. 如何用python运用ocr技术来识别文字

    要先安装ocr技术,也就是光学符号识别,通过扫描等光学输入方式将各种票据.报刊.书籍.文稿及其他印刷品的文字转化为图像信息,再利用文字识别技术将图像信息转化为可以使用的文本的技术(我在百度百科抄的), ...