UnixDroid

Lesson 5 of 8 · 9 min

Windows artifacts that give attackers away

Registry, Prefetch, LNK files and Event Logs: where Windows quietly records what an attacker did.

Windows quietly records almost everything a user, or an attacker, does. Even when someone deletes their tools, these artifacts often remain, and they're where most Windows investigations are won.

The big four

ArtifactLocationWhat it proves
RegistryC:\Windows\System32\config\ (SAM, SYSTEM, SOFTWARE, SECURITY) and each user's NTUSER.DATSettings, installed software, USB devices, autostart entries
PrefetchC:\Windows\Prefetch\*.pfWhich programs ran, how often and when
LNK files%APPDATA%\Microsoft\Windows\Recent\Which files and folders a user opened, even on USB drives
Event LogsC:\Windows\System32\winevt\Logs\*.evtxLogons, new services, cleared logs and much more

Registry: where persistence hides

Attackers want their malware to survive a reboot. The classic way is a Run key:

HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run

Anything listed there starts automatically. Other keys worth checking:

  • USB history: HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR lists USB storage devices that have been connected.
  • Typed paths: Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths in NTUSER.DAT shows folders typed into Explorer.
  • Services: HKLM\SYSTEM\CurrentControlSet\Services holds every installed service, including malicious ones.

Prefetch: proof of execution

Windows creates a .pf file when a program runs, so it loads faster next time. For an investigator, it's evidence that a program was executed, for example MIMIKATZ.EXE-1A2B3C4D.pf, even if the .exe itself was deleted. On Windows 8 and later, each file stores up to the last 8 run times.

Tip: Prefetch is usually turned off on Windows Server. An empty Prefetch folder doesn't mean nothing ran.

Event logs: the IDs to know by heart

Event IDLogMeaning
4624SecuritySuccessful logon
4625SecurityFailed logon
4672SecurityLogon with admin privileges
4688SecurityNew process created (if auditing is on)
4720SecurityUser account created
7045SystemNew service installed
1102SecuritySecurity log was cleared
104SystemSystem log was cleared

The logon type inside a 4624 event tells you how someone logged in: 2 = at the keyboard, 3 = over the network (for example a file share), 10 = Remote Desktop.

Tools

  • Eric Zimmerman's tools (free): PECmd for Prefetch, LECmd for LNK files, EvtxECmd for event logs and Registry Explorer for hives.
  • RegRipper pulls key artifacts out of registry hives automatically.
  • Hayabusa and Chainsaw scan .evtx files for known attack patterns.
  • On Kali, the python-evtx package converts .evtx logs into readable XML.

Example: parse every Prefetch file from a mounted image into a CSV:

PECmd.exe -d "E:\Windows\Prefetch" --csv C:\cases\case01

One artifact is a clue. Three artifacts that agree, such as a Prefetch entry, an LNK file and a 4688 event in the same minute, is a finding.

Try it yourself
  1. On a Windows VM, open Event Viewer → Windows Logs → Security.
  2. Click Filter Current Log and enter 4624,4625 in the Event IDs box.
  3. Find your own most recent logon. Note the time, the account name and the Logon Type.
  4. Open C:\Windows\Prefetch as administrator and find the .pf file for a program you ran today, such as NOTEPAD.EXE.
  5. Write a two-line timeline: when you logged in and when you ran that program.
No Linux machine? Practise in the free online terminal

Quick check

Which Windows Event ID means the Security log was cleared?

Need a hint?

Four digits, starting with 11.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →