01 logo

How to Write a Virus

Learning how to write a virus isn't as difficult as it probably should be; which makes it perfect for recognizing when you've been attacked by one or when you want to have a little one with one of your friends.

By Brayden SimmonsPublished 5 years ago 7 min read
Like

It's a harsh reality to accept, but ever since the conception of the internet, malicious people have been looking for ways to cheat, rob, or otherwise harm people. Whether it be by the hands of a hacker, a terrorist, a government agent, or a disgruntled programmer, the prominence of people with this ability has only grown stronger as the internet has matured. As this harsh reality still holds truth today, it has almost become necessary to familiarize yourself with the ways to write a virus, if not at the very least identify one. For those of you who want to fight the digital battle on the grounds of the web, brushing up on your programming and developing virus writing tactics may be the next step to holding your ground in a virtual battleground.

Step One: Decide which operating system your virus will attack.

Photo by rawpixel on Unsplash

Have you heard the myth that Macs don't get viruses? We all have, and that's all it is a myth. You can write a virus for Windows, Macintosh, and Linux (an open-sourced based operating platform). For the sake of doing what is easiest, you should focus on Windows while you are still developing your skills.

Although antivirus programs are available and nearly everyone has one, they often create more security holes than if someone had just used a standard issue firewall. Mac and Linux users both have operating systems that are almost virus proof (or, rather, they are installed with a common antivirus for the system), instead of relying on another program the way the Windows operating system sometimes does.

Step Two: Determine how you will get your virus to the real world.

That's right, just like the most important steps in a beginner's guide to getting started with programming, you'll want to know how your virus will spread out to others, and what it will do. The delivery method is an important decision and will affect the virus code. There are three primary delivery methods; including, executable files, office files, and web scripts.

An executable file is a computer virus that someone downloads believing it was something else. This delivery method was the most common in the early days of email. The program often looks like an image, but is secretly a .EXE or .BAT file, which executes the virus programming when opened.

An office file is usually found during spear phishing, or attacks on a company. The attachment will appear and exist as a Word, Outlook, or Excel file; however, when opened, a macro will begin, executing the virus.

The web script delivery method is one of the most malicious delivery systems, as you are embedding code into a website. Anyone who visits your webpage will put their computer at risk, and the webmaster doesn't have any knowledge of the virus.

Step Three: Find a weak spot.

Like any other attack; whether it's on the discovery channel, in a bar fight, or in a war zone; you need to exploit a vulnerability. Finding a weak spot in a system is relatively easy, but requires a lot of research. Some communities offer a collective knowledge about how some database systems or networks work, which can make your research time much less than you might expect.

Step Four: Declare your viruses super power.

When you get your virus programming into an operating system, it needs to do something. What do you want your virus to do? When you first found inspiration to start writing your virus code, you might have thought of all the things that a program could do, but focusing on one exact effect is best.

Keep in mind that you are committing a serious crime by creating a spreading a malicious virus. There are many programmers or computer enthusiasts who enjoy creating viruses to expand their personal knowledge of programming.

When working to expand on your knowledge of computer viruses, you'll want to test out what they can do. From altering batch files (or deleting them entirely) to crashing a computer, a virus can do pretty much anything.

Step Five: Find your programming language.

Photo by Markus Spiske on Unsplash

The reasons why you should learn C or C++ programming are extensive, as they can are the most basic and can offer you much more of a learning experience than any other assembly language. C and C++ languages are also useful for creating executable viruses. However, if you want to create a macro virus or a create a malicious program for Windows, you will need to move on from the basic languages.

Macro viruses rely on a macro language, which isn't complicated but is time consuming. The virus code is also reliant on the intended recipient.

Visual basic is an assembly language almost exclusively used for creating malicious Windows programs. Again, creating and spreading a malicious virus is a crime in nearly every country, so know the consequences before you choose to pursue this option!

Once you've started writing with a programming language, you'll find that they are much easier to learn than a second or third spoken language. There are many apps that you can use to practice programming languages as well.

Step Six: Write your virus.

This step will take you the longest amount of time, and you must pay close attention to detail or else your virus code will be useless. Just like the ways you've learned how to write a computer program, take this time to experiment. Try to find ways to replicate your code if you really want to challenge yourself. The more ways your code can replicate with minor variation, the more difficult it is for an antivirus program to find and stop the virus.

Polymorphic code is an advanced tool used by programmers to modify the virus every time it replicates. For those trying to work around antivirus programs, it's the only way to write a virus. For information on polymorphic code and replication, you can find communities or forums online that explain this aspect of how to write a virus.

Step Seven: As you write a virus, you need to make it invisible.

In order to make your virus just a little more powerful, it has to be invisible. To make your virus invisible and able to slip right past those pesky antivirus programs, you'll want to encrypt your programming language so that antivirus programs don't realize it's a virus they're letting in through the front door.

Encryption does take some time to learn, but it's a very commonly used tool by any developer and only takes a bit of practice to perfect. You can learn encryption, just be patient with yourself.

Step Eight: Make sure your virus works.

You don't want to go emailing your virus off to your unsuspecting friend if it won't do anything when it gets there. The recipient may just wonder why the attachment doesn't open a file, and then the joke will be ruined.

To test your virus, you'll want to try the virus programming out on a few different machines. Using virtual machines is the easiest way to accomplish this task. When using a virtual machine, you'll want to ensure that you contain the test so your virus doesn't wreak havoc before you're ready.

Step Nine: Release your virus into the real world.

Photo by Jefferson Santos on Unsplash

Don't remember that many people write viruses simply to see if they can do it. Additionally, since viruses can do anything, and people write a virus to play harmless pranks on friends or family members with a remedy on hand.

To release your virus, you'll want to collect your program into a file and disguise it or export it as a torrent before sending it off to its intended recipient. Remember that the real world has consequences that can include jail time and hefty fees depending on the damage and malicious nature of the virus you created.

how to
Like

About the Creator

Brayden Simmons

Your run of the mill tech and gaming nerd. Anything about technology, games, or lightsabers, and I’m probably writing about it.

Reader insights

Be the first to share your insights about this piece.

How does it work?

Add your insights

Comments

There are no comments for this story

Be the first to respond and start the conversation.

Sign in to comment

    Find us on social media

    Miscellaneous links

    • Explore
    • Contact
    • Privacy Policy
    • Terms of Use
    • Support

    © 2024 Creatd, Inc. All Rights Reserved.