Técnicas de persistencia en macOS
Cada lugar de un Mac que hace que se vuelva a ejecutar código: qué lo lee y cuándo, dónde reside, cómo lo aprovechan los intrusos y cómo revisar un equipo. Cada página se corresponde con MITRE ATT&CK y con lo que marca la herramienta macOS Persistence.
Por disparador
Al arrancar
- Kernel extensionsEn inglésHow 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 inglésHow 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 inglésWhat /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 inglésHow /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 inglésHow 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
Programado
- at jobsEn inglésHow 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.002Usuarios y root
- Cron jobsEn inglésHow 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.003Usuarios y root
- Periodic scriptsEn inglésHow 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
Al iniciar sesión
- LaunchAgentsEn inglésHow macOS LaunchAgents give per-user persistence through launchd, how attackers plant them, and how to find, check and remove a malicious agent.T1543.001Usuarios y root
- Local accountsEn inglésHow 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 inglésHow 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 inglésHow macOS login items, SMAppService helpers and the Background Task Management store work, how attackers abuse them, and how to audit them with sfltool.T1547.015Usuarios y root
- Reopened applicationsEn inglésHow 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.007Cualquier usuario
En cada shell nuevo
- History tamperingEn inglésHow 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.003Cualquier usuario
- Shell startup filesEn inglésHow 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.004Usuarios y root
Al iniciar sesión por SSH
- SSH authorized keysEn inglésHow 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.004Usuarios y root
- sshd configurationEn inglésHow 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
Al autenticarse
- Authorization pluginsEn inglésHow 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 inglésHow 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
Privilegio
Ante un evento
Referencia rápida
Una línea por técnica: cuándo se ejecuta, quién puede configurarla, las ubicaciones principales y la correspondencia con ATT&CK.
| Técnica | Disparador | Configurado por | Ubicaciones principales | ATT&CK |
|---|---|---|---|---|
| at jobsEn inglés | Programado | Usuarios y root | /private/var/at/jobs/* · /usr/lib/cron/jobs/* · /var/db/com.apple.xpc.launchd/disabled.plist | T1053.002 |
| Authorization pluginsEn inglés | Al autenticarse | root | /Library/Security/SecurityAgentPlugins/*.bundle · /var/db/auth.db | T1556 |
| Cron jobsEn inglés | Programado | Usuarios y root | /private/var/at/tabs/* · /usr/lib/cron/tabs/* · /etc/crontab | T1053.003 |
| Event Monitor (emond)En inglés | Ante un evento | root | /etc/emond.d/rules/*.plist · /etc/emond.d/emond.plist · /private/var/db/emondClients/* | T1546.014 |
| History tamperingEn inglés | En cada shell nuevo | Cualquier usuario | ~/.zsh_history · ~/.zsh_sessions/*.history · ~/.bash_history · /private/var/root/.zsh_history | T1070.003 |
| Kernel extensionsEn inglés | Al arrancar | root | /Library/Extensions/*.kext · /Library/StagedExtensions/**/*.kext · /var/db/SystemPolicyConfiguration/KextPolicy | T1547.006 |
| LaunchAgentsEn inglés | Al iniciar sesión | Usuarios y root | /Library/LaunchAgents/*.plist · ~/Library/LaunchAgents/*.plist · /private/var/db/com.apple.xpc.launchd/disabled.*.plist | T1543.001 |
| LaunchDaemonsEn inglés | Al arrancar | root | /Library/LaunchDaemons/*.plist · /Library/PrivilegedHelperTools/* · /private/var/db/com.apple.xpc.launchd/disabled.plist | T1543.004 |
| Local accountsEn inglés | Al iniciar sesión | 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 inglés | Al iniciar sesión | 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 inglés | Al iniciar sesión | Usuarios y 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 inglés | Al autenticarse | root | /etc/pam.d/* · /etc/pam.d/sudo_local · /etc/pam.conf · /usr/local/etc/pam.d/* | T1556.003 |
| Periodic scriptsEn inglés | Programado | root | /etc/periodic/daily/* · /etc/periodic/weekly/* · /etc/periodic/monthly/* · /usr/local/etc/periodic/* | T1053 |
| rc scripts and launchd.confEn inglés | Al arrancar | root | /etc/rc.common · /etc/rc.local · /etc/launchd.conf | T1037.004 |
| Reopened applicationsEn inglés | Al iniciar sesión | Cualquier usuario | ~/Library/Preferences/ByHost/com.apple.loginwindow.*.plist | T1547.007 |
| Shell startup filesEn inglés | En cada shell nuevo | Usuarios y root | /etc/zshenv · /etc/zprofile · /etc/zshrc · /etc/zlogin | T1546.004 |
| SSH authorized keysEn inglés | Al iniciar sesión por SSH | Usuarios y root | ~/.ssh/authorized_keys · /var/root/.ssh/authorized_keys | T1098.004 |
| sshd configurationEn inglés | Al iniciar sesión por SSH | root | /etc/ssh/sshd_config · /etc/ssh/sshd_config.d/* · /etc/ssh/sshrc · ~/.ssh/rc | T1098.004 |
| StartupItemsEn inglés | Al arrancar | root | /Library/StartupItems/*/* · /Library/StartupItems/*/StartupParameters.plist · /System/Library/StartupItems/* | T1037.005 |
| Sudoers rulesEn inglés | Privilegio | root | /etc/sudoers · /etc/sudoers.d/* | T1548.003 |
| System extensionsEn inglés | Al arrancar | root | /Library/SystemExtensions/db.plist · /Library/SystemExtensions/*/*.systemextension · /Applications/*.app/Contents/Library/SystemExtensions/*.systemextension | — |
Cobertura de MITRE ATT&CK
Las técnicas de ATT&CK que cubren estas páginas y la herramienta. Algunos mecanismos no tienen subtécnica propia y figuran bajo la técnica principal más cercana.