OSXCollector: Automated forensic evidence collection & analysis for OS X
Kuba Sendor (Yelp)
BruCON 0x07 · Day 1
Overview
In this BruCON 2015 talk, Kuba Sendor, a Security Engineer at Yelp, introduces OSXCollector, an incident response tool designed for automated forensic evidence collection and analysis on macOS systems. The presentation highlights the critical shift in perception regarding macOS security, acknowledging that these systems, once considered inherently secure, have become increasingly attractive targets for attackers due to their widespread popularity in enterprise environments. Sendor emphasizes the urgent need for robust, automated tools to combat the growing sophistication of macOS-specific malware and streamline incident response workflows.

Key moments
- 0:00 Introduction and problem statement for Mac security
- 3:55 Introducing OSXCollector: automated forensic tool for OS X
- 6:30 Key data points collected by OSXCollector
- 12:15 Manual analysis challenges and the need for automation
- 14:35 Automated analysis using output filters and external APIs
- 22:00 Generating actionable recommendations from analysis results
- 24:50 Open-sourcing the reusable Threat Info API
- 29:00 Q&A: Post-incident vs. real-time monitoring
OSXCollector: Automated forensic evidence collection & analysis for OS X
Speakers: Kuba Sendor, Security Engineer, Yelp
Conference: BruCON
YouTube: https://www.youtube.com/watch?v=l-lhyPcSd6I
Overview
In this BruCON 2015 talk, Kuba Sendor, a Security Engineer at Yelp, introduces OSXCollector, an incident response tool designed for automated forensic evidence collection and analysis on macOS systems. The presentation highlights the critical shift in perception regarding macOS security, acknowledging that these systems, once considered inherently secure, have become increasingly attractive targets for attackers due to their widespread popularity in enterprise environments. Sendor emphasizes the urgent need for robust, automated tools to combat the growing sophistication of macOS-specific malware and streamline incident response workflows.
The core of Sendor's discussion revolves around Yelp's journey from a reactive, manual incident response strategy—often resorting to simply wiping infected machines—to a proactive, data-driven approach. OSXCollector emerged from this necessity, providing a lightweight, Python-based solution that collects diverse system diagnostics and user activity data, then normalizes it into a machine-readable JSON format. This structured output facilitates both human analysis and automated enrichment, significantly reducing the time and effort traditionally associated with macOS forensic investigations.
Beyond mere data collection, the talk delves into an innovative analysis framework built around OSXCollector's output. This framework leverages "output filters" to automatically enrich collected data with threat intelligence from internal blacklists and external services like VirusTotal, OpenDNS Investigate, and Shadow Server. By correlating system events with known indicators of compromise and identifying suspicious patterns, the tool aims to provide immediate, actionable insights, enabling defenders to make informed decisions and respond more effectively to security incidents on macOS endpoints.
Background
▶ Watch: Introduction and problem statement for Mac security (0:00)
Yelp, a prominent crowd-sourced review website with over 83 million unique mobile visitors and 3,000+ employees worldwide, faced a significant challenge: a vast majority of its employees used Macs. While macOS was traditionally perceived as a highly secure operating system, this perception had, by 2015, become outdated. Attackers increasingly targeted macOS users, often bundling malware with seemingly innocuous downloads like "Video Converters" or distributing it through untrustworthy download sites such as download.com. This surge in macOS-specific threats exposed a critical gap in Yelp's incident response (IR) capabilities.
Initially, Yelp's IR process for macOS was rudimentary and inefficient. Upon detecting an antivirus alert, the standard procedure was to "wipe the machine" without much in-depth analysis. This reactive approach meant that the same infections would reappear repeatedly, as the root cause and initial access vectors were rarely understood. The lack of an effective forensic collection tool for macOS meant that security teams spent excessive time manually sifting through system logs and user data, or simply lacked the means to do so comprehensively. Existing open-source tools, such as OS X Auditor, provided some utility, but Yelp sought a more integrated and automated solution tailored to their specific needs. This operational bottleneck led to significant frustration among both security teams, who felt disempowered, and users, who experienced frequent disruptions. The need for an automated, consistent, and structured method for collecting forensic evidence from macOS endpoints became paramount to improve Yelp's security posture and streamline their incident response.
Key Findings
▶ Watch: Key data points collected by OSXCollector (6:30)
The development of OSXCollector and its accompanying analysis framework yielded several key findings and contributions, fundamentally transforming Yelp's approach to macOS incident response:
- Automated, Lightweight Forensic Collection: OSXCollector demonstrated that comprehensive forensic data collection on macOS could be achieved with a single, self-contained Python script. This simplicity eliminated the need for complex installations or external dependencies on the target machine, making it ideal for rapid post-incident deployment on isolated systems.
- Standardized JSON Output: The tool's ability to normalize diverse macOS system data—ranging from browser history and kernel extensions to quarantine events and
xattrattributes—into a unified JSON format was a critical breakthrough. This structured output made data both human-readable and machine-parseable, laying the groundwork for automated analysis and correlation. - Unified Timestamps: A significant challenge in forensic analysis is correlating events across different applications and system components, each often using its own timestamp format (e.g., Apple's milliseconds from 2001, Unix epoch seconds). OSXCollector's capability to convert all timestamps into a single, standardized, human- and machine-readable format drastically simplified timeline reconstruction during investigations.
- Leveraging Native macOS Forensics: The project highlighted the rich forensic value embedded in native macOS features. Specifically, the quarantine attribute (recording download provenance including URL, agent, and timestamp) and extended attributes (xattr) (which can even store referrer URLs) proved invaluable for tracing the origin of malicious files.
- Automated Data Enrichment and Analysis: The development of "output filters" and the
threadinfoAPI demonstrated the feasibility and power of automatically augmenting raw forensic data with threat intelligence. By querying internal blacklists and external services like VirusTotal, OpenDNS Investigate, and Shadow Server, the analysis framework could rapidly identify suspicious artifacts, domains, and hashes, moving beyond mere data collection to actionable insights. - Actionable Recommendations: The culminating finding was the ability to generate specific, prioritized recommendations (e.g., "block this domain," "investigate this file") based on the enriched and correlated data. This moved the IR process from raw data interpretation to guided decision-making, significantly accelerating response times and improving the effectiveness of defensive actions.
Technical Deep Dive
▶ Watch: Automated analysis using output filters and external APIs (14:35)
OSXCollector is fundamentally a Python script designed for forensic data acquisition on macOS systems. Its design prioritizes ease of deployment and execution, requiring no external dependencies on the target machine. This is achieved through clever use of the Foundation library, a Python wrapper for Objective-C calls, which is natively available on all macOS installations. This allows OSXCollector to interact directly with macOS APIs and system components without requiring additional package installations.
The tool focuses on collecting a wide array of system diagnostic information, browser history, and evidence of user activity. macOS stores much of its system and application data in specific formats, primarily SQLite databases and Property Lists (plist). OSXCollector is adept at parsing these sources. For instance, it can easily dump the content of SQLite databases using Python's built-in capabilities and convert both binary and plain-text plist files into its standardized JSON output using the Foundation library.
Key data points collected by OSXCollector include:
- Browser History: Gathers browsing data from common browsers like Safari, Firefox, and Chrome.
- Kernel Extensions: Lists loaded kernel extensions, which are critical for identifying rootkits or unauthorized system modifications.
- Startup Items: Enumerates processes or applications configured to run at system startup, a common persistence mechanism for malware.
- Quarantine Information: Captures details from macOS's built-in quarantine mechanism. When a user downloads a file from the internet, macOS records metadata about the download, including the source URL, the downloading agent (e.g., "Google Chrome"), and the timestamp. This information is stored in a plist and persists even if the user bypasses the initial warning, providing invaluable provenance.
- Extended Attributes (xattr): This file system feature allows arbitrary metadata to be attached to files. macOS uses xattr to store specific download information, often including the original download URL and even the referrer URL (the page the user was on before being redirected to the download). This is particularly useful for understanding the full infection chain.
- Email Attachments: If users are utilizing the default Apple Mail application, OSXCollector can gather information about attachments, another common vector for malware delivery.
- Downloads Folder Contents: Scans the user's Downloads directory, a frequent landing zone for malicious payloads.
- Hashes: Computes MD5 hashes for collected files, enabling rapid comparison against threat intelligence databases.
- Signature Chains: Extracts code signature chains from binaries. While macOS itself might not always display warnings for unsigned binaries, this information is crucial for forensic analysis to determine the authenticity and origin of executables.
- Unified Timestamps: A critical feature for correlating events across disparate sources. OSXCollector normalizes various timestamp formats (e.g., Apple's reference date of 2001, Unix epoch in seconds or milliseconds) into a single, consistent, human- and machine-readable format.
The output of OSXCollector is a stream of JSON log entries. Each entry contains common keys such as path, hashes, timestamps, and signature_chain, providing a structured and consistent format for subsequent analysis.
Automated Analysis with Output Filters
To address the time-consuming manual analysis of large JSON output files, Yelp developed a second layer of tooling: a wrapper containing "output filters." These filters are designed to automatically process and enrich the OSXCollector output, providing immediate insights. The filters operate in a chain, progressively augmenting the JSON entries.
Key output filters and their functionalities include:
- Domain Extraction: Parses URLs from the collected data (e.g., from browser history, quarantine, xattr) to extract all subdomains and primary domains. It can even extract domains embedded within query parameters, providing a comprehensive list of potentially visited or referenced domains.
- Internal Blacklist/Whitelist Check: Compares extracted domains and hashes against Yelp's internal blacklists and whitelists. This provides immediate context, flagging known malicious or benign entities. This filter supports both exact matches and regex patterns for flexible matching.
- External Threat Intelligence Integration (via
threadinfoAPI): This is a powerful component that queries external threat intelligence services to enrich the data. - VirusTotal: Queries VirusTotal using file hashes and URLs. The speaker notes the API limits (e.g., 4 calls/minute for public API, 25 calls/minute for commercial licenses) and mentions a caching mechanism to optimize queries and avoid rate limits. A configurable threshold (e.g., 3+ positive hits) helps determine suspiciousness.
- OpenDNS Investigate (now Cisco Umbrella Investigate): Leverages multiple endpoints from OpenDNS.
- Related Domains: Identifies other domains hosted on the same IP address as a suspicious domain, often revealing broader threat infrastructure.
- Reputation Filter: Provides various threat scores, such as the Domain Generation Algorithm (DGA) score, which indicates if a domain was likely automatically generated (often a sign of botnet activity).
- Shadow Server: Acts as a whitelist, indicating whether a given file hash is associated with known legitimate software.
The threadinfo API itself is open-sourced, providing a Pythonic way to interact with these threat intelligence services. It includes a simple caching mechanism to store responses, speeding up subsequent queries for the same indicators, though the speaker acknowledges that more sophisticated caching with timeouts could be beneficial for indicators that change over time (e.g., IP reputations).
The culmination of these filters is a "recommendation part," which, based on the augmented JSON data, suggests specific actions to the analyst (e.g., "block this domain," "investigate this file"). This automated recommendation system significantly reduces cognitive load and accelerates the decision-making process during an incident. The filters are modular, allowing users to enable or disable specific threat intelligence sources based on their licensing or operational needs.
The threadinfo library has also been reused in other Yelp projects, such as roster-alert, a tool for generating alerts from Elasticsearch data. This demonstrates the reusability of the threat intelligence querying capabilities, allowing security teams to enrich alerts with real-time TI from various sources.
Demo / Proof of Concept
▶ Watch: Generating actionable recommendations from analysis results (22:00)
While the speaker didn't perform a live, interactive demo of OSXCollector or its analysis wrapper, he effectively demonstrated the tool's capabilities through detailed slides showcasing its output and the subsequent enrichment process.
The presentation included examples of the raw JSON output generated by OSXCollector, illustrating the structured nature of the collected data. These slides showed entries containing common keys such as file paths, hashes (e.g., MD5 checksums), unified timestamps, and, crucially, signature chains and quarantine information including source URLs and downloading agents. This visual representation highlighted how the tool consolidates disparate system information into a consistent, easily parsable format.
Furthermore, the speaker presented examples of how the "output filters" augmented this raw data. Slides depicted JSON entries enriched with additional fields, such as osxcollector_domains (listing extracted domains from URLs), and threat intelligence scores from services like VirusTotal and OpenDNS Investigate. These enriched entries clearly showed how a simple download event could be automatically flagged as suspicious, with correlated domains, hashes, and reputation scores. The final stage of the demonstration involved slides showing the "recommendation part," where the system suggested specific defensive actions based on the aggregated threat intelligence, such as blocking a detected malicious domain. This effectively served as a proof of concept for the end-to-end automated forensic collection and analysis workflow.
Defensive Implications
▶ Watch: Q&A: Post-incident vs. real-time monitoring (29:00)
OSXCollector and its analysis framework offer significant defensive implications for organizations securing macOS endpoints:
- Accelerated Incident Response: By automating the collection of critical forensic data, OSXCollector drastically reduces the manual effort and time typically spent in the initial phases of incident response. This allows security teams to move swiftly from detection to analysis and containment, minimizing the impact of breaches.
- Proactive Threat Hunting: The structured JSON output facilitates deeper analysis and correlation. Defenders can leverage tools like JQ or integrate the data into SIEM solutions (e.g., Elasticsearch) to proactively hunt for indicators of compromise (IOCs) that might have been missed by traditional alerts.
- Enhanced Malware Provenance: The detailed collection of quarantine data and xattr information provides invaluable insights into the initial access vector of malware. Knowing where a malicious file was downloaded from, the referrer URL, and the downloading application enables defenders to identify compromised websites, block malicious sources, and improve user education.
- Informed Decision Making: The automated enrichment with threat intelligence from VirusTotal, OpenDNS Investigate, and Shadow Server empowers defenders with immediate context. This allows for quicker and more confident decisions regarding the severity of an incident, whether to block a domain, quarantine a file, or escalate an investigation.
- Improved Policy Enforcement: By analyzing patterns in downloaded files and visited URLs, organizations can identify common malware distribution channels (e.g.,
download.com, specific video converter sites) and implement network-level blocks or proxy policies to prevent future infections. - Customizable Threat Intelligence Integration: The open-sourced
threadinfoAPI provides a flexible framework for integrating various threat intelligence sources. Defenders can easily add their internal blacklists and whitelists, or integrate with other commercial or open-source TI feeds relevant to their threat landscape. - Reusable Security Components: The modular design, particularly the
threadinfolibrary, allows security teams to reuse threat intelligence querying capabilities across different security tools and workflows, such as enriching alerts from Elasticsearch (as demonstrated withroster-alert) or other monitoring systems. - Targeted User Education: Understanding how users typically get infected (e.g., ignoring quarantine warnings, downloading bundled software) allows security teams to deliver more targeted and effective security awareness training.
- Baseline and Anomaly Detection: Regularly collecting OSXCollector data can help establish baselines for normal system behavior. Deviations from these baselines (e.g., new kernel extensions, unusual startup items) can then be flagged as potential anomalies requiring investigation.
Key Takeaways
- macOS systems are not immune to attacks; robust, automated incident response tools are crucial for enterprise security.
- OSXCollector provides a lightweight, dependency-free Python tool for comprehensive forensic data collection on macOS, outputting structured JSON.
- The tool effectively leverages native macOS features like quarantine data and extended attributes (xattr) to trace the provenance of downloaded files, including source and referrer URLs.
- An automated analysis framework, using "output filters," enriches collected data with internal blacklists and external threat intelligence from VirusTotal, OpenDNS Investigate, and Shadow Server.
- The open-sourced
threadinfoAPI simplifies the integration of threat intelligence into various security tools, enhancing alert context and enabling proactive threat hunting. - Automated collection and analysis significantly reduce manual effort, accelerate incident response times, and provide actionable recommendations for defenders.
About the Speaker(s)
Kuba Sendor was a Security Engineer at Yelp at the time of this talk, having joined their security team approximately a year prior, in July. His responsibilities at Yelp primarily involved malware Incident Response and automating security processes, with the OSXCollector project being a significant part of that automation effort. Before joining Yelp he worked in France, and he studied at a university of science and technology in Krakow, Poland, including a double-diploma program with a French institute.