When wireless sensor network (WSN) is running, it needs data acquisition, fusion, and transmission, which makes the attacker distribute the malware code to the network to destroy the normal operation of the network. In this study, an improved two-dimensional (2D) cellular automata model and a multi-player evolutionary game model are proposed to describe the propagation process of malware propagation, aiming at the shortcomings of research on malware propagation in WSN. First, the authors introduce the node diversity model according to the difference between the cluster-head node and the terminal node in WSN. Then, based on the existing 2D cellular automata malware model, an improved mechanism of epidemiological transmission is improved. To make the model more complete, a multi-player evolutionary game model is established according to the different attack methods and the different coping strategies adopted by the cluster-head node and the terminal node in WSN. The replication dynamic equation of the strategy evolution is also given. Simulation results show that the proposed model can accurately describe the propagation behaviour of malware in WSN and provide a basis for security defence research of WSN.