A drive-by download is malware that is installed on a device simply because the user visited a website, with no download click needed. Malicious code on a compromised or malicious page exploits a vulnerability in the browser, a plug-in, or the operating system, then downloads and runs malware silently in the background.
Key takeaways
- A drive-by download needs only a visit to a compromised or malicious page, not a click on a download button.
- Keeping the browser and operating system updated closes the known vulnerabilities most of these attacks exploit.
- Layered defenses — patching, sandboxing, script and ad blocking, and least privilege — stop most drive-by attacks.
Most malware needs you to do something: open an attachment, run a file, or click a download. A drive-by download breaks that rule. You visit a page, the page does the work, and malware lands on your device before you have touched anything.
What is a drive-by download?
A drive-by download is malware that is installed on a device simply because the user visited a website. No download button, no attachment, and no obvious warning are needed for the silent form of the attack.
MITRE ATT&CK tracks this technique as T1189: Drive-by Compromise. Its description is plain: adversaries gain access when a user visits a website, exploiting software vulnerabilities on the endpoint. The page, an advert on it, or a script it loads does the work.
There are two forms. In the silent form, code on the page finds a vulnerability in your browser or a plug-in and uses it to run code. In the user-assisted form, the page shows a convincing prompt, such as a fake browser update, a missing font, or a document viewer you supposedly need, and you run the file yourself.
Both forms share the same uncomfortable point: the attack depends on a weakness in your software, not on you doing something unusual. That is what makes it different from phishing, where the victim is tricked into acting.
How does a drive-by download work?
A typical drive-by download follows four stages: staging, redirection, exploitation, and payload delivery. Defenders can break the chain at any one of those stages.
1. Staging: the attacker prepares the trap
The attacker compromises a legitimate website, often through a vulnerable content management system, plug-in, or theme. They may also buy a malicious advert through a legitimate ad network, or poison a third-party script the site loads.
Attackers also build look-alike sites of their own. MITRE lists drive-by targets prepared in advance, including script files served from publicly writable cloud storage that an attacker modifies.
2. Redirection and filtering
When you visit the compromised page, injected code quietly sends your browser through one or more redirects. Attackers filter by country, browser version, or device type, so security researchers may see a clean page while real targets get the exploit.
This filtering is one reason drive-by attacks are hard to detect. The victim often never realizes how the infection happened, a point NIST has noted for watering hole and drive-by attacks.
3. Exploitation: the browser flaw is used
Scripts on the page check your browser and plug-in versions for a known vulnerability. If they find one, exploit code runs. Common targets are memory corruption bugs in the rendering engine, such as use-after-free flaws in Blink, WebKit, or SpiderMonkey.
Modern browsers run pages inside a sandbox, so the exploit may first land inside the browser process. A second flaw, or a prompt that tricks you into running a file, can then escape that sandbox and reach the operating system.
4. Payload: malware is delivered and runs
The exploit downloads the real malware, often in stages. The first small loader fetches a larger payload: ransomware, a banking trojan, an information stealer, or a cryptominer that uses your CPU without your knowledge.
Once running, the malware may steal passwords, take screenshots, log keystrokes, or open a back door for the attacker to return later.
What are the main types of drive-by download?
The main types are silent browser exploits, malvertising, watering hole attacks, and fake update or fake download prompts. Each uses a different lure, but all end with code running on your device.
| Type | How it reaches you | User action needed | Main defense |
|---|---|---|---|
| Silent browser exploit | Compromised page exploits a browser flaw | None, just the visit | Patching and sandboxing |
| Malvertising | Malicious ad on a reputable site | None, just the page load | Ad blocking, web filtering |
| Watering hole | Site a specific group visits is compromised | None, just the visit | Patching, isolation, monitoring |
| Fake update prompt | Page claims your browser or font is out of date | You run the offered file | Never install from a web prompt |
| Poisoned third-party script | A library or widget the site loads is tampered with | None, just the visit | Script control, content security policy |
Malvertising
Malvertising hides malicious code inside an advertisement served through a legitimate ad network. Because the ad appears on a reputable news or shopping site, the victim has no reason to be suspicious.
Ad blockers help here, because MITRE notes that ad blockers can help prevent malicious code served through ads from executing. Web content filtering that inspects traffic for malicious downloads adds another layer.
The NHI drive-by downloads guide explains how the threat has shifted from exploit kits toward social engineering in the browser, while patching remains the biggest single control.
Watering hole attacks
A watering hole attack is a targeted drive-by compromise. Instead of infecting any visitor of any site, the attacker compromises a site that a specific group visits, such as an industry forum or a supplier portal.
These attacks are aimed at a chosen audience, so the victim may be a single company or sector. That targeting makes them harder to spot in general threat data.
Fake updates and fake downloads
This is the user-assisted form. The page shows a full-screen warning that your browser, media player, or font pack is out of date, or that a document cannot be viewed without a new viewer. The offered file is malware.
Real browsers update themselves or through your operating system. They never ask you to download an installer from a random website, so treat any such prompt as an attack.
How do you know if you got a drive-by download?
Many drive-by infections show no obvious sign at first, which is why a full security scan is the reliable check. The warning signs below should prompt an immediate scan and a check of your browser.
- New extensions, toolbars, or search engines you did not install.
- Changed home page or default search that keeps reverting after you fix it.
- Pop-ups and redirects on sites that never showed them before.
- Slow performance, high CPU, or a hot device when the browser is idle, which can point to cryptomining.
- Security software alerts about a blocked download, exploit, or suspicious process.
- New programs or scheduled tasks you do not recognize.
- Accounts acting strangely, such as password reset emails you did not request.
If you see several of these together, treat the device as compromised until a scan says otherwise. Do not log in to banking or email from it until it is cleaned.
Who is most at risk from drive-by downloads?
Anyone with an unpatched browser is at risk, but some people and setups are exposed more than others. The common factor is not carelessness, it is outdated software and broad browsing.
People running old browsers, unsupported operating systems, or many browser extensions face the most risk. Each extension is another piece of code that can contain a flaw, so the Australian Cyber Security Centre recommends keeping applications up to date and limiting unnecessary plug-ins.
Staff who browse widely for research, or who visit niche industry sites, are more likely to hit a compromised page. The same applies to people who click through search results and shortened links without checking where they lead. For a wider baseline, our small business cybersecurity checklist covers patching alongside backups and device security.
Organizations with users running as local administrators are hit harder when an exploit succeeds, because the malware inherits those privileges. Least privilege, using a standard account for daily work, limits the damage.
Drive-by download vs phishing vs malware download: what is the difference?
A drive-by download needs only a visit, phishing needs you to act on a message, and a plain malware download needs you to choose a file. The delivery route is what separates them.
Phishing arrives by email, text, or call and asks you to click a link, enter credentials, or send money. Our guide to what spear phishing is shows how targeted versions of that attack work. A drive-by download, by contrast, can infect you from a page you reached through an ordinary search result.
A Trojan horse download is one you chose, even if you were misled about what it was. A drive-by download in its silent form is one you never chose at all. That distinction matters for defense: user training helps against phishing and Trojans, but patching and sandboxing are what stop silent drive-by exploits.
How do you prevent drive-by downloads?
No single control stops every drive-by download. The goal is layers, so that when one fails, the next one catches the attack. Patching is the biggest single control.
Keep the browser and operating system updated
Most drive-by attacks exploit known vulnerabilities. Automatic updates close those holes quickly, and the window between public disclosure and patching is exactly when exploit kits are updated to target them.
Turn on automatic updates for your browser, operating system, and any remaining plug-ins. Remove plug-ins you no longer use, including old media players and Java, because each one is another target.
Use a modern browser with sandboxing
Modern browsers isolate each site in its own process and apply exploit mitigations. Keep those protections on and do not disable them for convenience. If your browser offers enhanced protection or site isolation, turn it on.
Limit browser extensions to the ones you actually use, and remove the rest. Check extension permissions when you install one, and remove any extension you do not recognize.
Block ads and control scripts
A reputable ad blocker cuts off the malvertising route, and a script blocker lets you allow scripts only from sites you trust. Web content filtering that inspects traffic for malicious downloads adds protection at the network level.
For businesses, the Australian Cyber Security Centre also recommends application control, which only allows approved programs to run. In many successful incidents, application control would have been the only mitigation able to stop a drive-by download from executing its payload.
Use least privilege and separate accounts
Do daily browsing from a standard user account, not an administrator account. Limit the ability of privileged accounts to access email and the internet, using separate unprivileged accounts for those tasks.
This does not stop the exploit, but it limits what the malware can do afterward. Combined with backups, it also makes recovery far faster if an infection does get through.
What should you do if you think you were hit by a drive-by download?
Act quickly and in order: stop the download, scan the device, and check for persistence. Speed matters, because the first payload is often a loader that fetches more malware.
- Close the browser tab and window. Do not click anything the page offers, including fake close buttons or update prompts.
- Do not run any file the site offered. If a download started, delete it without opening it.
- Disconnect from the network if you suspect an infection, to stop data leaving the device.
- Run a full scan with updated security software, and follow its removal steps.
- Check extensions, installed programs, and scheduled tasks for anything new or unfamiliar, and remove it.
- Change passwords for important accounts from a clean device, starting with email and banking, and turn on phishing-resistant MFA.
- Restore from a known clean backup if the scan cannot remove the infection, or seek professional help.
At work, tell your IT or security team even if nothing seemed to happen. Others probably visited the same site, and the team can block the domain and check other devices. You can also check whether your own site is serving safe headers with our free security headers checker.
What should website owners do to stop serving drive-by downloads?
If your site is compromised, your visitors become victims, and search engines may flag your site. Site owners need to treat their own site as part of the attack surface.
Keep your content management system, themes, and plug-ins updated, and remove unused ones. Use strong, unique passwords and MFA for admin accounts, and limit who can upload files or edit code.
Set a content security policy that limits which scripts can run, and monitor your site for unexpected changes. A free SSL checker and regular scans help, but they do not replace patching and monitoring. If you find injected code, take the site offline, restore from a clean backup, change all credentials, and find how the attacker got in before you go back online.
The bottom line
A drive-by download is dangerous precisely because it asks nothing of you. One visit to a compromised page can be enough, and HTTPS alone will not save you, because encryption protects the connection, not the content.
The defenses that work are unglamorous and effective: update fast, use a modern sandboxed browser, block ads and untrusted scripts, run security software, and browse from a standard account. Check your own site's defenses with the free security headers checker.
Frequently asked questions
What is a drive-by download in simple terms?
It is malware that arrives on your device just because you visited a website. The page exploits a weakness in your browser or its plug-ins, so the download and infection happen without you choosing to download anything.
Can a drive-by download happen on a legitimate website?
Yes. Attackers often compromise a legitimate site and inject malicious code into it. Visitors then get infected even though the site itself is one they trust and have visited before.
Do I need to click anything for a drive-by download?
In the silent form, no. The exploit runs when the page loads. In the user-assisted form, the page tricks you into running a file, for example with a fake browser update or a fake missing font message.
Does HTTPS protect me from drive-by downloads?
No. HTTPS encrypts the connection between you and the site, but it does not check whether the page content is safe. A compromised site served over HTTPS can still deliver a drive-by download.
How do I know if I got a drive-by download?
Common signs are new toolbars or extensions you did not install, changed browser settings, pop-ups, slow performance, and security software alerts. Many infections show no obvious sign, so a full scan is the reliable check.
Can drive-by downloads affect phones?
Yes. Mobile browsers and apps can be exploited too, especially on outdated devices. Keep your phone operating system and browser updated, and only install apps from the official app store.
What is the difference between a drive-by download and malvertising?
Malvertising is one delivery route for a drive-by download. It hides malicious code inside an advertisement served through a legitimate ad network, so the attack can appear even on reputable news sites.
What should I do if I think I visited a malicious site?
Close the browser, do not download or run anything it offered, run a full scan with updated security software, and check for new extensions. If anything was installed, disconnect the device and get help from IT or a security professional.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against MITRE ATT&CK T1189 and the Australian Cyber Security Centre guidance on mitigating drive-by downloads.
How we write and fact-check →