AbstractThis paper is concerned with optimal security problem of cyber‐physical systems with state attacks. Consider a linear physical system, assuming that the control input signal of the network layer is vulnerable to state attack. For a system that cannot measure all states, by combining output integral sliding mode, robust observer, and adaptive methods, an adaptive output integral sliding mode control method is proposed to maintain the safe operation of cyber physical systems under state attacks. Moreover, by optimizing the linear control gain matrix, the control strategy the authors designed can use the minimum cost to compensate the impact on the CPS system. Different from the existing results, (1) It is assumed that the system information of the attack signal is not fully known, we assume that the attacker can only measure a small amount of state information. (2) Not only the stability of ideal sliding mode is proved, but also the upper bound of the augmented state composed of system states and the error dynamic is given. (3) The sliding mode compensator can eliminate the impact of state attack, on the one hand, the damage caused by the state attack has been eliminated by using the upper bound of error, and on the other hand, the cost is reduced by optimizing the linear control gain. Finally, a power system with 3 generators and 6 buses is used to prove the effectiveness of the adaptive output integral sliding mode control scheme.