Lateral Movement and Credential Reuse
A single compromised workstation is rarely the end of an intrusion. Attackers move laterally: from the first host to others, using the credentials and trust relationships they find, until they reach what they came for. In real incidents this phase usually involves no exploit at all, just valid accounts used over ordinary administration protocols. That is why it is hard to detect and why its fixes are about identity and administration design rather than patches. This lesson covers the concepts, models the most common enabler (one local administrator password shared by many machines) as a graph, and builds the detection that finds one account fanning out across the network. It is concept-level by design: techniques are named so that they can be recognised, detected and prevented, not performed.
In a penetration test, lateral movement is in scope only if the RoE says so, only between in-scope hosts, and usually only as far as needed to demonstrate one path; see Post-Exploitation Boundaries.
The concepts
| Concept | What it means | Why it works |
|---|---|---|
| Credential reuse | the same password (or the same local administrator account) on many systems | one stolen secret opens all of them |
| Credential material | what can be taken from a compromised host: passwords in files and memory, password hashes, Kerberos tickets, browser and application tokens, SSH keys | Windows authentication protocols accept a hash or a ticket in place of the password (pass-the-hash, pass-the-ticket); an SSH key needs no password at all |
| Remote administration protocols | SMB with remote service creation, WMI, WinRM/PowerShell remoting, RDP, SSH | they are legitimate, usually allowed between internal hosts, and look like administration |
| Trust relationships | administrators logging on to workstations, service accounts with rights on many servers, backup and monitoring systems that can reach everything | a privileged account's credentials end up on lower-trust machines |
The underlying failure is almost always the same: credentials of a higher tier are exposed on a lower tier, or one credential is valid in too many places.
Modelling local administrator reuse
Machines built from one image often share the local administrator password. The model below is a synthetic export of the lab estate: each host and a fingerprint of its local administrator password (a label standing in for the hash, so that equal labels mean equal passwords). It computes the blast radius of one compromised machine, and the effect of unique passwords per machine, which is what Windows LAPS provides.
import networkx as nx
local_admin = { # host -> label of its local Administrator password hash (synthetic)
"ws11": "img-2024", "ws12": "img-2024", "ws13": "img-2024", "ws14": "img-2024",
"ws15": "img-2024", "ws16": "img-2025", "ws17": "img-2025", "ws18": "img-2025",
"kiosk1": "kiosk", "files01": "srv-a", "jenkins": "srv-a", "db01": "srv-b",
}
admin_sessions = { # where privileged domain accounts were logged on recently (synthetic)
"ws13": ["lab\\helpdesk"], "jenkins": ["lab\\svc-deploy"], "files01": ["lab\\srv-admin"],
}
def reuse_graph(passwords):
G = nx.Graph()
G.add_nodes_from(passwords)
by_secret = {}
for host, secret in passwords.items():
by_secret.setdefault(secret, []).append(host)
for hosts in by_secret.values():
for a in hosts:
for b in hosts:
if a < b:
G.add_edge(a, b)
return G
def report(title, passwords):
G = reuse_graph(passwords)
groups = sorted((sorted(c) for c in nx.connected_components(G) if len(c) > 1), key=len, reverse=True)
print(title)
for g in groups:
exposed = sorted({acct for h in g for acct in admin_sessions.get(h, [])})
print(f" {len(g)} hosts share one password: {', '.join(g)}")
if exposed:
print(f" privileged sessions on them: {', '.join(exposed)}")
worst = max((len(nx.node_connected_component(G, h)) for h in G), default=1)
print(f" worst case: one compromised host opens {worst} host(s)")
report("before", local_admin)
laps = {h: f"unique-{h}" for h in local_admin} # Windows LAPS: one rotated password per machine
report("after LAPS", laps)before
5 hosts share one password: ws11, ws12, ws13, ws14, ws15
privileged sessions on them: lab\helpdesk
3 hosts share one password: ws16, ws17, ws18
2 hosts share one password: files01, jenkins
privileged sessions on them: lab\srv-admin, lab\svc-deploy
worst case: one compromised host opens 5 host(s)
after LAPS
worst case: one compromised host opens 1 host(s)
Before the fix, any one of five workstations opens all five, and one of them (ws13) has a helpdesk administrator's session on it, whose credentials may be recoverable from memory there: the path leads from an ordinary workstation into the help desk's rights. The two servers files01 and jenkins share a password, and both carry sessions of privileged service and admin accounts. After LAPS, every machine stands alone. The remaining risk, privileged sessions on lower-tier machines, is fixed by administration design (below).
Detecting lateral movement
Valid-account movement can't be caught by signatures, but its shape is distinctive: one account, many destinations, in a short time, often over network logons. Windows records network logons as event 4624 with logon type 3 (and RDP as type 10), with the source address and the authentication package (NTLM or Kerberos). The events below are synthetic.
from collections import defaultdict
logons = [ # (minute, account, source host, destination host, logon type, auth package) - synthetic 4624 events
(0, "lab\\j.pham", "ws17", "files01", 3, "Kerberos"),
(2, "lab\\j.pham", "ws17", "mail", 3, "Kerberos"),
(5, ".\\Administrator", "ws12", "ws11", 3, "NTLM"),
(5, ".\\Administrator", "ws12", "ws13", 3, "NTLM"),
(6, ".\\Administrator", "ws12", "ws14", 3, "NTLM"),
(6, ".\\Administrator", "ws12", "ws15", 3, "NTLM"),
(7, "lab\\helpdesk", "ws13", "ws16", 10, "Kerberos"),
(8, "lab\\helpdesk", "ws13", "files01", 3, "Kerberos"),
(8, "lab\\helpdesk", "ws13", "jenkins", 3, "Kerberos"),
(30, "lab\\svc-backup", "backup01", "files01", 3, "Kerberos"),
(30, "lab\\svc-backup", "backup01", "db01", 3, "Kerberos"),
]
WINDOW, FANOUT = 10, 3
EXPECTED = {"lab\\svc-backup": "backup01"} # known service behaviour, reviewed
seen, span = defaultdict(set), defaultdict(list)
for minute, acct, src, dst, ltype, pkg in logons:
seen[(acct, src)].add(dst)
span[(acct, src)].append(minute)
for (acct, src), dsts in seen.items():
notes = []
quick = max(span[(acct, src)]) - min(span[(acct, src)]) <= WINDOW
if len(dsts) >= FANOUT and quick and EXPECTED.get(acct) != src:
notes.append(f"fan-out to {len(dsts)} hosts within {WINDOW} min")
if acct.startswith(".\\"):
notes.append("LOCAL account used across machines (password reuse?)")
if any(pkg == "NTLM" for m, a, s, d, t, pkg in logons if a == acct and s == src):
notes.append("NTLM network logons")
if notes:
print(f"ALERT {acct:<17} from {src:<8} -> {', '.join(sorted(dsts))}: {'; '.join(notes)}")ALERT .\Administrator from ws12 -> ws11, ws13, ws14, ws15: fan-out to 4 hosts within 10 min; LOCAL account used across machines (password reuse?); NTLM network logons
ALERT lab\helpdesk from ws13 -> files01, jenkins, ws16: fan-out to 3 hosts within 10 min
The local Administrator account logging on from ws12 to four other workstations with NTLM is the reuse path from the model, seen in logs: local accounts should never authenticate across the network. The help desk account fanning out from ws13 (including an RDP session) to servers it doesn't normally administer is the second alert. The backup account's fan-out is expected and allow-listed, which is exactly the tuning every real rule needs. In an announced test, these alerts (or their absence) are the detection half of the finding.
How lateral movement is prevented
- Unique local administrator passwords on every machine (Windows LAPS), and deny network logon for local accounts (the "Deny access to this computer from the network" right for the
Local accountgroup). - Administrative tiering: separate accounts for workstation, server and domain administration; higher-tier accounts never log on to lower-tier machines; privileged access workstations for administrators. This removes the credentials an attacker would find.
- Protect credential material: Credential Guard, the Protected Users group for administrators, no interactive logons by service accounts, gMSAs for services, short-lived Kerberos tickets.
- Restrict administration protocols to management hosts at the firewall (SMB, WinRM, RDP and SSH from the admin network only), and segment workstations from each other: workstations rarely need to talk to each other at all.
- Phase out NTLM where possible, and require SMB signing (see Enumerating SMB and LDAP).
The Active Directory side (Kerberos, delegation, attack-path graphs) is the subject of Windows & Active Directory Security.
Pitfalls
- Testing lateral movement because it is possible. It must be in the RoE, between in-scope hosts, and stop at the first proof of the path.
- Reporting each reused password separately. The finding is the reuse (one root cause, many hosts); list the hosts as evidence.
- Treating lateral movement as a network problem only. Firewall rules help, but credentials and administration habits are the root cause.
Practice
- In the reuse model, give
ws13a unique password but keep the others. How large is the biggest group now, and does the helpdesk exposure remain? - Tune the detection so that it ignores fan-out by
lab\helpdeskonly from the help desk's admin workstationpaw01. Why is that safer than allow-listing the account?
Answers
- Four workstations (
ws11,ws12,ws14,ws15) still share one password;ws13stands alone, so its helpdesk session is no longer reachable through password reuse. It is still a tier violation: a helpdesk administrator logged on to a workstation exposes their credentials to anyone who compromises that workstation. - Add
"lab\\helpdesk": "paw01"toEXPECTED. The rule then still fires when the same account fans out from any other host, which is exactly what stolen helpdesk credentials would look like. Allow-listing the account everywhere would hide that.
Test yourself
What is the most common enabler of lateral movement on Windows networks?
- Kernel exploits
- Credential reuse, such as one local administrator password on many machines
- Open Wi-Fi
- Outdated browsers
Which control gives every machine a unique, rotated local administrator password?
- BitLocker
- Windows LAPS
- SMB signing
- UAC
Which log pattern most suggests lateral movement?
- One account logging on locally once
- One account making network logons (4624 type 3) to many hosts in minutes, especially a local account
- A printer job
- A DNS query
What does administrative tiering prevent?
- Phishing
- Higher-privilege credentials being exposed on lower-trust machines
- Password expiry
- Disk failures