顶会论文阅读 [USENIX security 17] Adaptive Android Kernel Live Patching

版权声明:如需转载或引用,请注明出处。 https://blog.csdn.net/weixin_39278265/article/details/87859201

前言

本文旨在阅读顶会文章: [USENIX security 17] Adaptive Android Kernel Live Patching。

1 基本信息

Chen Y, Zhang Y, Wang Z, et al. Adaptive android kernel live patching[C]//26th {USENIX} Security Symposium ({USENIX} Security 17). 2017: 1253-1270.

一作:Yue Chen(本科就读于哈工大,即 Harbin Institute of Technology,博士就读于 Florida State University,现在在Palo Alto Networks上班,据说是全世界最大的网络安全公司)
导师:Zhi Wang
个人主页:http://ww2.cs.fsu.edu/~ychen/
其谷歌学术主页:https://scholar.google.com/citations?user=mAbxlnsAAAAJ&hl=zh-CN&oi=sra

有几篇感兴趣的文章:

  • Pinpointing vulnerabilities (定位漏洞,很好奇。 2017年的亚洲CCS会议)
  • Securing Systems by Vulnerability Mitigation and Adaptive Live Patching (2018年写的)
  • Adaptive Android Kernel Live Patching(即本文将要读的文章)

2 文章内容

开头先简介,然后指出问题:

Android kernel vulnerabilities pose a serious threat to user security and privacy. They allow attackers to take full control over victim devices, install malicious and unwanted apps, and maintain persistent control. Unfortunately, most Android devices are never timely updated to protect their users from kernel exploits.

进一步说明难处:

Recent Android malware even has built-in kernel exploits to take advantage of this large window of vulnerability. An effective solution to this problem must be adaptable to lots of (out-of-date) devices, quickly deployable, and secure from misuse. However, the fragmented Android ecosystem makes this a complex and challenging task.

我们的工作:

To address that, we systematically studied 1,139 Android kernels and all the recent critical Android kernel vulnerabilities. We accordingly propose KARMA, an adaptive live patching system for Android kernels. KARMA features a multi-level adaptive patching model to protect kernel from exploits.

KARMA的强势之处:

Specifically, patches in KARMA can be placed at multiple levels in the kernel to filter malicious inputs, and they can be automatically adapted to thousands of Android devices. In addition, KARMA’s patches are written in a high-level memory-safe language, making them secure and easy to vet, and their run-time behaviors are strictly confined to prevent them from being misused

实证:

Our evaluation demonstrates that KARMA can protect most critical kernel vulnerabilities on many Android devices (520 devices in our evaluation) with only minor performance overhead (< 1%)

大意是:

安卓内核漏洞非常危险,但是现在绝大部分(most)安卓设备从来不会及时更新补丁来保护他们的用户免受内核漏洞之危。

最近的安卓恶意软件甚至有内嵌的内核漏洞来操作安卓内核。解决这个问题的有效的方法必须是适用于很多(包括 out-of-date 老式的)的设备,快速部署的,不会被滥用的。然而,碎片化的安卓生态系统使得这个非常有挑战性。

为此,本文系统研究了1139个安卓内核 + 最近所有的关键安卓内核漏洞。对应的,我们推出了KARMA,一个安卓内核自适应的热补丁工具。KARMA搭建了一个多层次的自适应补丁模型,来使内核远离漏洞。

KARMA 强势在:1)KARMA给出的补丁可以放在内核的多个层次来过滤掉恶意的输入;2)对上千种安卓设备都适用;3)KARMA的补丁是用高级内存安全的语言写的,因而非常安全,并且容易审查;4)补丁的运行 run-time 行为被严格限制,以防被滥用。 (由此可见,搞热补丁技术,这些方面的特性是缺不了的。 ) 实证效果很好。

3 几个QA

3.1 QA1

问:为什么说安卓生态系统碎片化,为什么修复内核漏洞这么难?
答:
安卓生态系统碎片化:
上千个供应商,对应着上万种设备 + Google定时发布新版本。
最终导致 Android 设备各种硬件、软件配置混杂,非常之复杂。

修复内核漏洞难,是因为:
1)in recent years,安卓内核漏洞越来越多了;
2)官方给安卓设备打补丁的过程耗时很长(牵涉到多方利益):

  • Google/卖家先核查上报的漏洞,然后写出一个补丁;
  • 补丁随后被彻底的测试,并发布给carriers(我感觉是运营商的意思);
  • 运营商再次测试这个补丁(针对兼容性,即for compatibility with their networks),并把补丁作为一个OTA更新来发布给用户。 —— 在此过程中呢,首先很多补丁在排队给运营商测试,然后用户不一定会(及时)安装补丁。
    3)而且,设备供应商(vendors)和运营商(carriers)没什么动力去保持用户设备的更新和安全。他们更愿意用户去买新的设备,比如,手机供应商可能会在一年之内就停止旧设备的供应。

所以不单纯是技术原因。
但是其实也可以算技术原因,如果成本低,那修复补丁还是很值得的。

3.2 QA2

问:还有类似的热补丁技术吗?
答:

As such, existing source-code based patching systems [22,23,25,27] can only cover a limited number of devices

Kernel live patching: the first category of the related work consists of a number of kernel live patching systems, such as kpatch [23], kGraft [22], Ksplice [27], and KUP [37].

Among these systems, kpatch [23] and kGraft [22] replace a whole vulnerable function with the patched version.

Among these systems, kpatch [23] and kGraft [22] replace a whole vulnerable function with the patched version.

3.3 QA3

问:热补丁技术的难点到底在哪?
答:

还不知道的,感觉实现起来还挺复杂的。
而且漏洞的热修复,部署起来,也是问题。

3.4 QA4

问:KARMA的原理?

Intuition:(来自于对1000多个漏洞的调研)

  • most kernel functions are stable across devices and Android releases. 大部分内核函数是很稳的 —— 先修内核函数
  • many kernel vulnerabilities are triggered by malicious inputs. They can be protected by filtering these inputs. 很多的内核漏洞都是被恶意输入触发的 —— 那就去block掉恶意输入吧!
  • many kernel functions return error codes that are handled by their callers. We can leverage the error handling code to gracefully discard malicious inputs. 很多内核函数都会返回错误码 —— 所以我们可以利用这个错误处理码来优雅温和的丢掉恶意输入

工作原理大概也就如上了。

在这里插入图片描述

原来如此,参考上图,KARMA的修复流程有二:
1)线下补丁生成&验证:(把一个参考补丁转成KARMA支持的所有设备适用的补丁)

  • 接收来自上游供应商(如Google或者芯片集制造商)的特定设备、特定内核的补丁;
  • KARMA先利用一个自动化的系统来大致确定漏洞相关的内核函数;
  • 用符号执行(symbolic execution)来比较目标内核函数(target)和参考函数是不是语义等价的;
  • 如果是,那就进一步修改,变成自适应的补丁;
  • 把补丁签名(sign it),并存到(deposit)云端(cloud)

2)线上热补丁部署(通过KARMA客户端):

  • 用户设备上的KARMA客户端下载并核查这些补丁,并应用到设备的内核中;
  • 在核查的时候,是通过签名来看的,还要看是不是和用户的设备&内核型号相匹配;
  • 然后直接应用补丁就是,无须重启,直接开始保护内核免受恶意输入。

还想讲一下KARMA的补丁工作机制:
在这里插入图片描述

每次执行到指定位置(或者执行到指定指令)的时候,内核自动谈到KARMA补丁,然后把整个当前context创给KARMA补丁,KARMA补丁就会开始检查这个输入是不是恶意输入,如果是,返回错误码,如果不是,就正常执行后面的程序。有点if else的感觉。

以上,大概是这样。

4 关于安全漏洞的网页

1)Android 安全公告 https://source.android.com/security/bulletin/
好多漏洞,都有CVE编号的。

2)Android 安全公告 - 2018 年 12 月 https://source.android.com/security/bulletin/2018-12-01.html?hl=zh-cn
原来漏洞这么多,是不是意味着很多手机都还暴露在漏洞之下,随时可能被入侵?(那修复岂不是刻不容缓吗?)

3) CVE and NVD Relationship http://cve.mitre.org/about/cve_and_nvd_relationship.html
 CVE和NVD是两个漏洞库,但是CVE更早成立,而且CVE会feed NVD。
 CVE是一个漏洞条目列表,但是NVD是一个基于CVE建立的漏洞数据库,所以CVE的更新会很快的同步到NVD。

4)NVD https://nvd.nist.gov/

5)​Android fragmentation: There are now 24,000 devices from 1,300 brands https://www.zdnet.com/article/android-fragmentation-there-are-now-24000-devices-from-1300-brands/
安卓碎片化:现在有来自1300个品牌的2万4000个设备。

总结

亮点:用符号执行来解决自适应的问题。

1)不足?
2)未来工作?

An approach similar to KARMA can be applied to the Android framework and user-space apps.

参考文献

[1] OTA (空中下载技术) https://baike.baidu.com/item/OTA/1381310?fr=aladdin

猜你喜欢

转载自blog.csdn.net/weixin_39278265/article/details/87859201