How to recover from a malware attack that changes your DNS settings
A malware infection that modifies DNS settings can quietly redirect every website request made by an affected computer. Instead of reaching a legitimate search engine, bank, email provider, or software vendor, your browser may be sent to phishing pages, fake security alerts, or advertising networks. The connection can appear normal because the address bar may still display the expected domain.
DNS tampering is often associated with browser hijackers, trojans, spyware, and router infections. Common warning signs include unexpected search results, frequent redirects, certificate warnings, unfamiliar DNS server addresses, and websites that work correctly on one device but not another.
Treat the change as a security incident rather than simply a networking error. Restoring the original DNS values is important, but it does not remove the program, scheduled task, browser extension, or router setting that made the alteration.
Recognize the signs of DNS tampering
A compromised DNS configuration may redirect only selected domains or interfere with all web traffic. You might see counterfeit login pages, unusual pop-ups, slow page loading, or search results filled with sponsored links. Security software and operating system update sites may also become unreachable, preventing the computer from downloading protection tools.
Check whether the problem affects multiple devices connected to the same network. If only one Windows or Mac computer is affected, the infection is probably local. If phones, tablets, and other computers show similar redirects, inspect the home router as well.
Do not enter passwords, payment details, or recovery codes while suspicious redirects are occurring. Use a known-clean device to change important credentials, especially if the infected computer was used for banking, email, cryptocurrency, or business accounts.
Disconnect safely and preserve evidence
Disconnect the affected computer from Wi-Fi or unplug its Ethernet cable if you suspect active data theft. This limits communication with command-and-control servers and prevents the malware from downloading additional components. Avoid deleting random files before scanning, because logs and suspicious executables may help identify the infection.
If the computer contains valuable documents, copy only essential personal files to clean external storage. Do not copy programs, scripts, browser profiles, or unknown archives. Ransomware and other malware can hide in documents with malicious macros, so review macro virus cleanup guidance before opening Office files on another device.
Restarting into Safe Mode with Networking can make removal easier because fewer third-party services load. However, networking in Safe Mode may still expose the system to unsafe traffic. When possible, download scanning tools from a separate clean computer and transfer them using trusted removable media.
Restore DNS settings after scanning
First run a reputable, updated anti-malware scan while the computer is offline or connected only long enough to obtain trusted tools. A second-opinion scanner can identify browser hijackers, trojans, adware, and persistence mechanisms that a primary antivirus product missed. Remove detected threats and restart the system before changing network settings.
On Windows, open the active adapter properties and inspect Internet Protocol Version 4 and Version 6. Set DNS assignment to automatic unless your organization uses specific servers. On macOS, open Network settings, select the active connection, and remove unfamiliar DNS server entries. Record suspicious values before deleting them if you may need them for an incident report.
Also inspect the hosts file, proxy settings, browser extensions, and installed applications. DNS manipulation can occur alongside a forced proxy, and resetting only the resolver addresses may leave browsing traffic intercepted. If a proxy was also altered, follow these proxy reset steps before testing websites.
Verify the router and network path
Sign in to the router from a clean device using its official local address. Review the WAN or Internet DNS fields, administrator accounts, firmware version, remote-management options, and connected devices. Unknown DNS servers or unfamiliar administrator accounts are strong indicators that the router needs attention.
Change the router administrator password to a unique value and disable remote administration unless it is required. Update the firmware from the manufacturer’s genuine website, then restart the router. If settings return after a reset, contact the internet provider or replace the device.
A router reset may erase custom Wi-Fi names, port forwarding rules, and provider-specific settings. Save only trusted configuration details, and do not restore an old backup if you suspect it contains the malicious DNS configuration. Reconnect devices gradually so that a reinfected computer does not immediately compromise the network again.
Check that the connection is clean
After cleaning, test several well-known websites by typing their addresses manually or using bookmarks created before the incident. Confirm that HTTPS certificates are valid, pages load without redirects, and search results appear normal. Use the operating system’s network diagnostics to flush cached DNS records and renew the network lease.
The following checks help distinguish a local problem from a network-wide compromise:
| Check |
Likely local infection |
Likely router or network issue |
| Other devices affected |
Usually no |
Often yes |
| DNS values change again on one computer |
Common |
Less likely |
| Router DNS entries look unfamiliar |
Not necessarily |
Common |
| Redirects continue after reinstalling one device |
Unlikely |
Possible |
| Factory reset resolves the issue |
Sometimes |
Frequently |
Monitor the system for several days. Reappearing DNS entries, new browser extensions, blocked security websites, or unexplained outbound traffic indicate that removal was incomplete. Businesses should preserve logs and involve an administrator or incident-response professional rather than repeatedly resetting settings.
Recover accounts and protect files
Assume that credentials entered during the compromise may have been exposed. From a clean device, change email, banking, social media, cloud storage, and administrator passwords. Enable multifactor authentication, revoke unknown active sessions, and review account recovery details for unauthorized changes.
Inspect personal files for altered extensions, ransom notes, or files that no longer open. DNS tampering can occur during a broader attack involving ransomware, so keep encrypted backups offline and avoid paying or contacting criminals through instructions displayed on the infected computer. If file encryption is involved, review Virlock ransomware recovery information before attempting repairs.
For persistent infections, the safest option may be a clean operating system installation after backing up irreplaceable data. Reinstall browsers, applications, and security tools from official sources, apply updates, and restore files only after scanning them on a clean system.
Build stronger DNS and browsing defenses
Use reputable DNS resolvers with malware and phishing protection when appropriate, but remember that a secure resolver cannot compensate for an infected device or compromised router. Keep the operating system, browsers, router firmware, and security software updated. Remove unused extensions and avoid pirated software, suspicious email attachments, and unsolicited “support” calls.
- Enable automatic updates and schedule regular full-system scans.
- Keep at least one offline or versioned backup of important files.
- Use separate, unique passwords with multifactor authentication.
- Review router DNS and administrator settings after firmware updates or unusual outages.
- Teach household or staff users to report redirects instead of bypassing security warnings.
Restore trusted DNS settings only after malware removal, router verification, and credential protection are complete. If redirects continue or sensitive accounts may have been accessed, isolate the device and obtain qualified cybersecurity assistance promptly.