Wireless sensor networks (WSNs) have attracted a lot of interest due to their enormous potential for both military and civilian uses. Worm attacks can quickly target WSNs because of the network's weak security. The worm can spread throughout the network by interacting with a single unsafe node. Moreover, the analysis of worm spread in WSNs can benefit from the use of mathematical epidemic models. We suggest a five-compartment model to characterize the mechanisms of worm proliferation with respect to time in WSN. Taking into account the ZZ transform convoluted with the Atangana-Baleanu-Caputo (ABC) fractional derivative operator, we employ it to analyze the characteristics and applications of the ZZ transformation using the Mittag-Leffler kernel. Moreover, we construct a new algorithm for the homotopy perturbation method (HPM) in conjunction with the ZZ transform technique to generate analytical solutions for the worm transmission model. Also, we address the qualitative aspects such as positivity, boundness, worm-free state, endemic state, basic reproduction number (R0) and worm-free equilibrium stability. Furthermore, we prove that the virus rate in sensor nodes is extinct if R0<1 and the virus persists if R0>1. In addition, we develop analytical findings to evaluate the series of solutions. Furthermore, a detailed statistical analysis is conducted to verify the nonlinear dynamics of the system by verifying the 0−1 test to determine whether uncertainty exists using approximation entropy and the C0 data. An extensive analysis of the vaccination class with respect to the transmitting class as well as the susceptible class is being used to investigate the effects of stepping up precautions on WP in WSN. Moreover, the modeling of the WSN revealed that reducing the fractional-order from 1 requires that the recommended approach be implemented at the highest rate so that there is no long-lasting immunization; instead, nodes remain briefly defensive before becoming vulnerable to future worm attacks.