Add provenance data collection support#71
Merged
Conversation
c7bercat
reviewed
Aug 15, 2025
Collaborator
c7bercat
left a comment
There was a problem hiding this comment.
Nice PR! Just a small note that I hope you'll address. I tested out your changes and they look good to me besides the part to do with the comment. I'll be happy to approve after the comment has been resolved. Thanks!
c7bercat
approved these changes
Aug 18, 2025
saljooki
approved these changes
Aug 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds support for collecting provenance extended attributes in Aftermath.
Specifically, it introduces the following features:
com.apple.provenanceextended attributeprovenance_trackingtable in the ExecPolicy file, which stores application information associated with thecom.apple.provenanceextended attributeInformation about the provenance extended attribute is included in my Black Hat presentation slides. However, due to time constraints, only an overview is provided there. Below is a brief explanation of how the provenance extended attribute can be utilized.
About the provenance extended attribute (introduced in macOS Ventura)
When an application is executed for the first time, syspolicyd assigns the provenance extended attribute (
com.apple.provenance) to the application bundle and inserts application-related information (such as code signature and hash values) into theprovenance_trackingtable in the ExecPolicy database. This attribute is an 11-byte integer; the purpose of the first 3 bytes is currently unknown, while the remaining 8 bytes are random values.The
pkfield in theprovenance_trackingtable corresponds to the 8-byte integer value of thecom.apple.provenanceattribute. For example:In the example above, the
pkvalue is-9131926598259274488(=0x8144e12453d08d08).The same value is assigned to the ChatGPT application bundle:
When an application bundle with a provenance extended attribute is executed, the application runs inside the provenance sandbox. Any files created or modified1 by an application running in this sandbox inherit the same
com.apple.provenanceextended attribute as the application bundle. By checking the provenance extended attribute of a file and referencing theprovenance_trackingtable in ExecPolicy, it becomes possible to determine which application created or modified that file. I've created a basic example demonstrating how to use the provenance attribute. Please check it out as well.This capability can be used, for example, to identify which application created a persistence-related plist file in
~/Library/LaunchAgents.Other potential use cases have also been identified (e.g., detecting the use of reflective loaders implemented with
NSCreateObjectFileImageFromMemoryandNSLinkModule).Further technical details will be included in the white paper for my Black Hat talk, which I plan to share here once available.
Footnotes
Technically speaking, when file operations listed here are performed, the provenance attribute is attached to the target file. ↩