Execution
pagefile.sys and swapfile.sys
pagefile.sys and swapfile.sys cheat sheet: paged-out memory on disk, what can be recovered, ClearPageFileAtShutdown, compression caveats and carving tools.
- Location
- C:\pagefile.sys
- Proves
- Fragments of past memory: commands, URLs, credentials, file and process traces
- Timestamps
- No per-fragment timestamps; file $SI times (NTFS, UTC) change constantly; any dates come from the fragment content itself
- Retention
- Overwritten as the system pages; zeroed at shutdown only if ClearPageFileAtShutdown = 1; destroyed if paging is disabled or resized
- Access
- Hidden, system-protected and locked live: collect via raw NTFS (KAPE MemoryFiles) or from a disk image
- Evidence of
- ExecutionNetwork & remote access
- Type
- File / file system
- Windows
- XPVista / 78 / 8.11011
- KAPE target
- MemoryFiles
- Velociraptor
- Windows.Triage.Targets:MemoryFiles
Tools
Compare all toolsWhat it is
pagefile.sys is the Windows paging file: when physical memory runs short, the memory manager writes less-used pages of process and kernel memory to it. swapfile.sys, added in Windows 8, is used to swap out the whole working set of modern (Store/UWP) apps when they are suspended. Both are raw collections of 4 KB memory pages with no file-system structure or index. They survive a reboot (unless wiped at shutdown), which makes them a source of old memory content long after RAM has been cleared.
Location
| Windows version | File | Notes |
|---|---|---|
| XP and later | C:\pagefile.sys (and possibly other volumes) | Locations and sizes are listed in PagingFiles under SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management |
| 8 / 8.1 / 10 / 11 | C:\swapfile.sys | Modern / UWP app working sets |
Both files are hidden, system-protected and locked while Windows runs.
What it proves
- Any data that was once in memory may appear: command lines and script blocks, URLs and HTTP headers, chat fragments, e-mail addresses, file paths, registry fragments, pieces of executables and, sometimes, credentials or keys.
- Presence of an indicator (a C2 domain, a tool name, a PowerShell snippet) shows it was in memory at some point, which is useful when disk artifacts were deleted.
- It gives no reliable timeline: pages carry no timestamps and no link to the process that owned them.
Key fields
| Element | Meaning |
|---|---|
| 4 KB page | Unit of storage; content is whatever the page held when written out |
PE headers (MZ) | Fragments of executables and DLLs that were paged out |
Registry fragments (hbin) | Pieces of hives that were in memory |
| Compressed pages | On Windows 10 and later, pages evicted from the memory compression store stay compressed |
Timestamps
| Timestamp | Set when | Format | Pitfalls |
|---|---|---|---|
| File $SI times | File created (often at installation or resize) and modified continuously | NTFS, UTC | Say nothing about when a given fragment was written |
| Timestamps found inside fragments | Whatever the original data contained | Varies | Only as trustworthy as their context |
Retention and clearing
- Content is overwritten as the system pages, so older data survives only in slots that were not reused.
ClearPageFileAtShutdown= 1 under...\Session Manager\Memory Managementmakes Windows zero the paging file at shutdown (it slows shutdown and is rarely enabled). A pulled-plug or hard shutdown skips this.- Windows 10 memory compression means a string search misses data held in compressed pages; tools that understand the compression format (research by FireEye/Mandiant on the compressed store) recover more.
- Disabling the paging file or resizing it can destroy the content.
Collection
- KAPE target:
MemoryFiles(pagefile.sys, swapfile.sys, hiberfil.sys and minidumps; raw access for locked files) - Velociraptor (
Windows.Triage.Targets):MemoryFiles - Built-in: the files cannot be copied with normal tools while Windows runs; use a raw NTFS collector, or take them from a disk image. Record the configuration:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v PagingFiles
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v ClearPageFileAtShutdown
Parsing tools
- bulk_extractor (open source): carves URLs, e-mail addresses, domains, credit-card numbers, JSON and more from raw data, with histograms.
- strings (Sysinternals, GNU): quick ASCII and UTF-16 extraction; search for indicators.
- YARA: scan the file with rules for tools, webshells or C2 configurations.
- Carving tools (PhotoRec, scalpel): recover embedded files such as images or documents.
Investigation tips
- Search for known indicators from the case (IP addresses, domains, file names, encoded PowerShell prefixes like
JAB/SQBFAFgA) first; then review the context around each hit. - Pagefile hits for a tool or domain that left no disk artifact support an anti-forensics narrative, but report them as "present in memory at an unknown time".
- Combine with hiberfil.sys and crash dumps for more complete memory evidence, and with a live RAM capture when available (order of volatility).
- Keep extracted credentials under strict handling rules.
Related artifacts
- hiberfil.sys (hibernation file)hiberfil.sys cheat sheet: what hibernation and Fast Startup save, compression by Windows version, converting it to a raw memory image and what it can reveal.
- Crash dumps (MEMORY.DMP, minidumps)Crash dump cheat sheet: MEMORY.DMP and minidump locations, CrashControl dump types, user-mode dumps, LSASS dumping traces and tools to analyse them.
- Browser artifacts (Chrome, Edge, Firefox)Browser forensics cheat sheet: Chromium and Firefox profile files, History and places.sqlite tables, WebKit and PRTime timestamps, downloads, cookies, cache.
- PowerShell logs and historyPowerShell forensics: 4103/4104 script block logs, 400/403/800 engine events, PSReadLine ConsoleHost_history.txt, transcripts and logging policy keys.
- PE files (Windows executables)PE file triage cheat sheet: hashes, imphash and Rich header, compile timestamp caveats, sections and entropy, version info, signatures, PDB paths and tools.
Glossary terms
- File carvingRecovering files from raw disk data using content signatures such as headers and footers, without relying on file system metadata.
- Order of VolatilityThe principle of collecting the most volatile evidence first, before it is lost, as described in RFC 3227.
- Unallocated spaceClusters a file system currently marks as free; they often still contain data from deleted files until new data overwrites them.