Replicated state machine is a fundamental concept used for obtaining fault tolerant distributed computation. Legacy distributed computational architectures (such as Hadoop or Zookeeper) are designed to tolerate crashes of individual machines. Later, Byzantine fault-tolerant Paxos as well as self-stabilizing Paxos were introduced. Here we present for the first time the self-stabilizing Byzantine fault-tolerant version of a distributed replicated machine. It can cope with any adversarial takeover on less than one third of the participating replicas. It also ensures automatic recovery following any transient violation of the system state, in particular after periods in which more than one third of the participants are Byzantine. A prototype of self-stabilizing Byzantine-tolerant replicated Hadoop master node has been implemented. Experiments show that fully distributed recovery of cloud infrastructures against Byzantine faults can be made practical when relying on self-stabilization in local nodes. Thus automated cloud protection against a wide variety of faults and attacks is possible.