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. mysql 悲观锁和乐观锁(二)

    前言 简单介绍一下,在mysql 优化系列中会重新介绍,仅仅是留个印象. 悲观锁和乐观锁其实都是概念性问题. 正文 悲观锁: 悲观锁,正如其名,具有强烈的独占和排他特性. 它指的是对数据被外界(包括本 ...

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

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

  3. Flutter笔记-基础组件

    图片和Icon 加载网络图片以及本地图片 Image( image: NetworkImage( "https://img-s-msn-com.akamaized.net/tenant/am ...

  4. 解决跨域问题之fetch的使用

    一.介绍 fetch 提供了一个获取资源的接口 (包括跨域). fetch 的核心主要包括:Request , Response , Header , Body 利用了请求的异步特性 --- 它是基于 ...

  5. python性能测试,请求QPS测试

    QPS = (1000ms/平均响应时间ms)*服务并行数量 #!/user/bin/env python #coding=utf-8 import requests import datetime ...

  6. mac版本vscode窗口崩溃crashed

    1.截图 出现时机 当安装依赖的时候大概率会出现,甚至安装一次依赖会出现几次 解决 具体原因未知 重新启动电脑以及退出软件都不能解决 去官网重新下载,重新安装问题解决

  7. 第七課-Channel Study For HTTP Listener & Web Service Sender Intercommunicates Response Handler

    示例说明: 系统A发送XML格式患者信息到Mirth的Source端HTTP Listener,完成患者信息入库逻辑:然后Mirth的Destinations端Web Service Sender调用 ...

  8. DTCC 2020 | 阿里云程实:云原生时代的数据库管理

    简介: 随着云原生技术的不断发展,数据库也逐渐进入了云原生时代.在云原生时代,如何高效.安全且稳定地管理云上与云下的数据库成为摆在企业面前的一大难题.在第十一届中国数据库技术大会(DTCC2020)上 ...

  9. 走完线上 BUG 定位最后一公里

    简介: 因为线上线下环境隔离的问题,线上的输入很多时候难以在日常环境中构造,定位 bug 效率低下.是否有简单快捷的办法呢? 一个小故事 周末12点的闹钟在回龙观均价3000的出租屋急促的响起,程序员 ...

  10. 快速部署 微软开源的 Garnet 键值数据库

    快速部署 微软开源的 Garnet 键值数据库 Garnet 是 Microsoft Research 推出的一种新型远程缓存存储,其设计速度极快.可扩展且延迟低. Garnet 在单个节点内是线程可 ...