logo

Weird Ways to Run Unmanaged Code in .NET

ID: d408f808-f166-56c0-9d3a-db182c7a6393

STIX ID: report--d408f808-f166-56c0-9d3a-db182c7a6393

Feed Name: XPN Infosec Blog

Threat Score
70/100

Date Published: 2021-05-05

Date Updated: 2026-07-30

...
...

This post analyses .NET CLR internals to demonstrate multiple offensive techniques for executing unmanaged code from managed .NET processes. It covers delegate-based invocation (Marshal.GetDelegateForFunctionPointer), stealing existing framework P/Invokes, locating and overwriting JIT trampolines and native code slots to trigger arbitrary native payloads (including Cobalt Strike), and abusing internal FCall/QCall “gadgets” to read/write memory, with annotated C# PoC code and WinDBG inspection.

Your team is not currently subscribed to this feed. You must subscribe to it in order to see this post.