Techniques de persistance macOS
Chaque emplacement d’un Mac qui fait réexécuter du code : ce qui le lit et quand, où il se trouve, comment les intrus l’exploitent et comment vérifier un hôte. Chaque page renvoie à MITRE ATT&CK et à ce que signale l’outil macOS Persistence.
Par déclencheur
Au démarrage
- Kernel extensionsEn anglaisHow kexts in /Library/Extensions load at boot on macOS, what approval and Reduced Security require, and how to find and remove a planted kernel extension.T1547.006root
- LaunchDaemonsEn anglaisHow macOS LaunchDaemons run code as root at boot, how attackers plant and hijack them, and how to find, check and remove a malicious daemon.T1543.004root
- rc scripts and launchd.confEn anglaisWhat /etc/rc.common, /etc/rc.local and /etc/launchd.conf did on older macOS, why current releases ignore them, and how to check them during triage.T1037.004root
- StartupItemsEn anglaisHow /Library/StartupItems and StartupParameters.plist once ran scripts as root at boot, why modern macOS ignores them, and what one on disk still tells you.T1037.005root
- System extensionsEn anglaisHow 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.root
Planifié
- at jobsEn anglaisHow at jobs work on macOS: atrun disabled by default, job files in /private/var/at/jobs, how attackers abuse them, how to check a Mac and remove them.T1053.002Utilisateurs et root
- Cron jobsEn anglaisHow cron persistence works on macOS: user crontabs in /private/var/at/tabs, /etc/crontab, how attackers plant jobs, how to check a Mac and clean up.T1053.003Utilisateurs et root
- Periodic scriptsEn anglaisHow periodic persistence works on macOS: /etc/periodic scripts, periodic.conf *_local settings, which releases still run them, and how to check and clean up.T1053root
À la connexion
- LaunchAgentsEn anglaisHow macOS LaunchAgents give per-user persistence through launchd, how attackers plant them, and how to find, check and remove a malicious agent.T1543.001Utilisateurs et root
- Local accountsEn anglaisHow attackers persist on macOS with hidden admin users, UID 0 clones and service-looking accounts in dslocal, and how to find and remove them safely.T1136.001T1078.003T1564.002root
- Login hooksEn anglaisHow the deprecated loginwindow LoginHook and LogoutHook run a script as root at each login, what is known on current macOS, and how to find and remove one.T1037.002root
- Login itemsEn anglaisHow macOS login items, SMAppService helpers and the Background Task Management store work, how attackers abuse them, and how to audit them with sfltool.T1547.015Utilisateurs et root
- Reopened applicationsEn anglaisHow macOS reopens apps at login from the ByHost loginwindow plist (TALAppsToRelaunchAtLogin), how attackers add their own app, and how to check and clean it.T1547.007Tout utilisateur
À chaque nouveau shell
- History tamperingEn anglaisHow attackers stop zsh recording commands on macOS (history linked to /dev/null, HISTFILE, SAVEHIST), what Terminal's zsh_sessions keep, and how to detect it.T1070.003Tout utilisateur
- Shell startup filesEn anglaisHow zsh and bash startup files give persistence on macOS: /etc/zshrc, ~/.zshrc, ~/.zshenv, aliases and prompt hooks, and how to check and clean a Mac.T1546.004Utilisateurs et root
À la connexion SSH
- SSH authorized keysEn anglaisHow SSH authorized_keys persistence works on macOS: Remote Login, ~/.ssh/authorized_keys, root keys and key options, and how to check and clean a Mac.T1098.004Utilisateurs et root
- sshd configurationEn anglaisHow sshd configuration enables persistence on macOS: sshd_config, sshd_config.d drop-ins, ~/.ssh/rc and Remote Login, and how to check and fix a Mac.T1098.004root
À l’authentification
- Authorization pluginsEn anglaisHow SecurityAgent authorization plugins and auth.db mechanisms give root code and passwords at every macOS login, and how to find and remove one.T1556root
- PAM modulesEn anglaisHow PAM stacks in /etc/pam.d and sudo_local are abused on macOS for backdoor passwords and credential theft, and how to check and clean a Mac.T1556.003root
Privilège
Sur événement
Aide-mémoire
Une ligne par technique : quand elle s’exécute, qui peut la mettre en place, les principaux emplacements et la correspondance ATT&CK.
| Technique | Déclenchement | Mis en place par | Emplacements principaux | ATT&CK |
|---|---|---|---|---|
| at jobsEn anglais | Planifié | Utilisateurs et root | /private/var/at/jobs/* · /usr/lib/cron/jobs/* · /var/db/com.apple.xpc.launchd/disabled.plist | T1053.002 |
| Authorization pluginsEn anglais | À l’authentification | root | /Library/Security/SecurityAgentPlugins/*.bundle · /var/db/auth.db | T1556 |
| Cron jobsEn anglais | Planifié | Utilisateurs et root | /private/var/at/tabs/* · /usr/lib/cron/tabs/* · /etc/crontab | T1053.003 |
| Event Monitor (emond)En anglais | Sur événement | root | /etc/emond.d/rules/*.plist · /etc/emond.d/emond.plist · /private/var/db/emondClients/* | T1546.014 |
| History tamperingEn anglais | À chaque nouveau shell | Tout utilisateur | ~/.zsh_history · ~/.zsh_sessions/*.history · ~/.bash_history · /private/var/root/.zsh_history | T1070.003 |
| Kernel extensionsEn anglais | Au démarrage | root | /Library/Extensions/*.kext · /Library/StagedExtensions/**/*.kext · /var/db/SystemPolicyConfiguration/KextPolicy | T1547.006 |
| LaunchAgentsEn anglais | À la connexion | Utilisateurs et root | /Library/LaunchAgents/*.plist · ~/Library/LaunchAgents/*.plist · /private/var/db/com.apple.xpc.launchd/disabled.*.plist | T1543.001 |
| LaunchDaemonsEn anglais | Au démarrage | root | /Library/LaunchDaemons/*.plist · /Library/PrivilegedHelperTools/* · /private/var/db/com.apple.xpc.launchd/disabled.plist | T1543.004 |
| Local accountsEn anglais | À la connexion | root | /var/db/dslocal/nodes/Default/users/*.plist · /var/db/dslocal/nodes/Default/groups/admin.plist · /Library/Preferences/com.apple.loginwindow.plist | T1136.001, T1078.003, T1564.002 |
| Login hooksEn anglais | À la connexion | root | /private/var/root/Library/Preferences/com.apple.loginwindow.plist · /Library/Preferences/com.apple.loginwindow.plist · /Library/Managed Preferences/com.apple.loginwindow.plist | T1037.002 |
| Login itemsEn anglais | À la connexion | Utilisateurs et root | /private/var/db/com.apple.backgroundtaskmanagement/BackgroundItems-v*.btm · /Applications/*.app/Contents/Library/LoginItems/*.app · ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm · ~/Library/Preferences/com.apple.loginitems.plist | T1547.015 |
| PAM modulesEn anglais | À l’authentification | root | /etc/pam.d/* · /etc/pam.d/sudo_local · /etc/pam.conf · /usr/local/etc/pam.d/* | T1556.003 |
| Periodic scriptsEn anglais | Planifié | root | /etc/periodic/daily/* · /etc/periodic/weekly/* · /etc/periodic/monthly/* · /usr/local/etc/periodic/* | T1053 |
| rc scripts and launchd.confEn anglais | Au démarrage | root | /etc/rc.common · /etc/rc.local · /etc/launchd.conf | T1037.004 |
| Reopened applicationsEn anglais | À la connexion | Tout utilisateur | ~/Library/Preferences/ByHost/com.apple.loginwindow.*.plist | T1547.007 |
| Shell startup filesEn anglais | À chaque nouveau shell | Utilisateurs et root | /etc/zshenv · /etc/zprofile · /etc/zshrc · /etc/zlogin | T1546.004 |
| SSH authorized keysEn anglais | À la connexion SSH | Utilisateurs et root | ~/.ssh/authorized_keys · /var/root/.ssh/authorized_keys | T1098.004 |
| sshd configurationEn anglais | À la connexion SSH | root | /etc/ssh/sshd_config · /etc/ssh/sshd_config.d/* · /etc/ssh/sshrc · ~/.ssh/rc | T1098.004 |
| StartupItemsEn anglais | Au démarrage | root | /Library/StartupItems/*/* · /Library/StartupItems/*/StartupParameters.plist · /System/Library/StartupItems/* | T1037.005 |
| Sudoers rulesEn anglais | Privilège | root | /etc/sudoers · /etc/sudoers.d/* | T1548.003 |
| System extensionsEn anglais | Au démarrage | root | /Library/SystemExtensions/db.plist · /Library/SystemExtensions/*/*.systemextension · /Applications/*.app/Contents/Library/SystemExtensions/*.systemextension | — |
Couverture MITRE ATT&CK
Les techniques ATT&CK couvertes par ces pages et par l’outil. Certains mécanismes n’ont pas de sous-technique propre et sont classés sous la technique parente la plus proche.