This article presents the <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"><tex-math notation="LaTeX">$\epsilon$</tex-math></inline-formula> -stealthy attack against cyber-physical systems under the stochastic communication protocol (SCP), which is used to avoid data collisions. The aim is to develop an optimal attack strategy to degrade the estimation performance maximally, while remaining a certain level of stealthiness characterized by the Kullback–Leibler divergence. Taking the SCP-introduced effects into account, a novel attack model is proposed, where only a part of the transmitted data is utilized to construct the attack signal at each time instant. Subsequently, the optimization problem is formulated. Different from the existing results, where only the numerical solution is given, the analytical expression of the optimal attack parameters is presented, where the analytical solution has more advantage in analyzing how the parameters affect the attack performance. Finally, the numerical simulations on a three-tank system and the experiments performed on a networked permanent magnet synchronous machine prototype system are provided to validate our results.