Code Monkey home page Code Monkey logo

custom-malware's Introduction

Windows Shellcode Injection

This project demonstrates two methods of shellcode injection on Windows: self-injection and process injection. The provided examples show how to inject and execute shellcode in a process's memory space using the Windows API.

Shellcode Injection

Disclaimer

This code is for educational purposes only. Misuse of this code can lead to severe consequences. Use it responsibly and only on systems you have permission to test.

Overview

  • Self-Injection: Injects and executes shellcode within the same process.
  • Process Injection: Injects and executes shellcode into a remote process (mspaint.exe).

Prerequisites

  • Windows Operating System
  • Visual Studio or any C++ compiler that supports Windows API

Compiling

To compile the code, use a C++ compiler such as Visual Studio:

  1. Open the project in Visual Studio.
  2. Ensure that you have set the project to compile as a C++ application.
  3. Build the project.

Self-Injection

Self-injection is the process of injecting and executing shellcode within the same process. The provided example shows how to allocate memory, write shellcode into it, and create a thread to execute the shellcode.

Code Explanation

  • Memory Allocation: Allocates memory using VirtualAlloc.
  • Shellcode Writing: Writes the shellcode to the allocated memory using RtlCopyMemory.
  • Thread Creation: Creates a thread to execute the shellcode using CreateThread.

Usage

  1. Compile the code.
  2. Run the compiled executable.
  3. The shellcode (a message box) will execute within the same process.

Process Injection

Process injection is the technique of injecting and executing shellcode into a remote process. The provided example shows how to find a target process (mspaint.exe), allocate memory in it, write the shellcode, and create a remote thread to execute the shellcode.

Code Explanation

  • Process Enumeration: Uses CreateToolhelp32Snapshot and Process32First/Process32Next to find the target process.
  • Memory Allocation: Allocates memory in the target process using VirtualAllocEx.
  • Shellcode Writing: Writes the shellcode into the target process's memory using WriteProcessMemory.
  • Thread Creation: Creates a remote thread to execute the shellcode using CreateRemoteThread.

Usage

  1. Compile the code.
  2. Ensure mspaint.exe is running.
  3. Run the compiled executable.
  4. The shellcode (a message box) will execute within mspaint.exe.

Shellcode

The provided shellcode examples are simple message boxes:

  • Self-Injection Shellcode: x86 message box shellcode.
  • Process Injection Shellcode: x64 message box shellcode.

Notes

  • Ensure the target process (mspaint.exe) is running before executing the process injection code.
  • The shellcode provided is for demonstration purposes only and may need to be adapted for other use cases.

Message Box

custom-malware's People

Contributors

moroii69 avatar

Watchers

 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.