Given that you have found a process that you wish to execute a function call to, is it possible to call a function and get a return value from that process. (possibly using reflection or something similar?)
For example, suppose the process I was interested in was always the 1st process returned (I know it won’t be), I would like to do something like the following:
Process[] myProcesses = Process.GetProcesses();
int UserID = myProcesses[0].*GetUserID*();
Where GetUserID() is a public static function with that processes assembly.
All the code is managed code
Not without some form of interprocess communication. The “target” process would have to have some server or listener running (WCF, Named Pipes, socket, etc). You can send windows messages to another process, but even then, the other app would have to be listening for them and know how to execute some action based on them.
Even mechanisms that typically associated with attacks (such as stack overflows, sql injection, and others) typically require the application to be listening or acting as a server of some kind and the attack takes advantage of that listening system