How to Recover Files After a Virus or Malware Attack: Ransomware, Trojan & Virus Data Recovery
Your files are gone. Or encrypted. Or hidden. Or all your folders now contain shortcuts instead of real files. Malware attacks are uniquely devastating because the damage is intentional — someone designed this software to harm your data. But here's the critical thing to understand: different types of malware damage files in different ways, and your recovery approach must match the specific attack type. Using the wrong approach wastes time and can make recovery harder. Compare all 8 data loss scenarios.
Table of Contents
- Types of Malware & How They Damage Files
- Immediate Response — What to Do First
- Method 1: Unhide Files with ATTRIB Command (Trojan/USB Virus)
- Method 2: Restore from Shadow Copies (Ransomware)
- Method 3: Free Decryptors — NoMoreRansom.org
- Method 4: Restore from Antivirus Quarantine
- Method 5: XRecovery Recovery After Malware
- How to Prevent Malware Data Loss
- Frequently Asked Questions
1. Types of Malware & How They Damage Files
| Malware Type | What It Does to Files | Best Recovery Method | Recovery Chance |
|---|---|---|---|
| Ransomware | Encrypts files in place, demands payment for decryption key. Files are still on disk but unreadable. | Shadow copies → NoMoreRansom → recovery software (Method 2) | Low-Medium |
| Trojan / USB Shortcut Virus | Hides files, marks them as system/hidden, creates fake shortcuts. Files are still there — just invisible. | ATTRIB unhide (Method 1) | Very High |
| Worm | Deletes or overwrites files, spreads via networks and USB. Actual file deletion. | XRecovery after worm removal (Method 5) | Moderate |
| Overwrite Virus | Overwrites file content with malicious code. Original data destroyed in overwritten sectors. | XRecovery — partial recovery possible (Method 5) | Low-Moderate |
| Spyware / Adware | Rarely damages files directly. Files may be in antivirus quarantine (false positive). | Check quarantine (Method 4) | High |
| Bootkit / Rootkit | Damages boot sector or partition table. Drive may appear empty or RAW. | XRecovery Deep Scan (Method 5) | Moderate-High |
2. Immediate Response After a Malware Attack
Follow these steps in exact order.
- Disconnect from the network immediately. Unplug Ethernet. Turn off Wi-Fi. This prevents the malware from spreading to other devices, communicating with command servers, or exfiltrating data.
- Do NOT turn off the computer if you suspect ransomware. Some ransomware variants delete shadow copies on reboot. Keep the system running until you've checked for shadow copies and documented the ransom note.
- Photograph the ransom note or error messages. This helps identify the malware variant, which is essential for finding the right decryptor on NoMoreRansom.org.
- Remove the malware. Run Windows Defender Offline scan or a bootable antivirus (Malwarebytes, Bitdefender Rescue Disk). Only proceed to file recovery after the system is clean.
- Do NOT format the drive or reinstall the OS before attempting recovery. Formatting destroys recoverable data.
1 Unhide Files — ATTRIB Command ~1 Min
For: Trojan / USB shortcut virus. This is the most common consumer malware scenario — and the easiest to fix. The virus doesn't delete files; it marks them as hidden and system files, then creates fake shortcuts that look like your folders. Your actual files are 100% intact.
- Open Command Prompt as Administrator.
- Navigate to the affected drive:
X:(replace X with your USB or drive letter). - Run:
attrib -h -s -r /s /d *.*— This removes Hidden (-h), System (-s), and Read-only (-r) attributes from all files (/s = subdirectories, /d = directories too). - Your files reappear immediately. Delete the fake shortcuts.
- Run a full antivirus scan to remove the virus that caused this.
2 Restore from Shadow Copies ~3 Min
For: Ransomware. Windows automatically creates shadow copies (restore points) that may contain previous versions of your files from before the encryption. Ransomware often tries to delete these — but doesn't always succeed.
- Right-click any encrypted folder → "Properties" → "Previous Versions" tab.
- If versions are listed, select one from before the attack → click "Open" to browse.
- Copy your clean, unencrypted files to a different drive.
- You can also use Shadow Explorer (free tool) for a more comprehensive shadow copy browser.
3 Free Ransomware Decryptors — NoMoreRansom.org Free
For: Ransomware with known decryption tools. NoMoreRansom.org is a free initiative by Europol, the Dutch National Police, and cybersecurity companies (Kaspersky, McAfee). They maintain a database of free decryptors for hundreds of ransomware variants.
- Go to NoMoreRansom.org → "Crypto Sheriff."
- Upload a sample encrypted file and any ransom note. The tool identifies your ransomware variant.
- If a decryptor exists, download and run it on a copy of your encrypted files (never the originals).
- Major decryptor providers also include: Emsisoft Decryptor Tools, Kaspersky RakhniDecryptor, Avast Free Ransomware Decryption Tools.
4 Restore from Antivirus Quarantine ~1 Min
Antivirus software sometimes quarantines legitimate files as false positives — especially during aggressive scans after a malware attack.
- Windows Defender: Windows Security → Virus & threat protection → Protection history → find quarantined file → Restore
- Malwarebytes: Detection History → Quarantined items → select file → Restore
- Restored files return to their original location.
5 XRecovery Recovery After Malware Most Reliable
When files were actually deleted or corrupted — not just hidden — XRecovery provides the most thorough recovery. It scans the drive at the sector level to find files that were deleted during or after the attack, including earlier unencrypted versions that may still exist in free space. Read-only scanning ensures safety.
Step-by-Step:
- Remove malware first. Boot from a clean USB environment if needed.
- Download XRecovery to a different drive.
- Select the infected drive → Deep Scan. This searches for file signatures (JPEG, DOCX, PDF, etc.) regardless of what the malware did to the file system.
- Preview files to verify they're unencrypted and intact. XRecovery may find pre-encryption versions of files that ransomware encrypted.
- Recover to a different drive.
How to Prevent Malware Data Loss
- Use the 3-2-1 backup rule. At least 1 copy offline (disconnected from your computer) — ransomware cannot encrypt offline backups. Maximize your recovery readiness.
- Keep Windows and all software updated. Most ransomware exploits known vulnerabilities that already have patches.
- Use reputable antivirus with real-time protection. Windows Defender is adequate for most users. Enable ransomware protection (Controlled Folder Access).
- Never open email attachments or links from unknown senders. Phishing is the #1 ransomware delivery method.
- Disable Remote Desktop Protocol (RDP) if not needed. RDP is the #2 ransomware entry point.
- Keep XRecovery installed on a separate drive for immediate recovery access. Download XRecovery.
Virus Attacked Your Files? Recover Them Now.
XRecovery finds files that malware tried to destroy. Deep Scan — free preview. Read-only safe.
Download XRecovery FreeFrequently Asked Questions
Can I recover files after ransomware without paying?
Yes. Try shadow copies, NoMoreRansom.org free decryptors, or XRecovery to find unencrypted file versions. Never pay. XRecovery free scan.
My files are hidden — how do I unhide them?
Open CMD as Admin → attrib -h -s -r /s /d X:\*.*. This is a Trojan/USB virus — your files are intact, just hidden.
Should I remove malware before or after recovery?
Before. Never run recovery software on an actively infected system. Boot from a clean USB environment if needed.
Where do I find free ransomware decryptors?
NoMoreRansom.org (Crypto Sheriff tool). Also: Emsisoft Decryptor Tools, Kaspersky RakhniDecryptor, Avast Free Decryption Tools.
Can antivirus software recover my encrypted files?
Antivirus removes the infection but rarely decrypts files. It stops further encryption. Use decryptors or XRecovery to find unencrypted versions.
Malware Destroyed Your Files? Don't Give Up.
XRecovery scans deep to find what malware tried to hide. Free preview.
Download XRecovery Free