Detection Library
mediumexperimentalmacOSEndpointT1546.004T1547.015

Shell Profile and Login Item Persistence

Detects modifications to shell startup files (~/.zshrc, ~/.bash_profile, ~/.zprofile) or additions to the Login Items / com.apple.loginitems list by processes other than the user's interactive shell or System Settings, a lightweight persistence technique that survives reboot without needing launchd.

Updated Oct 29, 2026 · Detection Engineering Team

macospersistenceshell-profilelogin-items

Problem Statement

Shell profile persistence is low-effort and launchd-free, making it attractive for lightweight implants that want to survive reboot without registering a plist that EDR vendors have spent years tuning detections for.

Sample Logs

{"event":"fsevent.write","timestamp":"2026-10-29T19:30:12Z","host":"MACBOOK-E5","user":"tchen","image":"/usr/bin/python3","target_filename":"/Users/tchen/.zshrc"}

Required Fields

file.path / TargetFilename
process.image / Image
user.name
host.name
event.timestamp

False Positives

  • ·Dotfile management tooling (chezmoi, GNU stow) run outside an interactive shell
  • ·Language version manager installers (nvm, pyenv, rbenv) appending PATH/init lines
  • ·IDE or terminal app first-run setup wizards

Tuning Guidance

Lower-signal than launchd persistence, so keep severity at medium and focus on volume/novelty: alert when the writing process has no prior history on the host, or when the appended line references a network location (curl, nc, base64 -d) rather than a simple PATH export.