Registry & Filesystem Monitoring

25 minIn Progress

Registry & Filesystem Monitoring

While Procmon captures individual registry and file operations in real-time, dedicated snapshot comparison tools reveal the cumulative impact of malware execution. Regshot, Autoruns, and filesystem diffing answer the question: "What changed on this system between before and after the malware ran?"


1. Regshot: Registry & Filesystem Snapshots

Regshot is a lightweight open-source tool that takes before/after snapshots of the registry and filesystem, then produces a diff report showing everything that changed.

Regshot Workflow

Step 1: Before executing malware
  → Open Regshot
  → Select "Scan dir1" and enter: C:\
  → Click "1st shot" → "Shot"
  → Wait for scan to complete (30-60 seconds)

Step 2: Execute the malware
  → Run the sample
  → Wait 3-5 minutes for behavior

Step 3: After execution
  → Click "2nd shot" → "Shot"
  → Wait for scan to complete

Step 4: Compare
  → Click "Compare"
  → Output format: HTML document (recommended) or plain text
  → Save the comparison report

Reading the Regshot Report

A Regshot comparison report listing the registry keys and values added or modified between two snapshots
A Regshot comparison report listing the registry keys and values added or modified between two snapshots

The HTML report is organized into sections:

----------------------------------
Keys added: 3
----------------------------------
HKLM\SYSTEM\CurrentControlSet\Services\MalwareService
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKU\S-1-5-21-...\Software\MalBot

----------------------------------
Values added: 5
----------------------------------
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\MalBot: "C:\Users\user\AppData\Local\malbot.exe"
HKLM\SYSTEM\CurrentControlSet\Services\MalwareService\ImagePath: "C:\Windows\System32\malservice.dll"
HKLM\SYSTEM\CurrentControlSet\Services\MalwareService\Start: 0x00000002
HKLM\SYSTEM\CurrentControlSet\Services\MalwareService\Type: 0x00000010

----------------------------------
Values modified: 2
----------------------------------
HKLM\SOFTWARE\...\Explorer\ShellIconOverlayIdentifiers: <changed>

----------------------------------
Files added: 4
----------------------------------
C:\Users\user\AppData\Local\malbot.exe
C:\Users\user\AppData\Local\Temp\brbconfig.tmp
C:\Windows\System32\malservice.dll
C:\Users\user\AppData\Local\Temp\dropper.bat

2. Critical Registry Persistence Locations

Autoruns showing logon persistence entries, with an unsigned entry standing out against signed Microsoft ones
Autoruns showing logon persistence entries, with an unsigned entry standing out against signed Microsoft ones

These are the registry keys that malware most commonly targets for persistence. Memorize them:

User-Level Persistence (HKCU)

Registry PathTechniqueATT&CK
HKCU\Software\Microsoft\Windows\CurrentVersion\RunRun on user logonT1547.001
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnceRun once, then deleteT1547.001
HKCU\Environment\UserInitMprLogonScriptLogon scriptT1037.001
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell FoldersStartup folder redirectT1547.001
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell FoldersStartup folder redirectT1547.001

System-Level Persistence (HKLM)

Registry PathTechniqueATT&CK
HKLM\Software\Microsoft\Windows\CurrentVersion\RunRun on any user logonT1547.001
HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceRun once at next bootT1547.001
HKLM\SYSTEM\CurrentControlSet\ServicesWindows serviceT1543.003
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\ShellReplace Explorer shellT1547.004
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserinitLogon initializationT1547.004
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution OptionsDebugger hijack (IFEO)T1546.012
HKLM\SOFTWARE\Classes\CLSID\{...}\InprocServer32COM object hijackingT1546.015

Scheduled Tasks

LocationType
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\TasksRegistry-based task storage
C:\Windows\System32\TasksXML task definition files

Key insight: Malware that writes to HKCU keys only persists for the current user. HKLM keys affect all users but require administrator privileges.


3. Filesystem Change Analysis

Common Malware File Drop Locations

LocationWhy Malware Uses ItSuspicion Level
%TEMP% (C:\Users\user\AppData\Local\Temp)Writable without admin, commonly overlookedMedium
%APPDATA% (C:\Users\user\AppData\Roaming)Persists across sessions, user-writableMedium-High
%LOCALAPPDATA% (C:\Users\user\AppData\Local)Less monitored than RoamingMedium-High
%PROGRAMDATA% (C:\ProgramData)Shared location, writable by adminsHigh
%WINDIR%\System32 (C:\Windows\System32)Blends with legitimate system filesVery High
%WINDIR%\Temp (C:\Windows\Temp)System temp, writable by servicesHigh
Startup folderAuto-runs on logonVery High

Filesystem Diff Without Regshot

If Regshot is unavailable, use command-line diffing:

# Before execution: capture file listing
Get-ChildItem -Path C:\ -Recurse -File -ErrorAction SilentlyContinue |
  Select-Object FullName, Length, LastWriteTime |
  Export-Csv -Path C:\baseline\files_before.csv

# After execution: capture again
Get-ChildItem -Path C:\ -Recurse -File -ErrorAction SilentlyContinue |
  Select-Object FullName, Length, LastWriteTime |
  Export-Csv -Path C:\baseline\files_after.csv

# Compare
Compare-Object (Import-Csv files_before.csv) (Import-Csv files_after.csv) -Property FullName |
  Where-Object SideIndicator -eq "=>" |
  Select-Object FullName

4. Autoruns: Persistence Point Analysis

Autoruns (Sysinternals) shows every program configured to auto-start on the system. Running it before and after malware execution reveals new persistence.

Using Autoruns for Malware Analysis

Before execution:
  1. Run Autoruns as Administrator
  2. Options → Scan Options → Check "Verify code signatures"
  3. File → Save → baseline_autoruns.arn

After execution:
  1. Run Autoruns again
  2. File → Compare → Select baseline_autoruns.arn
  3. New entries are highlighted in GREEN

Green entries = new persistence installed by the malware

Autoruns Tab Reference

TabWhat It ShowsCommon Malware Targets
LogonRun/RunOnce keys, Startup folderMost common persistence
ExplorerShell extensions, browser helpersCOM hijacking
Scheduled TasksTask Scheduler entriesRecurring execution
ServicesWindows servicesService-based persistence
DriversKernel driversRootkits
Image HijacksIFEO debugger entriesExecution hijacking
Boot ExecuteBoot-time programsBootkit persistence
WMIWMI event subscriptionsFileless persistence

Autorunsc (Command-Line Version)

REM Before: save baseline
autorunsc.exe -a * -m -s -h -c > before_autoruns.csv

REM After: save post-execution
autorunsc.exe -a * -m -s -h -c > after_autoruns.csv

REM Flags:
REM   -a *  All autostart categories
REM   -m    Hide Microsoft entries (reduce noise)
REM   -s    Verify digital signatures
REM   -h    Show file hashes
REM   -c    CSV output

5. Snapshot Comparison Workflow

Combine all snapshot tools for comprehensive change detection:

Before Execution:
  1. Regshot 1st shot (registry + filesystem)
  2. Autoruns baseline save
  3. Note running processes (Process Explorer screenshot)

Execute Malware:
  4. Run sample, wait 3-5 minutes

After Execution:
  5. Regshot 2nd shot → Compare → Save HTML report
  6. Autoruns comparison → Note new GREEN entries
  7. Note new processes in Process Explorer

Analysis:
  8. Cross-reference Regshot new files with Regshot new registry values
  9. Verify Autoruns findings match Regshot registry changes
  10. Hash all new files (SHA-256) for IOC extraction
  11. Submit new file hashes to VirusTotal

Example Combined Analysis

Regshot shows:
  File added: C:\Users\user\AppData\Local\svchost32.exe
  Registry added: HKCU\...\Run\WindowsUpdate = "C:\Users\...\svchost32.exe"

Autoruns confirms:
  New Logon entry: "WindowsUpdate" → C:\Users\user\AppData\Local\svchost32.exe
  Publisher: (Not verified)  Signature: (Not signed)

Analysis:
  → Malware dropped a copy named "svchost32.exe" (mimicking svchost.exe)
  → Installed Run key persistence under the name "WindowsUpdate"
  → File is unsigned (legitimate svchost.exe is Microsoft-signed)
  → Technique: T1547.001 + T1036.005 (Masquerading: Match Legitimate Name)

Common Pitfall: Regshot reports changes from all system activity during the analysis window, not just the malware. Windows background services, updates, and telemetry create noise. Cross-reference Regshot findings with Procmon traces filtered to the malware process to confirm which changes the malware actually caused.

MITRE ATT&CK: Registry and filesystem monitoring directly reveals T1547 - Boot or Logon Autostart Execution, T1543.003 - Create or Modify System Process: Windows Service, T1546.015 - Event Triggered Execution: Component Object Model Hijacking, T1053 - Scheduled Task/Job, and T1036 - Masquerading.

Try it in the shell
Practise this lesson's tooling on its sample in an emulated analyst shell. Output is pre-recorded — nothing executes.

Suggested triage steps

  1. 1

    Mark the persistence event

    The Run-key value is one line on the timeline, and it comes straight from static strings.

  2. 2

    Mark the injection event

    The injection APIs place roughly when that step happens relative to persistence and network activity.

  3. 3

    Order the techniques

    Injection, persistence and C2 each become a timeline entry, roughly in this order.

analyst@lab:~emulated · nothing executes

MAA analyst shell — emulated. Nothing executes.

Type 'help', or click a step on the left.

$
Registry & Filesystem Monitoring | Malware Analysis Academy