Join our Newsletter — 33% off our NHI Course

Persistence hook

A mechanism that causes malware to run again after login, session start, or routine user activity. Common examples include LaunchAgents, shell profile changes, and global hooks, which let the attacker regain execution without relying on the original installer again.

How Persistence Hooks Work

A persistence hook is a mechanism that reintroduces malicious code after a normal restart, login, or routine user activity. It works by attaching execution to a place the system or user already expects to run, so the malware does not need to rely on the original installer or launch path again.

That attachment point can be obvious, such as a startup item, or subtle, such as a shell profile, browser extension, or globally registered callback. The important security property is not the file name itself, but the fact that the code is positioned to regain execution through ordinary operating-system behaviour.

Why Persistence Hooks Matter

Persistence hooks are dangerous because they convert a one-time intrusion into recurring execution. Once an attacker has found a reliable hook, the malware can survive user logoff, reboot, or a partial cleanup and may quietly reappear before defenders realise the system was not fully remediated.

They also raise the cost of incident response. If defenders remove the visible payload but miss the hook, the compromise can recur from the same trigger point, often with a different binary, updated script, or freshly staged component.

In identity-heavy environments, persistence often becomes part of a broader compromise chain, where the attacker keeps returning through login-linked execution paths and reuses stolen session material or valid accounts to maintain access. NHIMG’s Identity Threat Detection and Response (ITDR) Guide is useful for understanding how recurring execution and identity abuse intersect during detection and response.

Common Hooking Patterns and Where They Hide

Persistence hooks are frequently planted in locations that blend into normal administration and user activity. On endpoints, that can include login scripts, scheduled execution, startup folders, launch agents, profile files, or application-specific auto-run settings. The attacker’s goal is to make the malicious action look like routine system behaviour.

Hooks can also be embedded in places that are easy to overlook during cleanup, especially when the malicious logic is small and the real payload is fetched later. That means investigators should think in terms of execution paths, not just filenames or hashes, when tracing how the malware keeps coming back.

For a concrete example of how stolen access and repeated re-entry can sustain long-lived compromise, see Salt Typhoon telecom intrusions 2025, which shows how persistence can be reinforced by recovered access and reused trust.

How to Find and Remove Them

Finding a persistence hook usually requires checking the system’s startup and user-execution surfaces together, then comparing them against what should legitimately be present. The most reliable approach is to combine endpoint telemetry, autorun inspection, script review, and configuration baselines so that hidden execution points do not survive a cleanup pass.

Removal should focus on both the hook and whatever enabled it. If the attacker changed a profile file, registered a launch item, or inserted a global hook, deleting the payload alone is not enough. The full execution path has to be removed, and the affected account or host should be reviewed for any related tampering.

Because these hooks often piggyback on standard operating-system behaviour, vendor and platform guidance matters. For hardening and control expectations around endpoint execution and configuration, the NIST SP 800-53 Rev 5 Security and Privacy Controls catalog remains a useful reference point, especially where configuration integrity and monitoring are in scope.

Risk and Threat Considerations

Persistence hooks matter because they turn temporary footholds into durable access. Even after visible malware is removed, the hook can recreate execution on the next login, shell start, or application event, which makes reinfection and stealthy re-entry much more likely.

Failure mechanism: The attacker places code in a normal execution path that defenders are unlikely to treat as malicious, then relies on that path to relaunch the payload after routine user or system activity.

Impact: Cleanup becomes incomplete, incident containment takes longer, and the attacker may retain a repeatable route back into the host or user context.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
MITRE ATT&CK T1547 — Boot or Logon Autostart Execution Persistence hooks are a common autostart persistence technique.
Recommendation — Map autorun artefacts to T1547 and hunt for hidden relaunch points after login or startup.
NIST SP 800-53 Rev 5 CM-6 — Configuration Settings Persistence hooks exploit configuration surfaces that should be governed and baselined.
SI-4 — System Monitoring Detection depends on monitoring for abnormal recurring execution from trusted system paths.
Recommendation — Baseline and review startup and execution settings to prevent unauthorized persistence changes. Monitor execution paths for unexpected relaunch behaviour and repeated post-login activity.
CIS Controls v8 CIS-4 — Secure Configuration of Enterprise Assets and Software Persistence hooks often survive where startup and application execution settings are not hardened.
CIS-10 — Malware Defenses Persistence hooks are malware behaviour that should be detected and contained by anti-malware controls.
Recommendation — Harden and continuously verify autorun and startup configurations on endpoints. Use malware defenses to detect, block, and remove recurring malicious execution paths.

Practitioner Guidance

What to watch for: Treat any unexpected auto-start behaviour, profile modification, or newly appearing global hook as a security finding, not a maintenance issue. Persistence is often discovered only when teams inspect how code is being relaunched, not just what file was first delivered.

Practitioner takeaway: Validate the execution chain, not just the payload, because persistence usually survives the first cleanup attempt.