Skip to content

At boot

System Extensions: macOS Persistence and Detection

How endpoint security, network and driver system extensions persist on macOS, what db.plist states mean, and how to vet or remove one on a Mac.

MITRE ATT&CK
No dedicated ATT&CK technique
Tactics
Persistence, Defense evasion
Runs
At boot
Set up by
root
Locations
  • /Library/SystemExtensions/db.plist
  • /Library/SystemExtensions/*/*.systemextension
  • /Applications/*.app/Contents/Library/SystemExtensions/*.systemextension

How it works

macOS 10.15 Catalina introduced system extensions as the user-space replacement for most kernel extensions. They run outside the kernel but with privileges no ordinary app gets, and they start with the system:

  • Endpoint Security clients receive process, file and authentication events and can block them; EDR and antivirus products use them. They also need Full Disk Access.
  • Network extensions (content filters, packet tunnels, app and transparent proxies, DNS proxies) see or redirect network traffic; VPNs and firewalls use them.
  • DriverKit drivers (.dext) drive hardware from user space.
  • Camera extensions (Core Media I/O, macOS 12.3 and later) provide virtual cameras.

An extension ships inside its app, in Contents/Library/SystemExtensions/, and the app must sit in /Applications. The app asks the system to activate it; sysextd checks the signature (Developer ID, notarized, with entitlements Apple grants per product for Endpoint Security and network extensions), copies the bundle to /Library/SystemExtensions/<UUID>/ and records it in /Library/SystemExtensions/db.plist. An administrator then approves it in System Settings (Privacy & Security on older releases; General › Login Items & Extensions on current ones), unless an MDM profile with a SystemExtensions payload pre-approves the team ID. From then on launchd keeps it running across restarts until the app deactivates it.

db.plist holds one dictionary per extension with identifier, teamID, bundleVersion, categories, state, originPath (the app it came from), stagedBundleURL and stagedCdhashes, plus top-level extensionPolicies and developerMode. States you will meet include activated_enabled (running), activated_waiting_for_user (awaiting approval), activated_disabled (turned off by the user) and terminated_waiting_to_uninstall_on_reboot (being removed).

systemextensionsctl developer on relaxes the activation checks for development, including the /Applications rule; it requires SIP to be off.

Where it lives

PathWhatWho can write it
/Applications/<App>.app/Contents/Library/SystemExtensions/*.systemextensionThe extension as shippedWhoever can write the app (an admin)
/Library/SystemExtensions/<UUID>/*.systemextensionThe activated copy that actually runsroot, managed by sysextd (never edit by hand)
/Library/SystemExtensions/db.plistState database: identifiers, team IDs, states, categories, origins, policies, developer moderoot, managed by sysextd
Configuration profiles (profiles show)MDM SystemExtensions payload: allowed team IDs and types, extensions users may not removeThe MDM server
/Library/Application Support/com.apple.TCC/TCC.dbFull Disk Access grants that Endpoint Security clients needmacOS (SIP-protected)

There are no per-user system extensions.

How attackers use it

Shipping a malicious system extension takes a Developer ID, notarization, Apple-granted entitlements for the powerful types, and an administrator's click. Publicly documented malware rarely does it; the realistic patterns are below.

Traffic interception dressed up as a product. A "VPN", "ad blocker" or "parental control" app installs a transparent proxy or DNS proxy, and the user approves it like any other prompt. From then on it sees or redirects traffic, for example sending DNS to 203.0.113.53:

--- com.apple.system_extension.network_extension
enabled	active	teamID	bundleID (version)	name	[state]
*	*	A1B2C3D4E5	com.example.shield.proxy (2.1/14)	ShieldProxy	[activated enabled]

Blinding the defender. An attacker with admin rights does not need their own extension: turning off the EDR's Endpoint Security or network extension, removing the MDM profile that protects it, or revoking its Full Disk Access leaves the Mac unwatched. The traces are in db.plist:

<key>identifier</key>
<string>com.example.edr.security-extension</string>
<key>state</key>
<string>terminated_waiting_to_uninstall_on_reboot</string>

Lowered security. On a Mac with SIP off, developerMode set to true lets extensions be activated with fewer checks, from outside /Applications. That combination belongs on developer machines only.

Extensions replaced most kernel extensions, and their host app often also installs LaunchDaemons or login items: review them as one product.

How to check a host

On a live Mac:

systemextensionsctl list                         # every extension, by category, with state
plutil -p /Library/SystemExtensions/db.plist     # team IDs, origins, developerMode, policies
ls -le@ /Library/SystemExtensions/*/
codesign -dv --verbose=4 /Library/SystemExtensions/<UUID>/com.example.shield.proxy.systemextension
codesign -d --entitlements - /Library/SystemExtensions/<UUID>/com.example.shield.proxy.systemextension
sudo profiles show -type configuration            # MDM payloads that approve or protect extensions
log show --last 7d --predicate 'process == "sysextd"'

Map every team ID to a product your organisation uses, and every originPath to an app that is still installed. Confirm that each security product you expect is activated_enabled; anything disabled, waiting or terminating on a managed Mac needs an explanation. developerMode should be false.

Offline, the collection command archives db.plist. Add /Library/SystemExtensions itself to hash the staged bundles and compare their code directory hashes with stagedCdhashes, plus the apps named in originPath, the system TCC database and the installed profiles. macOS Persistence lists every extension in db.plist offline.

What macOS Persistence flags

The tool reads /Library/SystemExtensions/db.plist and reports one entry per extension, with its bundle identifier, team ID, state, categories (shortened, such as network_extension) and origin app. The entry is marked enabled when the state contains enabled, and disabled when it says disabled, terminated or uninstalled.

  • Active endpoint or network extension (info): an Endpoint Security or network extension in an activated_enabled state. It is informational: expected for EDR, VPN and firewall products, worth a look on any other Mac.
  • Runs from a temporary or shared folder, Runs from a hidden folder: the origin app sits under /tmp, /Users/Shared or a dot-folder rather than in /Applications.
  • Changed date (low): db.plist was modified in the 7 days before the newest file in the collection. The time is the database's, so every extension on that host carries the same date; sysextd rewrites the file when any extension changes state.

That is all it judges here. It does not rate team IDs, does not flag a security product that is disabled or terminating, and does not read developerMode or extensionPolicies. It does not read the staged bundles, verify signatures or entitlements, or check the origin path against the path heuristics. It reads the file, not running state: an extension listed as enabled may have crashed, and the database does not say who approved it.

Cleaning up

  1. Preserve: copy db.plist, the extension's /Library/SystemExtensions/<UUID> folder and its app with ditto, hash them, and save systemextensionsctl list, profiles output and the sysextd log.
  2. Remove it the supported way: the app's own uninstaller or deactivate option, the toggle in System Settings › General › Login Items & Extensions, or deleting the app from /Applications in Finder, which normally offers to remove its extensions. If MDM approved it, remove the profile. systemextensionsctl uninstall generally works only with SIP off.
  3. Restart, then confirm with systemextensionsctl list that the extension is gone rather than waiting to uninstall.
  4. If a security product was blinded, re-enable or reinstall it, restore its Full Disk Access and MDM protection, and review the period it was off with other sources.
  5. For a network extension, treat traffic that passed through it as exposed: rotate credentials and tokens used on that Mac, and check DNS, proxy and VPN settings and profiles for leftovers.

References

See also

On Mac Forensics

The artifacts behind this technique, in the Mac Forensics reference: