| name | eradicating-malware-from-infected-systems |
| description | Systematically map and remove malware, backdoors, and attacker persistence mechanisms (registry Run keys, scheduled tasks, WMI subscriptions, services, cron/init.d) from infected Windows and Linux systems using Autoruns, EDR/AV, and YARA, restoring a clean state while preventing re-infection. Use after containment and forensic analysis have identified all compromised systems and persistence mechanisms and you are ready to eradicate and recover. |
| domain | cybersecurity |
| subdomain | incident-response |
| tags | ["incident-response","eradication","malware-removal","persistence","dfir"] |
| mitre_attack | ["T1486","T1490","T1070","T1078","T1547"] |
| version | 1.0 |
| author | mahipal |
| license | Apache-2.0 |
| nist_csf | ["RS.MA-01","RS.MA-02","RS.AN-03","RC.RP-01"] |
Eradicating Malware from Infected Systems
When to Use
- Malware infection confirmed and containment is in place
- Forensic investigation has identified all persistence mechanisms
- All compromised systems have been identified and scoped
- Ready to remove attacker artifacts and restore clean state
- Post-containment phase requires systematic cleanup
Prerequisites
- Completed forensic analysis identifying all malware artifacts
- List of all compromised systems and accounts
- EDR/AV with updated signatures deployed
- YARA rules for the specific malware family
- Clean system images or verified backups for restoration
- Network isolation still in effect during eradication
Workflow
Step 1: Map All Persistence Mechanisms
autorunsc.exe -accepteula -a * -c -h -s -v > autoruns_report.csv
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /s
reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /s
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /s
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run" /s
schtasks /query /fo CSV /v > schtasks_all.csv
Get-WMIObject -Namespace root\Subscription -Class __EventFilter
Get-WMIObject -Namespace root\Subscription -Class CommandLineEventConsumer
Get-WMIObject -Namespace root\Subscription -Class __FilterToConsumerBinding
Get-Service | Where-Object {$_.Status -eq 'Running'} | Select-Object Name, DisplayName, BinaryPathName
cat /etc/crontab
ls -la /etc/cron.*/
ls -la /etc/init.d/
systemctl list-unit-files --type=service | grep enabled
cat /etc/rc.local
ls -la ~/.bashrc ~/.profile ~/.bash_profile
Step 2: Identify All Malware Artifacts