MacOS Ventura and iOS 16 Kernel Internals for Security Researchers



Instructor:  Stefan Esser
Dates:   June 5 to 8 2023
Capacity:   20 Seats



This course introduces you to the low level internals of the iOS and macOS kernels from the perspective of a security researcher interested in vulnerability analysis, kernel rootkit/malware analysis/detection or kernel exploit development. While this course is concentrating on MacOS Ventura on the ARM64 cpu architecture the latest security enhancements of iOS 16 and some differences to the x86_64 architecture will also be discussed. The course material was heavily updated in comparison to the last time it was run pre-pandemic at Recon 2019.



Class Outline



Introduction

- Setting up a development and debugging environment

- Developing your own kernel extensions


Low Level x64 / ARM / ARM64

- Low level cpu details

- Physical memory management


Kernel Source Code

- Structure of the source code

- How to find vulnerabilities

- How security mitigations are implemented


Kernel Drivers/Extensions

- IOKit / DriverKit

- Driver attack surface


How does DriverKit work internally?

- Kernel driver code-signing


Kernel Internals

- Important data structures of the kernel

- Mach-o fileformat / encryption

- Mach messages and IPC

- Security: MAC Policy Hooks, Sandbox, Code Signing, Kauth, socket filter


macOS System Extensions, EndpointSecurity

- Filesystems, networking stack


Kernel Debugging

- Panic Dumps

- Built-in Kernel Debugging

- Debugging with own kernel extensions

- Kernel Heap Debugging/Visualization


Kernel Heap and Memory Management

- In-depth explanation how various memory allocators work


ARM64 Hardware Assisted Security Mitigations

- KPP


PPL

- KTRR/CTRR/XTRR/APRR

- PAC, PAN, …



Prerequisites


Basic understanding of exploitation (e.g. to be able to understand purpose of mitigations)


Basic Knowledge of ARM64 assembly (e.g. understand simple ARM64 assembler code)


Hardware


Apple Mac Notebook capable of running latest macOS


Enough hard disk space to run VMs


Software Requirements


MacOS Ventura


IDA Pro with x86_64 and ARM64 support (IDA 7 Freeware not enough)


Hex-Rays Decompiler for x86_64 and ARM64 nice to have but not required


Alternatively Hopper or Binary Ninja or Ghidra if IDA is not available (scripts/plugins vary between tools)




Bio


Stefan Esser is best known in the security community as the PHP security guy. Since he became a PHP core developer in 2002 he devoted a lot of time to PHP and PHP application vulnerability research. However in his early days he released lots of advisories about vulnerabilities in software like CVS, Samba, OpenBSD or Internet Explorer.


In 2003 he was the first to boot Linux directly from the hard disk of an unmodified XBOX through a buffer overflow in the XBOX font loader. In 2004 he founded the Hardened-PHP Project to develop a more secure version of PHP, known as Hardened-PHP, which evolved into the Suhosin PHP Security System in 2006. Since 2007 he works as head of research and development for the German web application company SektionEins GmbH that he co-founded.


In 2010 he did his own ASLR implementation for Apple’s iOS and shifted his focus to the security of the iOS kernel and iPhones in general. Since then he has spoken about the topic of iOS security at various information security conferences around the globe. In 2012 he co-authored the book the iOS Hackers Handbook.



To Register

Click here to register.