5G and 6G promise to be catalysts for the Internet of Things (IoT), enabling ultra-massive and mission-critical IoT. The requirements of new IoT applications and the large number of connected objects announced will exacerbate the thorny problem of spectrum scarcity in wireless communications. Cognitive radio is positioned as a revolutionary technology that promises to mitigate the problem of spectrum scarcity through more efficient use of spectrum. Integrating cognitive radio into the IoT allows objects to opportunistically access spectrum resources already allocated to another user (primary user, PU) without causing interference. Spectrum sensing allows objects to be aware of the spectrum occupancy status of the target PU. In radio environments where the PU signal is subject to multipath and shadowing effects, making spectrum sensing by a single object very difficult, cooperative spectrum sensing (CSS) has been proposed to improve detection performance. However, this cooperation between objects has opened the way to a new form of attack known as the Spectrum Sensing Data Falsification (SSDF) or Byzantine attack. In our paper, we propose a sophisticated Byzantine attack model that generalizes known simple attacks. Then we propose a new innovative and intelligent weighted sequential hypothesis testing scheme that ensures CSS security by significantly reducing the average number of samples required for global decision-making in a highly hostile IoT network. Simulation results under various attack scenarios clearly show that our security mechanism leads to better performance compared to other mechanisms such as classical WSPRT, SPRT and majority rule.