Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Patrick Wardle

Rating No ratings yet

As renowned Mac security expert Patrick Wardle notes in The Art of Mac Malware, Volume 2, the substantial and growing number of Mac users, both personal and enterprise, has created a compelling incentive for malware authors to ever more frequently target macOS systems. The only effective way to counter these constantly evolving and increasingly sophisticated threats is through learning and applying robust heuristic-based detection techniques. To that end, Wardle draws upon decades of experience to guide you through the programmatic implementation of such detection techniques. By exploring how to leverage macOS’s security-centric frameworks (both public and private), diving into key elements of behavioral-based detection, and highlighting relevant examples of real-life malware, Wardle teaches and underscores the efficacy of these powerful approaches. Across 14 in-depth chapters, you’ll learn how to: Capture critical snapshots of system state to reveal the subtle signs of infection Enumerate and analyze running processes to uncover evidence of malware Parse the macOS’s distribution and binary file formats to detect malicious anomalies Utilize code signing as an effective tool to identify malware and reduce false positives Write efficient code that harnesses the full potential of Apple’s public and private APIs Leverage Apple’s Endpoint Security and Network Extension frameworks to build real-time monitoring tools This comprehensive guide provides you with the knowledge to develop tools and techniques, and to neutralize threats before it’s too late. Author Bio Patrick Wardle is the founder of Objective-See, a nonprofit dedicated to creating free, open source macOS security tools and organizing the “Objective by the Sea” Apple security conference. Wardle is also the co-founder and CEO of DoubleYou, a cybersecurity startup focused on empowering the builders of Apple-focused security tools. Having worked at both NASA and the National Securit

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on guide to building your own macOS malware detection tools, teaching you how to turn system internals, binary formats, and code signing into programmatic heuristics. Essential for Mac admins, malware analysts, and security-minded developers who want to move beyond postmortem analysis to real-time threat detection. 【Book Arc】 - **Opening (~0%–15%)**: Establishes the case for heuristic-based detection and introduces the book's core philosophy—capturing system state snapshots to reveal infection signs, starting with process enumeration and analysis. - **Early (~15%–35%)**: Dives into process inspection techniques, including extracting arguments, hierarchies, loaded libraries, and detecting anomalies like hidden directories or self-deleting binaries (e.g., KeRanger, DazzleSpy). - **Middle (~35%–55%)**: Shifts to static analysis of Mach-O binaries—parsing universal/fat binaries, extracting dependencies and symbols, and detecting packed or encrypted code via entropy calculations. - **Late (~55%–80%)**: Covers code signing as a detection lever (verifying signatures, extracting notarization info) and network state collection (sockets, file descriptors, NetworkStatistics framework). - **Ending (~80%–100%)**: Culminates in leveraging Apple's Endpoint Security and Network Extension frameworks to build real-time monitoring tools, synthesizing earlier techniques into proactive defense systems. 【Key Takeaways】 - **Heuristic-based detection beats signature matching** (Opening): The book's central thesis—malware evolves too fast for static signatures, so you must build tools that identify behavioral and structural anomalies. - **Process enumeration is your first diagnostic lens** (Early): Extracting paths, arguments, and loaded libraries from running processes reveals telltale signs like hidden directories (.local/softwareupdate) or self-deleted binaries (KeRanger's unlink call). - **Mach-O parsing unlocks binary-level intelligence** (Middle): Understanding universal binaries, load commands, and dependency paths lets you spot packed binaries via entropy calculations and flag suspicious symbols or section names. - **Code signing is a powerful false-positive reducer** (Late): Verifying signatures and notarization status helps distinguish legitimate software from malware, especially when combined with other heuristics. - **Network state collection completes the picture** (Late): Enumerating sockets and file descriptors via NetworkStatistics reveals backdoor listeners and unauthorized connections that process analysis alone might miss. - **Private APIs extend detection capabilities** (Early–Middle): The book shows how to leverage undocumented XPC routines and private frameworks (e.g., xpc_pipe_interface_routine) for deeper system introspection. - **Real-time monitoring requires Apple's frameworks** (Ending): Endpoint Security and Network Extension enable proactive, event-driven detection rather than periodic snapshots—the book's ultimate goal. - **False positives are inevitable—design for them** (Throughout): Wardle repeatedly notes that legitimate software (e.g., Wacom tablets) can mimic malicious behavior, so heuristics must be layered and contextual. 【Reading Tips】 - **Deep-read Chapters 1–2** (process and binary analysis): These form the foundation for everything else; skim only if you're already fluent in Mach-O internals. - **Treat code listings as templates**: The book is code-heavy—focus on understanding the APIs and logic flow rather than memorizing syntax; adapt examples to your own tools. - **Skim the network chapter if you're host-focused**: Chapter 4 is valuable but can be deferred if your priority is endpoint detection; return to it when building comprehensive monitoring. - **Pair with Volume 1 if new to macOS malware**: The author explicitly assumes foundational knowledge; this volume builds on, not replaces, the first book. - **Take away the methodology, not just the code**: The real value is learning Wardle's heuristic mindset—how to think about anomalies—which transfers to any detection engineering. 【Coverage Limits】 This guide synthesizes the book's structure and core themes from the provided excerpts, which cover the table of contents, foreword, and portions of early chapters. Detailed chapter-by-chapter techniques (especially later chapters on Endpoint Security and Network Extension) are inferred from the book's stated scope rather than fully excerpted content.
Page 1
nizing the “Objective by the Sea” Apple security conference. Wardle is also the co-founder and CEO of DoubleYou, a cybersecurity startup focused on empowerin...
View in text
Page 20
tection, and develop custom tools. You’ll learn how to cre- ate software that identifies infections in real time, moving beyond postmor- tem analysis. If you...
View in text
Excerpt 3
After downloading a file from https://nzssdm.com/assets/mt.dat to the /tmp directory via curl 1, it sets permissions to executable 2 and then executes the do...
View in text
Excerpt 4
r running as a native Apple Silicon binary 46   Chapter 2 You can find an overview of each header member in the comments of the mach_header_64 structure defi...
View in text
Excerpt 5
10 years old and was distributed as a 32-bit Intel binary, which isn’t compatible with recent versions of macOS. To write code capable of detecting HackingTe...
View in text
Excerpt 6
stic-based approaches can be fraught with false posi- tives. The information provided by code signing can drastically reduce your detection errors. When buil...
View in text
Excerpt 7
ining the contents of this newly created file, we can find the path to which the malware has persistently installed itself, /Users/User/ .local/softwareupdat...
View in text
Excerpt 8
libpam.2.dylib) in pam_sm_open_session(): username: Patrick These log messages provide the source IP address of the connection, as well as the identity of th...
View in text
Tags
AI categories
CybersecurityOSProgramming
Publisher: No Starch Press
Publish Year: 2025
Language: English
Pages: 378
File Format: PDF
File Size: 13.1 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…