Linux内核安全检查缺失分析
AMCheX: Accurate Analysis of Missing-Check Bugs for Linux Kernel
-
摘要: 研究背景
随着Linux内核的规模和复杂性的不断增长,如何保证其安全性成为一个重要的挑战。Linux内核采用了大量的安全检查,防止在不安全的条件下执行安全敏感的操作。当内核访问关键的资源或者接收不可信的输入时,往往需要执行安全检查来判断该操作是否可以被执行。如果安全敏感操作中使用的可操作数据没有受到预期的安全检查的保护时,就会出现检查缺失错误。检查缺失错误会导致严重的安全影响,如特权升级、系统崩溃、越界访问等,会给Linux内核带来损害。
目的
本文希望检测Linux内核中安全敏感函数的调用未受到对应安全检查保护的错误。最大的挑战是推断出安全检查函数与安全敏感函数之间的映射关系。目前,已有的方法对于安全敏感函数识别以及安全映射关系的识别不够精确。本文提出了一种双方向分析方法去识别Linux内核中受到安全检查函数所保护的安全敏感函数。
方法
我们的方法基于LLVM中间表示,采用过程间的上下文敏感的分析,首先识别了安全检查函数并分析了安全检查函数之间的封装关系。我们采用双方向分析方法,在安全检查函数的控制范围内识别了安全敏感函数并建立二者的映射关系。根据映射关系,我们追踪了所有需要执行安全检查的路径并判断安全敏感函数是否被对应的安全检查所保护。未受到保护的情况会被识别为潜在的安全检查缺失错误。
结果
我们实现了用于检查缺失检测的工具AMCheX并在Linux内核上进行了实验。实验结果表明,我们的方法能够有效地检测Linux内核中检查缺失错误,共检测到12个新漏洞,其中的5个已被内核开发者所确认。
结论
内核检查缺失类漏洞可能带来严重的影响,如何检测内核检查的缺失是很有意义的。我们的方法能够推断安全检查函数与安全敏感函数之间的映射关系并有效地检测Linux内核中的检查缺失漏洞。Abstract: The Linux kernel adopts a large number of security checks to prevent security-sensitive operations from being executed under unsafe conditions. If a security-sensitive operation is unchecked, a missing-check issue arises. Missing check is a class of severe bugs in software programs especially in operating system kernels, which may cause a variety of security issues, such as out-of-bound accesses, permission bypasses, and privilege escalations. Due to the lack of security specifications, how to automatically identify security-sensitive operations and their required security checks in the Linux kernel becomes a challenge for missing-check analysis. In this paper, we present an accurate missing-check analysis method for Linux kernel, which can automatically infer possible security-sensitive operations. Particularly, we first automatically identify all possible security check functions of Linux. Then according to their callsites, a two-direction analysis method is leveraged to identify possible security-sensitive operations. A missing-check bug is reported when the security-sensitive operation is not protected by its corresponding security check. We have implemented our method as a tool, named AMCheX, on top of the LLVM (Low Level Virtual Machine) framework and evaluated it on the Linux kernel. AMCheX reported 12 new missing-check bugs which can cause security issues. Five of them have been confirmed by Linux maintainers.