Heterogeneous wireless sensor networks (WSNs) are widely deployed, owing to their good capabilities in terms of network stability, dependability, and survivability. However, they are prone to the spread of malware because of the limited computational capabilities of sensor nodes. To suppress the spread of malware, a malware spread model is urgently required to discover the rules of malware spread. In this paper, a heterogeneous susceptible-iNsidious-infectious-recovered-dysfunctional (SNIRD) model was proposed, which not only considers the communication connectivity of heterogeneous sensor nodes but also reflects the characteristics of malware hiding and dysfunctional sensor nodes. Then, the fraction evolution equations of heterogeneous sensor nodes in different states in discrete time were obtained. Furthermore, the existence of equilibria for the heterogeneous SNIRD model was proved, and the malware spread threshold was obtained, which indicates whether malware will spread or fade out. Finally, the heterogeneous SNIRD model was simulated and it was contrasted with the conventional SIS and SIR models to validate its effectiveness. The results construct a theoretical guideline for administrators to suppress the spread of malware in heterogeneous WSNs.