Is it possible to run a Windows executable stored in memory?

0

I have an executable that is not a .NET Framework assembly stored in byte[] , and I want to run it without creating a dedicated file for security reasons.

The reason for not wanting to create a temporary file, storing the bytes and then executing them is because the executable contains sensitive information, as well as being encrypted, and can be easily circumvented and accessed by the user when opening the created file. >

So I've tried using this method:

byte[] assemblyFiles = Decrypt(assemblyBytes);
Assembly executeable = Assembly.Load(assemblyFiles); 
executeable.GetEntryPoint().Invoke();

However, at the time of using Assembly.Load() it gives error and says that the executable is not valid for .Net Framework.

I needed to do this in C #, preferably within the application itself, without needing a file dedicated to this operation.

I've tried using this class from another answer in English StackOverflow, but I did not understand how to use the hostProcess argument. So I was not successful.

    
asked by anonymous 26.04.2018 / 00:56

0 answers