# Unmanaged Code Execution with .NET Dynamic PInvoke

DevFeed: [Unmanaged Code Execution with .NET Dynamic PInvoke](<https://devfeed.tech/articles/unmanaged-code-execution-with-net-dynamic-pinvoke-20504.md>)

Original publisher: [Read original article](<https://bohops.com/2022/04/02/unmanaged-code-execution-with-net-dynamic-pinvoke/>)

Author: bohops

Published: 2022-04-02T16:45:49Z

Content type: article

Language: en

Sources: [Bohops](<https://devfeed.tech/sources/bohops.md>)

Topics: [.NET](<https://devfeed.tech/topics/net.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [.NET Framework](<https://devfeed.tech/topics/net-framework.md>)

Tags: [code-execution](<https://devfeed.tech/tags/code-execution.md>), [endpoint-security](<https://devfeed.tech/tags/endpoint-security.md>), [evasion](<https://devfeed.tech/tags/evasion.md>), [interop](<https://devfeed.tech/tags/interop.md>), [net](<https://devfeed.tech/tags/net.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>)

## AI overview

The excerpt introduces Dynamic P/Invoke as a lightweight alternative way for managed .NET code to call and execute native code, motivated partly by defensive evasion. It contrasts this with classic P/Invoke, which uses declarations for native libraries and exported functions; in a compiled .NET PE, those APIs may not appear as direct imports, with the excerpt noting only `_CorExeMain` in an import analysis. The author loosely uses ".NET" for modern .NET Framework versions 4 and later, says other runtimes such as Core may be relevant, and distinguishes this technique from DInvoke. The excerpt ends before describing Dynamic P/Invoke's implementation or limitations.

## Source excerpt

Yes, you read that correctly - "Dynamic Pinvoke" as in "Dynamic Platform Invoke" Background Recently, I was browsing through Microsoft documentation and other blogs to gain a better understanding of .NET dynamic types and objects. I've always found the topic very interesting mainly due to its relative obscurity and the offensive opportunities for defensive evasion. [...]