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. Jenkins实战系列(一)——Jenkins简介

    Jenkins是一个开源的自动化构建工具,可以帮助开发人员自动构建.测试和部署软件.它支持多种编程语言.版本控制系统和构建工具,如Java.Git.Maven等.Jenkins的核心功能是通过一系列插 ...

  2. easyx的使用

    本操作集根据B站学习,借鉴: 视频链接:[C/C++/EasyX]学编程,做游戏,小白快速入门图形编程,零基础入门到精通,学习就是这么快乐_哔哩哔哩_bilibili 初始化时要进行的操作: 记得调用 ...

  3. 存储过程编写·记(“xxx“在需要下列之一:if)

    存储过程编写·记("xxx"在需要下列之一:if) 使用的数据库为Oracle数据库,数据库客户端为DBeaver 简单来说,就是使用SQL语句进行一些函数编写,进而进行一些过滤啊 ...

  4. 剑指offer03(Java)-数组中重复的数字(简单)

    题目: 找出数组中重复的数字. 在一个长度为 n 的数组 nums 里的所有数字都在 0-n-1 的范围内.数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次.请找出数组中任 ...

  5. 模仿Spring实现一个类管理容器

    ​简介: 项目的初衷是独立作出一个成熟的有特色的IOC容器,但由于过程参考Spring太多,而且也无法作出太多改进,于是目的变为以此项目作为理解Spring的一个跳板,与网上的一些模仿Spring的框 ...

  6. [K8s] Pod 与容器设计模式 Sidecar

    为什么 Pod 必须是原子调度? 在两个容器紧密协作的场景中,避免调度失败问题. Pod 解决了里面多个容器之间高效共享某些资源和数据,共享网络.共享存储. 容器设计模式? 通过在 Pod 里定义专门 ...

  7. dotnet SemanticKernel 入门 将技能导入框架

    在上一篇博客中和大家简单介绍了 SemanticKernel 里的技能概念,接下来咱准备将 技能 导入到 SemanticKernel 框架里面,进行一个管道式调用 本文属于 SemanticKern ...

  8. 2018-11-23-国内好用的-DNS-列表

    title author date CreateTime categories 国内好用的 DNS 列表 lindexi 2018-11-23 12:45:57 +0800 2018-11-23 12 ...

  9. 使用小波分析和深度学习对心电图 (ECG) 进行分类 mcu-ai低成本方案 mcu-ai低成本方案

    具体的软硬件实现点击 http://mcu-ai.com/ MCU-AI技术网页_MCU-AI人工智能 此示例说明如何使用连续小波变换 (CWT) 和深度卷积神经网络 (CNN) 对人体心电图 (EC ...

  10. fastposter v2.8.2 发布 电商海报生成器

    fastposter v2.8.2 发布 电商海报生成器 fastposter海报生成器,电商海报编辑器,电商海报设计器,fast快速生成海报 海报制作 海报开发.二维码海报,图片海报,分享海报,二维 ...