Defense system and method against cyber-physical attacks