This paper investigates the attack detection and secure correction control problems for cyber-physical systems (CPSs) under actuator attacks. First, by designing the sliding mode observer, the estimation of system states can be obtained. Then, the attack signal is reconstructed by using the signal obtained by the observer and the robust differentiator, attack detection is also considered with the reconstructed signal. In addition, compensation of attacks in control strategy is also addressed for plants. We consider the problem of designing state-feedback controller with attack signal compensation that stabilize the system despite actuator attacks. Finally, simulation results are given to illustrate the effectiveness and potential of the proposed technique.