Wireless sensor networks (WSNs) are highly vulnerable to malware attacks due to resource constraints. However, existing propagation models often overlook the heterogeneous security levels in hierarchically protected WSNs, leading to inaccurate representations of dynamics across network layers. This paper proposes a novel malware propagation model specifically for hierarchically protected WSNs to capture the distinct defense capabilities of heterogeneous nodes. Based on epidemiological theory, nodes are stratified into high protection level (HPL) and low protection level (LPL) categories within a susceptible-exposed-infected-recovered (SEIR) differential equation framework. We rigorously derive the basic reproduction number (