Logical Bombs
According to Wikipedia:
A logic bomb is a piece of code intentionally inserted into a software system that will set off a malicious function when specified conditions are met.
These things are a bit complicateder compared to Fork Bombs. A logic bomb has 2 main components:
An event-checker/event-listener that keeps checking if the requirements are met for the bomb to go off.
The bomb's payload. This stuff is the "malicious function" that'll be executed when the logic bomb goes off.
So, if you want a simple example of a logic bomb, here's one:
Let's go through how this works:
First comes the payload function, i.e. the stuff the logic bomb should execute when it goes off. For this example, we'll just make it print the string: BOOOM
on the console; pretty simple, right?
Since we wanna keep this as simple as possible, we're using an infinite loop that will keep checking for a condition every iteration. In this case, we're checking if the time passed since the beginning of the program's execution is 5 seconds. If 5 seconds have passed, the payload will be executed and the program will break out of the loop.
Now comes the part when we execute this program. It'd be pretty stupid to run it in a console and expect the user to not close said console and keep it running in the background. The following command can be used to work around that:
If you don't already know, (on Linux) the &
at the end means that the program will run in the background. In its own process thread. If you want to achieve the same on a windows system, you can use the following powershell
command:
The example we considered was a simple one. If you wish to see a more overengineered and verbose implementation of a logical bomb, you can check the puffgo
package:
PS: Be sure to check the puffgo
wiki, I promise it'll be helpful :)
Last updated