TransWikia.com

Visual Studio Issues in shellcode delivery

Information Security Asked by user3857710 on December 10, 2021

I am learning shellcode development and payload delivery.
I have been trying to do some exercises from a lab whereby unmanaged memory is injected with Shellcode using .NET, below is the code:

try
{
    // Copy shellcode to RWX buffer
    Marshal.Copy(sc, 0, baseAddr, sc.Length);
    // Get pointer to function created in memory
    ExecuteDelegate del = (ExecuteDelegate)Marshal.GetDelegateForFunctionPointer(baseAddr, typeof(ExecuteDelegate));
    del();
}

The challenge is the above code compiles and executes using default installation of Visual Studio 2019.
When I change dev environment to either VS 2017 or 2015 i get the below error:

Exception thrown: 
'System.AccessViolationException' in ConsoleApplication1.exe ("Attempted to read or write protected memory. This is often an indication that other memory is corrupt.")   System.AccessViolationException

One thing i noted, VS 2019 is using .NET CORE 3.1, While VS 2017 & 2015 are configured for .Net Framework 4.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP