This paper describes how the Gray Storm tool takes advantage of reflection capabilities and just-in-time compilation in the .NET framework to hijack the control flow of arbitrary .NET applications. It does this by injecting itself into the target process, using reflection to find method addresses and metadata, and then overwriting memory or method tables to redirect execution to malicious payloads. The tool can change method calls, replace method tables, compile and execute code dynamically, overwrite methods with assembly payloads, and manipulate objects - demonstrating that the .NET framework leaves processes insecure after JIT compilation by not marking memory as non-executable.
Related topics: