.MDF file encrypted by ransomware

1️⃣ What is an .MDF file?

An .MDF file (Microsoft SQL Server Master Data File) is the primary file of a SQL Server database. It contains:
  • User data (tables, views, stored procedures)
  • The structure and indexing
  • Essential information required for database reconstruction
The .MDF file is often accompanied by an .LDF file (transaction log) which records all modifications. The loss or corruption of an .MDF file can lead to complete inaccessibility of the SQL database.

2️⃣ Symptoms of an .MDF file encrypted by ransomware

When ransomware targets .MDF files, several signs may appear:
  1. File encryption
    • Modified extension: .MDF.locked, .MDF.anubis, or another extension depending on the ransomware
    • Unable to open the file in SQL Server
  2. Ransom note
    • Text or HTML file left by the ransomware in the folder with payment instructions
    • The file name is often identical for all encrypted files
  3. Database inaccessible
    • SQL Server returns errors: “Cannot open database …. The physical file may be missing or corrupt”
    • Transactions can no longer be recorded
  4. Secondary symptoms
    • Unstable SQL Server or extreme slowness
    • Transaction logs (.LDF) not synchronized
    • Local backups sometimes deleted or encrypted

3️⃣ Impact on data recovery

The recovery of an encrypted .MDF file depends on several factors:
  1. Type of ransomware
    • Typical ransomware encrypts the file without deleting it
    • Destructive ransomware may overwrite or delete the content → recovery becomes nearly impossible
  2. Availability of backup files
    • Unencrypted offline backup: fast recovery
    • Network backup: risk that the ransomware also encrypted the copies
  3. File condition
    • Fully encrypted file: reconstruction from backup required
    • Partially corrupted file: specialized tools may attempt to extract intact data
  4. Complexity of the SQL format
    • MDF contains complex internal structures (pages, indexes, tables)
    • Recovery tools must rebuild the pages so the database becomes functional again

4️⃣Best practices after .MDF files are encrypted

  1. Immediate isolation
    • Disconnect the SQL Server from the network
  2. Do not attempt direct restoration
    • Avoid restarting SQL Server or restoring onto an encrypted file → risk of overwriting intact pages
  3. Identify the ransomware variant
    • Helps determine whether a decryption tool exists
  4. Contact a post-ransomware data recovery expert
For corrupted MDF files: page-by-page reconstruction

Conclusion

An .MDF file encrypted by ransomware represents a critical emergency:
  • Symptoms: inaccessible database, modified extensions, SQL Server errors
  • Impact: depends on the nature of the ransomware
Maximum risk: permanent data loss if the file is destroyed or if no reliable backup exists