Nowadays, the use of sensor nodes for the IoT is widespread. At the same time, cyberattacks on these systems have become a relevant design consideration in the practical deployment of wireless sensor networks (WSNs). However, there are some types of attacks that have to be prevented or detected as fast as possible, like, for example, attacks that put lives in danger. In this regard, a primary user emulation (PUE) attack in a structural health monitoring (SHM) system falls inside this category since nodes failing to report structural damages may cause a collapse of the building with no warning to people inside it. Building on this, we mathematically model an energy and resource utilization-efficient WSN based on the cognitive radio (CR) technique to monitor the SHM of buildings when a seismic activity occurs, making efficient use of scarce bandwidth when a PUE attack is in progress. The main performance metrics considered in this work are average packet delay and average energy consumption. The proposed model allows an additional tool for the prompt identification of such attacks in order to implement effective countermeasures.