A logic bomb is malicious code hidden inside software or a system that stays dormant until a specific condition is met, such as a date, a file being opened, or an employee account being removed. When the trigger fires, it executes its payload, which can delete files, corrupt data, disable systems, or steal information.
Key takeaways
- A logic bomb stays silent until a trigger fires, so normal antivirus scans often miss it before detonation.
- Most logic bombs are planted by insiders or hidden in scripts, scheduled tasks, and build pipelines.
- Code review, least privilege, and offboarding checks are the strongest defenses against logic bombs.
Most malware attacks immediately. A logic bomb does the opposite: it waits. It sits quietly inside a program, a script, or a server for weeks or months, doing nothing at all — until the date arrives, the file opens, or the employee leaves. Then it fires, and by then it is often too late to stop the damage.
What is a logic bomb?
A logic bomb is malicious code embedded in software or a system that remains dormant until a specific condition is met. When that trigger fires, the code executes a harmful payload, such as deleting files, corrupting data, or disrupting a critical system.
The code is usually hidden inside otherwise working software, an automated script, or another piece of malware. Because it does nothing until triggered, it can pass normal testing and antivirus scans unnoticed.
Logic bombs are often planted by someone with inside knowledge — a disgruntled employee, a contractor, or an attacker who has already gained access. That insider angle is what separates logic bombs from most other malware in practice, even though the code itself can look ordinary.
How does a logic bomb work?
A logic bomb has two parts: a trigger and a payload. The trigger is a condition the code checks for; the payload is the harmful action it takes when that condition becomes true.
Triggers fall into two groups. A positive trigger fires when something happens — a file is opened, a user logs in, a database record changes. A negative trigger fires when something does not happen — for example, code that erases data unless its creator intervenes, a kind of digital dead man's switch.
The payload can be almost anything malicious: deleting files, wiping a database, disabling security software, launching a resource-heavy loop that crashes servers, or opening a back door for a later attack. Some logic bombs also combine triggers, for example firing on a date and only if a particular user account still exists.
What are the main types of logic bomb?
Logic bombs are usually grouped by their trigger, not by their payload. The trigger tells you where to look for them and what kind of monitoring will catch them.
| Type | Trigger | Example | Where it hides |
|---|---|---|---|
| Time bomb | Date or time | Fires on March 4, 2002 | Scheduled task, cron job |
| Event-driven | System event | File opened, record changed | Application code, script |
| Account-based | Account change | Employee removed from payroll | HR or payroll script |
| User-activated | User action | Victim runs a program | Trojan, installer |
| Malware-linked | Other malware's condition | Worm delays part of its attack | Virus or worm payload |
Time bombs are the best-known type, but account-based triggers are the most telling in insider cases: code that fires when the person who wrote it leaves the company is a classic pattern. In cloud and DevOps environments, logic bombs also hide in infrastructure-as-code templates and CI/CD scripts, where a conditional payload can sit unnoticed through many deployments.
What are real examples of logic bombs?
Real logic bomb cases show the same pattern again and again: a trusted insider plants code, leaves, and the damage happens later, when the connection is hard to prove quickly.
Omega Engineering, 1996
A former programmer at Omega Engineering planted malicious code before he was dismissed. After he left, the code activated and destroyed critical manufacturing software. The attack caused about $10 million in losses and became one of the best-known insider logic bomb cases.
UBS PaineWebber, 2002
Roger Duronio, a systems administrator at UBS PaineWebber, planted a logic bomb that activated across the company's network on March 4, 2002. It affected more than 1,000 computers and caused over $3 million in damage. Duronio was later convicted for the attack.
Fannie Mae, 2008
In 2008, a former contractor at Fannie Mae was accused of planting a logic bomb set to activate on January 31, 2009, which would have wiped data from thousands of servers. The code was found and disabled before it fired, which is the rare case where detection worked in time.
Siemens contractor, 2019
David Tinley, a contract employee for Siemens, programmed logic bombs into software he created. The bombs caused the software to malfunction after a certain period, so Tinley would be called back to fix it and secure more work. He pleaded guilty in 2019.
Stuxnet, 2010
Stuxnet, discovered in 2010, was a sophisticated worm that included logic-bomb-like behavior: it only attacked Iranian centrifuge controls when specific industrial conditions were detected, manipulating controllers so centrifuges spun erratically and were damaged. It shows how conditional logic can make malware highly targeted.
These cases are documented in vendor and security guidance, including BeyondTrust's logic bomb overview. The lesson is consistent: the attacker is often someone the organization already trusted.
Logic bomb vs virus vs Trojan vs time bomb
These terms overlap, which causes confusion. A logic bomb is a technique; a virus, worm, or Trojan is a delivery vehicle that can carry one.
A virus infects files and spreads. A Trojan pretends to be legitimate software. A worm spreads on its own across networks. Any of them can contain a logic bomb that delays part of the attack until conditions are met. A time bomb is simply a logic bomb whose trigger is a date or time.
There is also a harmless look-alike: trial software that stops working after a set number of days uses the same conditional logic, but its payload is known and not malicious. The difference is intent and disclosure, not the mechanism.
How do you spot a logic bomb before it fires?
Spotting a dormant logic bomb is hard, because by design it does nothing suspicious until it fires. The best clues are in code, access, and timing — not in antivirus alerts.
- Unexplained conditional code. Date checks, account checks, or hidden branches in scripts that nobody can explain or that do not match the documented purpose.
- Changes by a departing employee. Code or scheduled tasks modified shortly before someone leaves, especially without review.
- Odd scheduled tasks. New cron jobs, Windows scheduled tasks, or CI/CD steps that run at unusual times or touch sensitive data.
- Disabled logging. Code that turns off logging, deletes logs, or bypasses monitoring around the same time as other changes.
- Backups that stop working. A logic bomb that targets backups first is preparing for a detonation that cannot be undone.
If you find suspicious conditional code, do not run it to see what it does. Quarantine the system, preserve logs, and get a security professional or your incident response team involved. Our guide to how to remove a rootkit covers the related problem of malware that hides below normal scans.
How do you prevent logic bombs?
Prevention is mostly about who can change code and what happens when someone leaves. No single tool stops logic bombs; the controls work together.
Review code and separate duties
Require peer review for every change to production code, scripts, and infrastructure templates. Separate duties so the person who writes code cannot deploy it alone. This is the single most effective control against insider-planted logic bombs.
Tighten offboarding
Revoke access the day someone leaves, and review code and scheduled tasks they touched in their final weeks. Account-based triggers are designed to fire after departure, so the offboarding window is the highest-risk period.
Monitor scripts, tasks, and integrity
Alert on new scheduled tasks, cron jobs, and CI/CD changes. Use file integrity monitoring and code signing so an unauthorized change stands out. Watch for code that disables logging or touches backups.
Keep offline backups
Keep backups that a logic bomb cannot reach — offline or immutable — and test restoring from them. A logic bomb that wipes live data is recoverable only if the backup was outside its reach.
For a wider baseline, our small business cybersecurity checklist covers access control, backups, and offboarding together.
MITRE ATT&CK documents the scripting techniques attackers use to hide such code in technique T1059.
What should you do if a logic bomb fires?
Act as if it is an incident, not a bug. Isolate affected systems from the network, preserve logs and the suspect code for investigation, and restore from a clean, offline backup rather than trying to repair the damaged system in place.
Change credentials that may have been exposed, check for a second payload or back door, and review who had access to the affected code. Report the incident to law enforcement if data was destroyed or stolen, and to your cyber insurer if you have one. Do not delete the evidence before investigators have had a chance to examine it.
The bottom line
A logic bomb is dangerous because it is patient. It hides in code you trust, waits for a trigger you may not notice, and then acts all at once. The defense is process: reviewed code, least privilege, careful offboarding, and backups a bomb cannot reach.
Start with a review of who can change production code alone, and what happens to their access on their last day. You can check the integrity of files you download with the free hash generator as part of that verification habit.
Frequently asked questions
What is a logic bomb in simple terms?
A logic bomb is a piece of malicious code that hides inside a program and does nothing until a set condition happens, such as a date arriving or a user account being deleted. Then it activates and causes damage, such as deleting files or shutting down a system.
Is a logic bomb a virus?
Not exactly. A logic bomb is a technique, not a type of malware on its own. It can be hidden inside a virus, a Trojan, a script, or legitimate software. Viruses spread by infecting files, while a logic bomb waits for a trigger.
What is the difference between a logic bomb and a time bomb?
A time bomb is a type of logic bomb triggered by a date or time. A logic bomb can also be triggered by other events, such as a file being opened, a database record changing, or an account being removed.
Who plants logic bombs?
Most often, a trusted insider, such as a disgruntled employee or contractor with legitimate access, or an external attacker who has already compromised a system. Insiders are a particular risk because they know the code and the schedule.
Can antivirus detect a logic bomb?
Sometimes, but not reliably before it fires. A dormant logic bomb may look like ordinary code, so signature-based antivirus can miss it. Code review, behavior monitoring, and integrity checks are more effective than antivirus alone.
What damage can a logic bomb do?
It can delete or corrupt files, wipe databases, disable security tools, shut down services, or steal data. In documented cases, logic bombs have caused millions of dollars in losses and locked thousands of employees out of corporate networks.
How do you prevent a logic bomb?
Limit who can change production code, review all changes, separate duties so no one person can deploy code unchecked, monitor scheduled tasks and scripts, and run a thorough access review when someone leaves. Keep offline backups so a detonation is recoverable.
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 BeyondTrust, Avast, Intego and Twingate logic-bomb guidance and MITRE ATT&CK scripting techniques.
How we write and fact-check →