Giter VIP home page Giter VIP logo

apriorit / simple-dll-injection-protect Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 10.95 MB

Simple DLL injection protect with the idea of hooking the LoadLibrary function and failing it if it is a call for an unauthorized DLL.

Home Page: https://www.apriorit.com/

License: BSD 3-Clause "New" or "Revised" License

C# 70.75% C++ 28.48% C 0.77%
api api-hooking attack-defense dll-injection protection security

simple-dll-injection-protect's Introduction

About projects

  1. CustomProcessMonitor - The C# project monitors the system's opened and newly opened processes. Prints information about processes to the console: PID, Process Name, CPU Usage, Memory Usage, and Start Time. You need to press Q or q to exit. The project is used to inject into it and change its behavior.

  2. InjectDLLProtectionPlugin - The C++ DLL that protects the target application from DLL injection. The project uses Microsoft Detours library to inject into the target application and set the hook.

  3. ProcessHide_Deviare and ProcessHidePlugin_Deviare- Projects use Nektra Deviare library to inject into the running application and hide the process named "DangerousMiner". This is achieved by injecting DLL written in C++ and setting the hook on the OpenProcess WinAPI function call. Need to provide the PID of an application into what needs to inject DLL. After that, all the OpenProcess function calls will be intercepted.

  4. ProcessHide_EasyHook and ProcessHidePlugin_EasyHook - Projects written in C# that use EasyHook library to inject into the running application and hide the process named "DangerousMiner". This is achieved by injecting DLL and setting the hook on the OpenProcess WinAPI function call. Need to provide PID or full path to an executable file of an application into what needs to inject DLL. After that, all the OpenProcess function calls will be intercepted.

  5. DangerousMiner - The WPF project that creates the process is named "DangerousMiner". The application simulates time-consuming operations. This application is used to demonstrate how to work ProcessHide_Deviare and ProcessHide_EasyHook projects. Without injecting DLL, the "DangerousMiner" process displays in the CustomProcessMonitor project, but after using ProcessHide_Deviare or ProcessHide_EasyHook applications - the process will not be shown when the user starts it.

  6. 3rd-party - The source code and licenses of libraries that were used for projects.

How to build the solution

Note

  • Visual Studio 2017 or later must be installed.
  • C++ ATL for v141 build tools (x86 and x64) must be installed in Visual Studio.
  1. Clone this repository.
  2. Open a solution file via Visual Studio.
  3. Specify solution configuration to DEBUG.
  4. Specify solution platform to x86.
  5. Perform Build Solution.

Important

The project is configured correctly and works for DEBUG x86 ONLY!

How to use the solution

After successfully building the solution, a Debug folder will be created in the Solution directory. The folder contains all built executable and DLL files.

How to inject DLL into CustomProcessMonitor and hide DangerousMiner process:

  • To use Deviare library, the user must register the respective COM object in the system. So, open CMD as administrator and navigate to Debug folder, which contains all built executable and DLL files, and run the command:
Regsvr32 DeviareLiteCOM.dll
  • Run CustomProcessMonitor.exe to open process monitor application.
  • Run ProcessHide_Deviare.exe or ProcessHide_EasyHook.exe, then provide a PID of CustomProcessMonitor. After that, the ProcessHidePlugin_Deviare.dll or ProcessHidePlugin_EasyHook.dll will be injected into the target application.
  • Open a DangerousMiner to test that the process will not be shown in CustomProcessMonitor application.

How to protect CustomProcessMonitor from DLL injection:

  • Navigate to the Debug folder and open a configuration file for CustomProcessMonitor.exe: "CustomProcessMonitor.exe.config".
  • Change the "ApplyProtection" value to "true" and save changes.
  • Run CustomProcessMonitor.exe to open process monitor application with the protection. InjectDLLProtectionPlugin.dll will be injected into an application to protect it.
  • Try to inject some DLLs into CustomProcessMonitor.exe using ProcessHide_Deviare.exe or ProcessHide_EasyHook.exe.
  • As a result, the application must notify you that something is trying to inject DLL and reject its request.

License

Apriorit released Simple-DLL-Injection-Protect under the OSI-approved 3-clause BSD license. You can freely use it in your commercial or opensource software.

simple-dll-injection-protect's People

Contributors

elementallyxd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.