Privilege Escalation and Lateral Movement: The Defender's View
An attacker rarely gets everything on the first try. A phishing click gives a foothold as an ordinary user on one machine. What turns that foothold into a serious breach is what happens next: gaining higher privileges (privilege escalation) and moving to other systems (lateral movement). Understanding these stages shows defenders where to place controls so that one compromised laptop does not become a compromised company. This lesson explains the concepts, the common weaknesses that make them possible and the defences, with lab exercises focused on auditing and hardening.
The Big Picture
| Stage | Goal | MITRE ATT&CK tactic |
|---|---|---|
| Initial access | Get a first foothold | Initial Access |
| Privilege escalation | Gain higher rights (administrator, root, domain admin) | Privilege Escalation |
| Credential access | Obtain passwords, hashes, tokens or keys | Credential Access |
| Discovery | Learn what else is on the network | Discovery |
| Lateral movement | Reach other systems using stolen access | Lateral Movement |
| Persistence | Keep access after reboots or password changes | Persistence |
Real attackers loop through these stages many times. The earlier you break the chain, the smaller the damage.
Privilege Escalation: Vertical and Horizontal
- Vertical escalation: a low-privilege account gains higher privileges, such as a normal user becoming administrator.
- Horizontal escalation: an account gains access to other users’ data at the same level, such as viewing another customer’s records.
Why escalation is possible: common root causes
| Weakness | Linux example | Windows example | Defence |
|---|---|---|---|
| Over-permissive sudo or admin rights | A user may run an editor or interpreter as root through sudo | Everyday accounts in the local Administrators group | Least privilege, review sudoers and group membership |
| Misconfigured SUID/SGID or services | Unexpected SUID binaries that can launch shells | Services running as SYSTEM with writable paths | Audit regularly, restrict file permissions |
| Weak file or folder permissions | World-writable scripts run by root cron jobs | Writable program folders or unquoted service paths | Correct ACLs, integrity monitoring |
| Unpatched kernel or driver flaws | Local kernel vulnerabilities | Local privilege flaws in drivers and services | Fast patching, remove unused drivers |
| Credentials stored carelessly | Passwords in shell history, config files, scripts | Passwords in scripts, shares or memory | Secrets managers, no hard-coded credentials |
| Excessive cloud permissions | Over-broad IAM roles | Over-privileged service principals | Least-privilege roles, regular permission reviews |
Lateral Movement: How One Machine Becomes Many
After gaining credentials or tokens, attackers use legitimate administration channels to hop between systems, since this blends in with normal activity. Common routes include:
- Remote administration protocols such as RDP, SSH, SMB, WinRM and remote management tools.
- Reusing the same local administrator password across many machines.
- Stolen authentication material, such as password hashes, Kerberos tickets or cloud tokens, being replayed.
- Misconfigured trust relationships between networks, domains or cloud accounts.
- Abusing software deployment and management systems that already have broad access.
The defensive insight is that these paths rely on trust you granted. Segmentation, unique credentials and tiered administration remove the paths.
Defence in Depth Against Escalation and Movement
- Least privilege everywhere. Daily-use accounts should not be administrators. Use just-in-time elevation for admin tasks.
- Unique local administrator passwords per machine, managed by a tool such as Microsoft LAPS (or Windows LAPS) so one stolen password does not open every system.
- Tiered administration. Domain-level admin accounts log in only to domain controllers and dedicated admin workstations, never to ordinary user PCs.
- Network segmentation. Workstations should not be able to reach each other on management ports; see Firewalls, IDS/IPS and Segmentation.
- Multi-factor authentication for remote access, admin portals and privileged actions; see Password Security.
- Credential hygiene. Protect credential storage (for example, Credential Guard and LSA protection on Windows), disable legacy protocols such as NTLM where possible and prevent cached admin credentials on workstations.
- Patch management for kernels, drivers and services.
- Monitoring and detection of unusual logons, new admin group members, new services and unusual remote execution; see SIEM, Logging and SOC Operations.
Practice Lab 1: Audit Linux for Escalation Weaknesses (Your Own VM)
These are audit commands. They list configuration so you can fix it. Run them on a lab VM you own.
# Who can use sudo, and for what?
sudo -l
sudo cat /etc/sudoers
ls /etc/sudoers.d/
# Files with the SUID bit set (they run with their owner's rights)
find / -perm -4000 -type f 2>/dev/null
# World-writable files and directories outside /tmp
find / -xdev -type f -perm -0002 2>/dev/null | head -50
# Scheduled jobs run by root
sudo ls -l /etc/cron* /var/spool/cron 2>/dev/null
# Credentials accidentally left around
grep -rIl "password" /home 2>/dev/null | head
For each finding, decide: is it needed? Who owns it? What would happen if an ordinary user could modify it? Compare your SUID list with a known-good baseline from a fresh installation, and remove or restrict anything unexpected.
Practice Lab 2: Audit Windows and Active Directory (Your Own Lab Domain)
# Local administrators
net localgroup Administrators
# Services and the accounts they run as
Get-CimInstance Win32_Service | Select-Object Name, StartName, PathName | Format-Table -AutoSize
# Privileged group members in a lab domain
Get-ADGroupMember "Domain Admins" | Select-Object Name, SamAccountName
# Recent logon events (4624 success, 4625 failure) on a lab machine
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624,4625} -MaxEvents 20
Questions to answer: Is every member of the administrator groups justified? Are there service paths with spaces and no quotes that sit in writable folders? Do any services run as highly privileged accounts without need? Write remediation actions for each.
Practice Lab 3: Build a Detection
- Create a new local user in your lab VM and add it to an admin group.
- Find the corresponding events (on Windows, event IDs 4720 for account creation and 4732 for a member added to a local group; on Linux, entries in
/var/log/auth.logor the journal). - Write a simple alert rule in your lab SIEM or script that flags “new account added to an admin group”.
- Repeat the action and verify your alert fires. This is a real detection technique used in security operations centres.
Common Mistakes
- Giving users local administrator rights “to avoid support calls”.
- Using one shared admin password across the estate.
- Letting domain administrators log in to ordinary workstations.
- Flat networks where any machine can connect to any other machine’s management ports.
- Storing credentials in scripts, shares and documentation.
Practice Exercises
- Explain vertical versus horizontal privilege escalation, with one real-world example of each.
- Sketch a three-tier administration model for a company with 200 PCs, 20 servers and 2 domain controllers.
- List four events a defender should alert on that could indicate lateral movement.
- Describe how unique local admin passwords limit the damage of a single compromised laptop.
Mentor tip: When you review an environment, ask one question first: “If this one account were stolen today, what could it reach?” The answer usually reveals the most important fix.
Educational use only: audit only systems you own or are authorised to assess. Attempting to gain higher access on systems without permission is illegal.
- Escalation raises privileges; lateral movement spreads access to other systems.
- Most escalation relies on misconfiguration, weak permissions, poor credential handling or missing patches.
- Least privilege, unique admin passwords, tiered administration and segmentation break the chain.
- Audit regularly and alert on new admins, new services and unusual remote logons.
- Think in terms of blast radius: what can one stolen account reach?