Chapter 09

Backup and Recovery

Ransomware made backup infrastructure an attacker target. Understanding how Windows snapshot and recovery mechanisms work explains why attackers disable them first — and what a resilient backup architecture looks like.

Scenario

Ransomware lands on a workstation through a phishing attachment. Rather than immediately encrypting files, it does something else first: it runs vssadmin delete shadows /all /quiet and wbadmin delete catalog -quiet. Only then does the encryption begin.

Why? Because the attackers know that VSS shadow copies and Windows Backup catalogs are the first place responders look for recovery options. Delete those, and the victim faces a choice between paying the ransom and restoring from an external backup (if one exists). The shadow copy deletion takes seconds and eliminates the cheapest recovery path. This chapter explains how VSS and Windows recovery mechanisms work, why they're targeted, and what backup architectures actually survive ransomware.

Volume Shadow Copy Service: How It Works

VSS (Volume Shadow Copy Service) is a Windows subsystem that creates point-in-time snapshots of volumes — called shadow copies — while the system is running. Applications and the OS can use these snapshots for backup without stopping writes to the live volume.

  VSS Architecture: How Shadow Copies Work
  ══════════════════════════════════════════════════════════════════════

  Before VSS snapshot:
  Live Volume (C:)
  ┌────────────────────────────────────────────────────┐
  │  File A  │  File B  │  File C  │  Free space       │
  └────────────────────────────────────────────────────┘

  When VSS snapshot is triggered:
  - VSS asks all VSS writers (SQL, Exchange, filesystem, etc.)
    to quiesce I/O and flush buffers to a consistent state
  - VSS takes a COW (Copy-on-Write) snapshot of the volume
    metadata — NOT a full copy of all data (that would be huge)
  - I/O resumes

  After snapshot: Live volume + Shadow copy (COW)
  ┌────────────────────────────────────────────────────┐
  │  Live Volume: writes continue normally              │
  └─────────────────────────┬──────────────────────────┘
                             │ When a block on the live volume
                             │ is MODIFIED, the original block
                             │ is copied to shadow storage first
                             │ (Copy-on-Write)
                             ▼
  ┌────────────────────────────────────────────────────┐
  │  Shadow Storage (typically on same volume):         │
  │  Only stores CHANGED blocks since snapshot          │
  │  Unchanged blocks read directly from live volume   │
  └────────────────────────────────────────────────────┘

  Reading from the shadow copy:
  - Unchanged blocks: read from live volume
  - Changed blocks: read from shadow storage (original version)
  = Point-in-time consistent view of the volume at snapshot time

  Where shadow copies live:
  - Default: on the same volume they're shadowing
  - C:\System Volume Information\ (hidden, protected)
  - vssadmin list shadows   (see existing shadows)
  - Max storage: configurable (default ~10% of volume)
    

Ransomware and VSS: The Attack Pattern

Shadow copies represent the attacker's primary obstacle. Before encrypting files, ransomware deletes all shadow copies to eliminate the easiest recovery path.

Command What It Destroys Required Privilege
vssadmin delete shadows /all /quiet All VSS shadow copies on all volumes. The /quiet flag suppresses confirmation prompts. After this, Previous Versions in Windows Explorer shows nothing. Local administrator
wmic shadowcopy delete Equivalent to vssadmin delete — all shadow copies via WMI. Used interchangeably with vssadmin in ransomware. Local administrator
wbadmin delete catalog -quiet Windows Server Backup catalog — removes the record of all backup jobs, preventing restore using built-in tools even if backup files exist. Local administrator
bcdedit /set {default} recoveryenabled no Disables Windows Recovery Environment. Prevents booting to recovery mode. Removes the "Startup Repair" option on next failed boot. Local administrator
bcdedit /set {default} bootstatuspolicy ignoreallfailures Prevents Windows from detecting boot failures and entering recovery mode. System boots to (encrypted) Windows instead of recovery. Local administrator
Why "ransomware deletes shadow copies" became a detection rule

The commands above — vssadmin delete shadows, wmic shadowcopy delete, bcdedit /set recoveryenabled no — are extremely rare in legitimate administration. Legitimate backup software doesn't need to delete all shadow copies. Legitimate system administration doesn't need to disable recovery mode. These commands appear in the pre-encryption phase of almost every ransomware family, because every ransomware operator figured out that shadow copies are the victim's cheapest recovery path. As a result, detection rules that alert on these specific command strings (in Event ID 4688 or Sysmon Event 1) catch the ransomware in its pre-encryption phase — before files are encrypted. This is one of the few cases where a signature-based detection rule catches attackers reliably, because there's no legitimate reason to run these commands.

What a Ransomware-Resilient Backup Architecture Looks Like

Shadow copies and Windows Backup are both local — an attacker with admin rights can delete them. Resilient backup requires separation: the backup target must be inaccessible to the compromised system at the time of attack.

  Backup Architecture: Resilience Tiers
  ══════════════════════════════════════════════════════════════════════

  TIER 1 (weakest): Local shadow copies
  ─────────────────────────────────────
  ✓ Fast, automatic, free, useful for accidental deletions
  ✗ On the same volume as the live data
  ✗ Admin-deletable with one command
  ✗ Lost entirely if the drive fails
  Verdict: NOT ransomware-resilient. Use for convenience, not recovery.

  TIER 2: Network backup share
  ─────────────────────────────────────
  ✓ Backups on a different machine
  ✗ If the backup share is mounted on the victim, ransomware
    encrypts the share too (network shares appear as drive letters)
  ✗ If credentials for the backup share are cached on the victim,
    attacker with those credentials can delete backups
  Verdict: Resilient ONLY if: read-only access for the backup agent
           (agent pushes, can't delete); or backup server pulls data
           from endpoints (endpoints don't have write access to backup store)

  TIER 3: Immutable / append-only backup
  ─────────────────────────────────────────
  ✓ Backup storage configured as append-only for a retention period
    (AWS S3 Object Lock, Azure Blob immutability, on-prem WORM storage)
  ✓ Once written, backup data CANNOT be deleted by anyone until
    the retention period expires — including admins
  ✓ Ransomware can't reach it; insider threat can't reach it
  ✗ More expensive; requires careful policy setup
  Verdict: The gold standard for ransomware resilience

  TIER 4: Offline / air-gapped backup
  ─────────────────────────────────────────
  ✓ Physical media (tape, hard drive) that is disconnected from
    the network after backup completes
  ✓ Zero attack surface — can't be reached over the network
  ✗ Slow, manual, high operational overhead
  ✗ Recovery from tape can take days for large datasets
  Verdict: Required for critical systems; not practical as primary backup

  The 3-2-1 Rule:
  3 copies of data
  2 different storage types (e.g., local + cloud)
  1 copy offsite or offline
    

Windows Recovery Environment (WinRE)

WinRE is a minimal Windows environment that boots before the main OS. It provides recovery tools: Startup Repair, System Restore, Command Prompt, and image-based recovery. Understanding WinRE matters for both incident response and attack persistence.

WinRE Component Security Relevance
System Restore Rolls back system files and registry to a restore point. Doesn't restore user data — useful for undoing malware-modified system files and registry keys. Ransomware disables this by deleting shadow copies.
Startup Repair Fixes boot sector and bootloader corruption. Relevant for bootkits — a bootkit corrupts the bootloader; Startup Repair rewrites it from clean copies. BCDEdit attacks disable this.
Command Prompt in WinRE Runs with SYSTEM context in a minimal environment. Legitimate use: fixing corrupted system. Attacker use: bypass locked-screen OS, reset passwords (the "sethc.exe accessibility bypass" required booting to WinRE or external media).
Secure Boot and WinRE On Secure Boot systems, WinRE itself is signed and verified. An attacker can't replace WinRE with a malicious environment because the bootloader checks the signature.
Wild: The attacker who used backup infrastructure as C2 storage

VSS shadow copies store previous versions of files. An attacker with persistent access discovered that by creating a file, letting VSS snapshot it, then deleting the live copy, the file persists only in the shadow copy — invisible to normal file system browsing (you'd need to use Previous Versions or vssadmin). They used this as a staging area: dropping tool payloads into VSS that couldn't be found by automated scanning tools that only walk the live file system. This works because most AV and EDR products scan the live file system, not shadow copies. The "hiding in shadow copies" technique is documented in threat intelligence reports. Detection: scheduled scans of accessible shadow copy paths, Sysmon Event 15 (ADS creation, which VSS manipulation can resemble).

BitLocker Recovery Keys: A Common Attack Target

When BitLocker is enabled on a volume, Windows generates a 48-digit recovery key. This key unlocks the drive if the TPM fails to unseal, if the boot chain changes, or if the user forgets their PIN. Organizations that manage BitLocker typically store recovery keys in Active Directory or Azure AD. These keys are a high-value target.

  BitLocker Recovery Key Storage — Attacker Interest
  ══════════════════════════════════════════════════════════════════════

  Where recovery keys are stored:
  ─────────────────────────────────────────────────────────────────
  On-premises AD:
  - Computer object in AD has a msTPM-OwnerInformation attribute
    and linked BitLocker recovery information
  - Any user with read access to the computer object (or domain
    admin) can retrieve the recovery key via AD Users and Computers
    or PowerShell (Get-ADObject -Filter ... | Select-Object *)

  Azure AD (now Entra ID):
  - Recovery keys stored in Azure AD Device object
  - Accessible to Global Admin, Intune Admin roles
  - Users can view their own device's recovery key at
    account.microsoft.com/devices/recoverykey

  Attacker interest:
  ─────────────────────────────────────────────────────────────────
  An attacker with domain admin can enumerate ALL BitLocker recovery
  keys for ALL domain-joined machines from AD in seconds.
  With a recovery key, an attacker can:
  - Boot a BitLocker-encrypted machine from external media
  - Unlock the drive using the recovery key
  - Access all data as if BitLocker were not present
  - Bypass the TPM-based boot chain enforcement entirely

  This means: domain compromise = BitLocker bypass for all machines
  in the domain, if keys are stored in AD without additional protection.

  Mitigation:
  - Restrict AD computer object read permissions
  - LAPS-equivalent protection for BitLocker keys (stored with
    access logging, restricted to break-glass accounts)
  - Microsoft MBAM (deprecated but was the gold standard for
    enterprise BitLocker key management with role-based access)
    

Q & A

1. If ransomware deletes VSS shadow copies, can they be recovered?

Generally no — shadow copy deletion via vssadmin or WMI is immediate and permanent. The shadow copy storage on disk is freed and becomes available for reuse. There is no recycle bin for shadow copies, and standard data recovery tools that scan for deleted files don't reconstruct VSS shadow copy structures. Some disk forensics workflows can attempt to recover VSS snapshot data from raw disk sectors if the sectors haven't been overwritten yet, but this is a specialized, time-sensitive forensics procedure, not a reliable recovery path. The practical answer for ransomware recovery is: if shadow copies were deleted, the recovery path is your external backup (tiered backup system). This is why the ransomware playbook always deletes shadow copies first — it closes the fast, cheap recovery path and forces the victim toward either paying or restoring from an external backup (which the attacker hopes either doesn't exist, is also encrypted because it was a network share, or is outdated enough to be painful). Shadow copy deletion detection + alert triggers are more valuable than trying to recover deleted shadows.

2. What is a VSS writer and why do ransomware actors need VSS writers to fail?

VSS writers are COM components registered by applications to participate in the VSS snapshot process. When VSS creates a shadow copy, it coordinates with all registered writers: it asks them to freeze their I/O (quiesce), VSS takes the snapshot, then writers resume. This ensures the snapshot is application-consistent — database files (SQL, Exchange) are in a clean, committed state when snapshotted, not mid-write. Writers include the SQL Server VSS writer, Exchange writer, IIS writer, and the system writer for OS files. Some ransomware families attempt to kill VSS writers before encrypting, not to delete shadow copies, but to corrupt any in-progress shadow copy process, and to prevent any application-consistent backup from being created during the attack. A failed writer causes VSS to generate a VSS_ERROR_WRITERERROR event and may abort snapshot creation. This prevents a backup solution from successfully snapshotting the system during the attack window. Detection: VSS writer error events in the Application log, combined with unusual process activity, are worth correlating.

3. Why isn't "back up to a network share" sufficient for ransomware resilience?

Because ransomware typically encrypts all accessible storage, not just local drives. If the backup share is mounted as a drive letter (Z:\backup), or accessible via UNC path (\\backupserver\share) from the infected system, ransomware will enumerate and encrypt it like any other volume. The ransomware process runs in the context of the logged-in user — if that user has write access to the backup share, the ransomware has write access. There are two patterns that make network backups resilient: (1) Pull model — the backup server connects to endpoints and pulls data; the endpoint never authenticates to the backup server, so a compromised endpoint has no credentials for the backup store and can't reach or delete it. (2) Write-once with retention — the backup storage is configured so the endpoint can write new backup jobs but cannot overwrite or delete existing backups within the retention window. S3 Object Lock and similar immutable storage policies implement this. The common mistake: an organization "backs up to a NAS" but the NAS share is mapped as a drive letter on the fileserver. Ransomware hits the fileserver, finds Z:\, and encrypts the NAS backup too.