Can I execute arbitrary shellcode directly with MSBuild, and what are the platform considerations?
Yes, you can execute shellcode by embedding a byte array and calling `VirtualAlloc` and `CreateThread` from kernel32.dll within an MSBuild Inline Task. For 32-bit shellcode, use `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe`; for 64-bit, you must use the 64-bit MSBuild and corresponding shellcode. The article Use MSBuild To Do More shows a full example that successfully launches calc.exe, and the technique can be combined with Penetration Techniques - Multiple Methods for Downloading Files from GitHub to fetch shellcode remotely.
shellcode executionMSBuildVirtualAllocCreateThread32-bit64-bit
Source:Use MSBuild To Do More