Let us suppose we have a Win Forms application with a button that if pressed checks a statement, and in case the evaluation is true it performs an action.
private void Button_Click(object sender, EventArgs e)
{
if(a==b)
{
//do something here
}
else
{
//do nothing
}
}
The matter here is the security. As far as I know, with tools like IlSpy or Reflector it is possible to view the source code, modifying it and rebuild a new executable. So, in this case bypassing this condition for an attacker would be trivial, like putting a==a in place of a==b.
Let us suppose there is a solution that completely defeats this, the only option now is to debug the assembly with a debugger like x64dbg.
The question is: is it possible in this case to hijack the execution of the app? If yes, is there a way to protect from this?