In this paper, network security issues related to the Internet of Things (IoT) are discussed, with an emphasis on grey- and black-hole attacks (BHAs and GHAs). IoT systems lack security safeguards like intrusion detection systems because of their decentralised nature. The study suggests a defence mechanism against BHA utilising an attack selection algorithm and an optimisation strategy using a neural network to handle this. The book also emphasises how challenging it is to implement cutting-edge security features on low-power IoT devices. The suggested method comprises creating a training set and teaching a neural network for classification. This method is specifically designed for IoT intrusion detection systems. In order to increase overall efficiency, the article’s findings section explores how to improve system performance by choosing the right nodes for data transmission.