This article studies the static output feedback (SOF) secure control issue for cyber-physical systems against replay attacks. The fundamental purpose focuses on how to stabilize the closed-loop system regardless of whether the replay attacks occur. First, a detection scheme is presented that can find the behavior of the adversary and recognize which sensor suffers from the attacks. Then, the SOF controller is designed and the adverse influence induced by the replay attacks can be eliminated through the detection information. Thereafter, a sufficient condition has been established which guarantees the closed-loop system is stable and satisfies a prescribed H ∞ performance. Finally, simulation results verify the effectiveness and superiority of the presented design and detection scheme.