skip to main content
10.1145/3372297.3423357acmconferencesArticle/Chapter ViewAbstractPublication PagesccsConference Proceedingsconference-collections
research-article

iDEA: Static Analysis on the Security of Apple Kernel Drivers

Published: 02 November 2020 Publication History

Abstract

Drivers on Apple OSes (e.g., iOS, tvOS, iPadOS, macOS, etc.) run in the kernel space and driver vulnerabilities can incur serious security consequences. A recent report from Google Project Zero shows that driver vulnerabilities on Apple OSes have been actively exploited in the wild. Also, we observed that driver vulnerabilities have accounted for one-third of kernel bugs in recent iOS versions based on Apple's security updates. Despite the serious security implications, systematic static analysis on Apple drivers for finding security vulnerabilities has never been done before, not to mention any large-scale study of Apple drivers.
In this paper, we developed the first automatic, static analysis tool iDEA for finding bugs in Apple driver binaries, which is applicable to major Apple OSes (iOS, macOS, tvOS, iPadOS). We summarized and tackled a set of Apple-unique challenges: for example, we show that prior C++ binary analysis techniques are ineffective (i.e., failing to recover C++ classes and resolve indirect calls) on Apple platform due to Apple's unique programming model. To solve the challenges, we found a reliable information source from Apple's driver programming and management model to recover classes, and identified the unique paradigms through which Apple drivers interact with user-space programs. iDEA supports customized, pluggable security policy checkers for its security analysis. Enabled by iDEA, we performed the first large-scale study of 3,400 Apple driver binaries across major Apple OSes and 15 OS versions with respect to two common types of security risks - race condition and out-of-bound read/write, and discovered 35 zero-day bugs. We developed PoC and end-to-end attacks to demonstrate the practical impacts of our findings. A portion of the bugs have been patched by recent Apple security updates or are scheduled to be fixed; others are going through Apple's internal investigation procedure. Our evaluation showed that iDEA incurs a low false-positive rate and time overhead.

Supplementary Material

MOV File (Copy of CCS2020_fpe424_XiaolongBai - Pat Weeden.mov)
Presentation video

References

[1]
Adam Donenfeld. 2018. Viewer Discretion Advised: (De)coding an iOS Kernel Vulnerability. http://phrack.org/papers/viewer_discretion_advised.html.
[2]
anonymous author. 2020. iDEA Supporting Website. https://sites.google.com/view/idea-apple-driver.
[3]
Apple Inc. 2004. The libkern Base Classes. (2004). http://mirror.informatimago.com/next/developer.apple.com/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/BaseClasses/chapter_6_section_2.html.
[4]
Apple Inc. 2014a. The Base Classes. https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/BaseClasses/BaseClasses.html.
[5]
Apple Inc. 2014b. Introduction to I/O Kit Fundamentals. https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/Introduction/Introduction.html.
[6]
Apple Inc. 2018a. About Information Property List Files. https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html.
[7]
Apple Inc. 2018b. XNU source code. (2018). https://opensource.apple.com/source/xnu/.
[8]
Apple Inc. 2019 a. Apple security updates. (2019). https://support.apple.com/en-us/HT201222.
[9]
Apple Inc. 2019 b. Kernel. https://developer.apple.com/documentation/kernel.
[10]
Apple Inc. 2020 a. CFBundleIdentifier. https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleidentifier.
[11]
Apple Inc. 2020 b. fromPath(const char *, const IORegistryPlane *, char *, int *). https://developer.apple.com/documentation/kernel/ioregistryentry/1810742-frompath.
[12]
Apple Inc. 2020 c. Identify the ports on your Mac. https://support.apple.com/en-us/HT201736.
[13]
Apple Inc. 2020 d. Introducing Xcode 12. https://developer.apple.com/xcode/.
[14]
Apple Inc. 2020 e. IOHIDFamily-1446.80.2. https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-1446.80.2/.
[15]
Apple Inc. 2020 f. IOLocks.h. https://opensource.apple.com/source/xnu/xnu-6153.61.1/iokit/IOKit/IOLocks.h.auto.html.
[16]
Apple Inc. 2020 g. IONetworkingFamily-139.60.1. https://opensource.apple.com/source/IONetworkingFamily/IONetworkingFamily-139.60.1/.
[17]
Apple Inc. 2020 h. IOPCIFamily-370.81.1. https://opensource.apple.com/source/IOPCIFamily/IOPCIFamily-370.81.1/.
[18]
Apple Inc. 2020 i. IOStorageFamily-238.0.1. https://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-238.0.1/.
[19]
Apple Inc. 2020 j. OSMetaClassBase. https://developer.apple.com/documentation/kernel/osmetaclassbase.
[20]
Apple Inc. 2020 k. propertyMatching. https://developer.apple.com/documentation/kernel/ioservice/1810622-propertymatching.
[21]
Apple Inc. 2020 l. release. https://developer.apple.com/documentation/kernel/osobject/1941151-release.
[22]
Apple Inc. 2020 m. resourceMatching(const char *, OSDictionary *). https://developer.apple.com/documentation/kernel/ioservice/1810840-resourcematching.
[23]
Apple Inc. 2020 n. retain. https://developer.apple.com/documentation/kernel/osobject/1941154-retain.
[24]
Apple Inc. 2020 o. runAction. https://developer.apple.com/documentation/kernel/iocommandgate/1811576-runaction.
[25]
Apple Inc. 2020 p. waitForMatchingService. https://developer.apple.com/documentation/kernel/ioservice/1811164-waitformatchingservice.
[26]
Thomas Ball, Ella Bounimova, Byron Cook, Vladimir Levin, Jakob Lichtenberg, Con McGarvey, Bohus Ondrusek, Sriram K Rajamani, and Abdullah Ustuner. 2006. Thorough static analysis of device drivers. ACM SIGOPS Operating Systems Review, Vol. 40, 4 (2006), 73--85.
[27]
bazad. 2018. ida_kernelcache: An IDA Toolkit for analyzing iOS kernelcaches. https://github.com/bazad/ida_kernelcache.
[28]
Ian Beer. 2014. pwn4fun Spring 2014--Safari--Part II. (2014). https://googleprojectzero.blogspot.com/2014/11/pwn4fun-spring-2014-safari-part-ii.html.
[29]
Vitaly Chipounov, Volodymyr Kuznetsov, and George Candea. 2011. S2E: A platform for in-vivo multi-path analysis of software systems. ACM Sigplan Notices, Vol. 46, 3 (2011), 265--278.
[30]
CodeSourcery, Compaq, EDG, HP, IBM, Intel, Red Hat, and SGI. 2019. 5.1 External Names (a.k.a. Mangling). https://itanium-cxx-abi.github.io/cxx-abi/abi.html.
[31]
David Dewey and Jonathon T Giffin. 2012. Static detection of C+ vtable escape vulnerabilities in binary code. In NDSS .
[32]
David Dewey, Bradley Reaves, and Patrick Traynor. 2015. Uncovering Use-After-Free Conditions in Compiled Code. In Availability, Reliability and Security (ARES), 2015 10th International Conference on. IEEE, 90--99.
[33]
David Bryan Dewey. 2015. Finding and remedying high-level security issues in binary code. Ph.D. Dissertation. Georgia Institute of Technology.
[34]
Manuel Egele, Christopher Kruegel, Engin Kirda, and Giovanni Vigna. 2011. PiOS: Detecting Privacy Leaks in iOS Applications. In NDSS. 177--183.
[35]
Margaret A Ellis and Bjarne Stroustrup. 1990. The annotated C+ reference manual .Addison-Wesley.
[36]
Esser, Stefan. 2011. Exploiting the iOS kernel. Black Hat USA (2011).
[37]
Flanker. 2016. The Python Bites your Apple Fuzzing and exploiting OSX Kernel bugs. https://papers.put.as/papers/macosx/2016/xkungfoo.pdf.
[38]
Alexander Fokin, Egor Derevenetc, Alexander Chernov, and Katerina Troshina. 2011. SmartDec: approaching C+ decompilation. In 2011 18th Working Conference on Reverse Engineering. IEEE, 347--356.
[39]
Alexander Fokin, Katerina Troshina, and Alexander Chernov. 2010. Reconstruction of class hierarchies for decompilation of C+ programs. In Software Maintenance and Reengineering (CSMR), 2010 14th European Conference on. IEEE, 240--243.
[40]
GNU. 2020. Demangling. https://gcc.gnu.org/onlinedocs/libstdc+/manual/ext_demangling.html.
[41]
HyungSeok Han and Sang Kil Cha. 2017. IMF: Inferred Model-based Fuzzer. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. ACM, 2345--2358.
[42]
Hex-Rays. 2015. IDA: About. (2015). https://www.hex-rays.com/products/ida/.
[43]
Ian Beer. 2018. CVE-2017--13861. https://bugs.chromium.org/p/project-zero/issues/detail?id=1417.
[44]
Ian Beer. 2019. A very deep dive into iOS Exploit chains found in the wild. https://googleprojectzero.blogspot.com/2019/08/a-very-deep-dive-into-ios-exploit.html.
[45]
iOS Expert. 2017. Apple's iOS Kernel Patch Protection (KPP) Explained. (2017). https://yalujailbreak.net/kernel-patch-protection/.
[46]
Just a Penguin. 2019. IPSW Downloads. (2019). https://ipsw.me/.
[47]
Kaspersky Lab. 2017. Pegasus: The ultimate spyware for iOS and Android. (2017). https://www.kaspersky.com/blog/pegasus-spyware/14604/.
[48]
Omer Katz, Ran El-Yaniv, and Eran Yahav. 2016. Estimating types in binaries using predictive modeling. In ACM SIGPLAN Notices, Vol. 51. ACM, 313--326.
[49]
Omer Katz, Noam Rinetzky, and Eran Yahav. 2018. Statistical reconstruction of class hierarchies in binaries. In ACM SIGPLAN Notices, Vol. 53. ACM, 363--376.
[50]
Johannes Kinder and Helmut Veith. 2010. Precise static analysis of untrusted driver binaries. In Formal Methods in Computer-Aided Design (FMCAD), 2010. IEEE, 43--50.
[51]
Aravind Machiry, Chad Spensky, Jake Corina, Nick Stephens, Christopher Kruegel, and Giovanni Vigna. 2017. DR. CHECKER: A Soundy Analysis for Linux Kernel Drivers. In 26th USENIX Security Symposium (USENIX Security 17). USENIX Association, 1007--1024.
[52]
Mandt, Tarjei. 2013. Attacking the iOS Kernel: A Look at?evasi0n?. http://www.nislab.no/content/download/38610/481190/file/NISlecture201303.pdf.
[53]
Stefano Bianchi Mazzone, Mattia Pagnozzi, Aristide Fattori, Alessandro Reina, Andrea Lanzi, and Danilo Bruschi. 2014. Improving mac os x security through gray box fuzzing technique. In Proceedings of the Seventh European Workshop on System Security. ACM, 2.
[54]
Micorsoft. 2019 a. WDF_DRIVER_CONFIG structure. https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdfdriver/ns-wdfdriver-_wdf_driver_config.
[55]
Micorsoft. 2019 b. WdfDriverCreate function. https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdfdriver/nf-wdfdriver-wdfdrivercreate.
[56]
Music Matter. 2015. 6 Of The Best Firewire Audio Interfaces 2015. https://www.musicmatter.co.uk/lists/best-firewire-audio-interfaces-2015.
[57]
Jianfeng Pan, Guanglu Yan, and Xiaocao Fan. 2017. Digtool: A virtualization-based framework for detecting kernel vulnerabilities. In 26th USENIX Security Symposium (USENIX Security 17). USENIX Association, 149--165.
[58]
Riyad Parvez, Paul AS Ward, and Vijay Ganesh. 2016. Combining static analysis and targeted symbolic execution for scalable bug-finding in application binaries. In Proceedings of the 26th Annual International Conference on Computer Science and Software Engineering. IBM Corp., 116--127.
[59]
Andre Pawlowski, Moritz Contag, Victor van der Veen, Chris Ouwehand, Thorsten Holz, Herbert Bos, Elias Athanasopoulos, and Cristiano Giuffrida. 2017. MARX: Uncovering Class Hierarchies in C+ Programs. In NDSS .
[60]
Plaskett, Alex and Loureiro, James. 2017. Biting the Apple that feeds you - macOS Kernel Fuzzing. https://labs.f-secure.com/archive/biting-the-apple-that-feeds-you-macos-kernel-fuzzing/.
[61]
Quarkslab. 2019. Taint analysis on aarch64 binaries? https://github.com/JonathanSalwan/Triton/issues/837.
[62]
Quarkslab. 2020. Triton - A DBA Framework. https://triton.quarkslab.com/.
[63]
Matthew J. Renzelmann, Asim Kadav, and Michael M. Swift. 2012. SymDrive: Testing Drivers without Devices. In Presented as part of the 10th USENIX Symposium on Operating Systems Design and Implementation (OSDI 12). USENIX, Hollywood, CA, 279--292. https://www.usenix.org/conference/osdi12/technical-sessions/presentation/renzelmann.
[64]
Paul Vincent Sabanal and Mark Vincent Yason. 2007. Reversing C+. (2007). https://www.blackhat.com/presentations/bh-dc-07/Sabanal_Yason/Paper/bh-dc-07-Sabanal_Yason-WP.pdf.
[65]
Florent Saudel and Jonathan Salwan. 2015. Triton: A dynamic symbolic execution framework. In Symposium sur la sécurité des technologies de l'information et des communications, SSTIC, France, Rennes. 31--54.
[66]
Sergej Schumilo, Cornelius Aschermann, Robert Gawlik, Sebastian Schinzel, and Thorsten Holz. 2017. kAFL: Hardware-Assisted Feedback Fuzzing for OS Kernels. In 26th USENIX Security Symposium (USENIX Security 17). USENIX Association, Vancouver, BC, 167--182. https://www.usenix.org/conference/usenixsecurity17/technical-sessions/presentation/schumilo.
[67]
Edward J Schwartz, Cory F Cohen, Michael Duggan, Jeffrey Gennari, Jeffrey S Havrilla, and Charles Hines. 2018. Using logic programming to recover C+ classes and methods from compiled executables. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security. ACM, 426--441.
[68]
Semmle. 2020. Semmle. https://semmle.com/.
[69]
ShiftLeftSecurity. 2020. Joern Documentation. https://joern.io/docs/.
[70]
SilverMoonSecurity. 2016. PassiveFuzzFrameworkOSX. (2016). https://github.com/SilverMoonSecurity/PassiveFuzzFrameworkOSX.
[71]
Alexander Sotirov. 2007. Heap feng shui in javascript. Black Hat Europe, Vol. 2007 (2007).
[72]
Stefan Esser. 2011a. IDA-IOS-Toolkit. https://github.com/stefanesser/IDA-IOS-Toolkit.
[73]
Stefan Esser. 2011b. Targeting the iOS Kernel. https://papers.put.as/papers/ios/2011/SysScan-Singapore-Targeting_The_IOS_Kernel.pdf.
[74]
Seyed Mohammadjavad Seyed Talebi, Hamid Tavakoli, Hang Zhang, Zheng Zhang, Ardalan Amiri Sani, and Zhiyun Qian. 2018. Charm: facilitating dynamic analysis of device drivers of mobile systems. In 27th $$USENIX$$ Security Symposium ($$USENIX$$ Security 18). 291--307.
[75]
The Clang Team. 2019. LibClang. https://clang.llvm.org/docs/Tooling.html.
[76]
The MITRE Corporation. 2019. CWE-416: Use After Free. https://cwe.mitre.org/data/definitions/416.html.
[77]
The MITRE Corporation. 2020. CWE-787: Out-of-bounds Write. https://cwe.mitre.org/data/definitions/787.html.
[78]
Tielei Wang, Hao Xu, and Xiaobo Chen. 2016. Pangu 9 internals. Black Hat USA (2016).
[79]
Xi Wang, Haogang Chen, Zhihao Jia, Nickolai Zeldovich, and M. Frans Kaashoek. 2012. Improving Integer Security for Systems with KINT. In Presented as part of the 10th USENIX Symposium on Operating Systems Design and Implementation (OSDI 12). USENIX, Hollywood, CA, 163--177. https://www.usenix.org/conference/osdi12/technical-sessions/presentation/wang.
[80]
Mark N Wegman and F Kenneth Zadeck. 1991. Constant propagation with conditional branches. ACM Transactions on Programming Languages and Systems (TOPLAS), Vol. 13, 2 (1991), 181--210.
[81]
Mark Weiser. 1984. Program slicing. IEEE Transactions on software engineering 4 (1984), 352--357.
[82]
Wikipedia. 2020 a. Executable and Linkable Format. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format.
[83]
Wikipedia. 2020 b. Mach-O. https://en.wikipedia.org/wiki/Mach-O.
[84]
Wikipedia. 2020 c. Portable Executable. https://en.wikipedia.org/wiki/Portable_Executable.
[85]
Xiaolong Bai, Min (Spark) Zheng. 2018. Eating The Core of an Apple: How to Analyze and Find Bugs in MacOS and iOS Kernel Drivers. https://conference.hitb.org/hitbsecconf2018ams/sessions/eating-the-core-of-an-apple-how-to-analyze-and-find-bugs-in-macos-and-ios-kernel-drivers/.
[86]
Zhenquan Xu, Gongshen Liu, Tielei Wang, and Hao Xu. 2017. Exploitations of uninitialized uses on macos sierra. In 11th USENIX Workshop on Offensive Technologies ($$WOOT$$ 17) .
[87]
Xiaoyong Zhou, Yeonjoon Lee, Nan Zhang, Muhammad Naveed, and XiaoFeng Wang. 2014. The peril of fragmentation: Security hazards in android device driver customizations. In Security and Privacy (SP), 2014 IEEE Symposium on. IEEE, 409--423.

Cited By

View all
  • (2024)SyzGen++: Dependency Inference for Augmenting Kernel Driver Fuzzing2024 IEEE Symposium on Security and Privacy (SP)10.1109/SP54263.2024.00269(4661-4677)Online publication date: 19-May-2024
  • (2024)Taming shared mutable states of operating systems in RustScience of Computer Programming10.1016/j.scico.2024.103152238:COnline publication date: 1-Dec-2024
  • (2023)KextFuzzProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620519(5039-5054)Online publication date: 9-Aug-2023
  • Show More Cited By

Index Terms

  1. iDEA: Static Analysis on the Security of Apple Kernel Drivers

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    CCS '20: Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security
    October 2020
    2180 pages
    ISBN:9781450370899
    DOI:10.1145/3372297
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 02 November 2020

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. apple
    2. ios
    3. ipados
    4. kernel drivers
    5. macos
    6. static analysis
    7. tvos
    8. vulnerability detection

    Qualifiers

    • Research-article

    Conference

    CCS '20
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 1,261 of 6,999 submissions, 18%

    Upcoming Conference

    CCS '25

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)95
    • Downloads (Last 6 weeks)5
    Reflects downloads up to 05 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)SyzGen++: Dependency Inference for Augmenting Kernel Driver Fuzzing2024 IEEE Symposium on Security and Privacy (SP)10.1109/SP54263.2024.00269(4661-4677)Online publication date: 19-May-2024
    • (2024)Taming shared mutable states of operating systems in RustScience of Computer Programming10.1016/j.scico.2024.103152238:COnline publication date: 1-Dec-2024
    • (2023)KextFuzzProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620519(5039-5054)Online publication date: 9-Aug-2023
    • (2023)Callee: Recovering Call Graphs for Binaries with Transfer and Contrastive Learning2023 IEEE Symposium on Security and Privacy (SP)10.1109/SP46215.2023.10179482(2357-2374)Online publication date: May-2023
    • (2023)A Survey of Binary Code Security Analysis2023 6th International Conference on Data Science and Information Technology (DSIT)10.1109/DSIT60026.2023.00015(42-49)Online publication date: 28-Jul-2023
    • (2021)CoLaFUZE: Coverage-Guided and Layout-Aware Fuzzing for Android DriversIEICE Transactions on Information and Systems10.1587/transinf.2021NGP0005E104.D:11(1902-1912)Online publication date: 1-Nov-2021
    • (2021)SyzGen: Automated Generation of Syscall Specification of Closed-Source macOS DriversProceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security10.1145/3460120.3484564(749-763)Online publication date: 12-Nov-2021

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media