This is the one and only (and first article) which will present you the source code of a virus on Darknet, and a lame one too
Theory again…
First should mention a couple of things which haven’t been specified till now. This virus is going to be an appending virus:
An appending virus is a virus that writes all of his code to the end of the file, after which it writes a simple jump to the code at the start of the file
I will use this method, for first in the virus i’ll present here, maybe later I will adopt another technique as EPO:
Entry Point Obscuring is a method which inserts the entry point of the virus somewhere in the host file, where it can do an interception of the code for later replication, but not at the start.
…but definitely not overwriting viruses:
An overwriting virus has a simple routine to overwrite the host file, thus being easily detected because of the fact that infected files in 99% of cases won’t run anymore
Back to reality
So my first virus is called infant-a, because it only does a single thing (like an infant); also it is a DOS COM infecter, so you won’t have much trouble with it. What to say more, the source if fully commented, and if you have read the book I have suggested you in the 00h article than you won’t have any problems in understanding it.It is not detected by Avira anti virus, check it with other anti viruses and tell me if it found and under which name, oh yeah Kaspersky doesn’t find it either.
BTW: don’t compile and infect other files (computers) with it because I will look lame not you
The brilliant (and simple code) follows: infant-a
How to play with it?
Everything goes in 3 steps, or 2 depends on you…
1st step - dummy com files
Enter in DOS mode (run cmd from Windows run) and write the following lines:
C:\ >debug
-a100
xxxx:0100 mov ax,4c00
xxxx:0103 int 21h
xxxx:0105 ^C
// this is a comment ^C means CTRL+C 
-rcx
CX 0000
:5
-n dummy.com
-w
Writing 00005 bytes
-q
C:\>copy dummy.com uninfectedFile.com
2nd step - compile the virus
For this one you need TASM & TLINK, google to get them; if you have them enter the following lines supposing infant-a.asm is the virus:
C:\ >tasm infant-a.asm
C:\ >tlink /t infant-a.obj
//comment: /t tells tlink to make it a dos image file = com file
3rd step - optional
Download DOSBox, install it and use the following commands (after starting DOSBox):
Z:\ >mount C:\ Folder\ Where\ The\ Virus\ And\ Dummy\ COM\ Files\ Are\ Located c:
//comment: c with : (c:) or without I don't remember exactly
Z:\ >C:
C:\ >
//comment: and now your C drive (in DOSBox) is C:\ Folder\ Where\ The\ Virus\ And\ Dummy\ COM\ FIles\ Are\ Located
Let’s play
And now you can start the virus and see how it infects one file per run, the dummy COM files should have 6 bytes length, and after infection 161, you can’t miss them…
Are we done already?
Well 02h is over, but 03h is there waiting to be written; whats next? infant-b of course which will have:
- An encryption method (XOR)
- A traversal infection (dotdot [..] method)
- More infections per run
- Stealth?
Till then have fun with infant-a, and see you as soon as possible (if anybody reads this series).