In the Internet of Things arena, smart gadgets are employed to offer quick and dependable access to services. IoT technology has the ability to recognize extensive information, provide information reliably, and process that information intelligently. Data networks, controllers, and sensors are increasingly used in industrial systems nowadays. Attacks have increased as a result of the growth in connected systems and the technologies they employ. These attacks may interrupt international business and result in significant financial losses. Utilizing a variety of methods, including deep learning (DL) and machine learning (ML), cyber assaults have been discovered. In this research, we provide an ensemble staking approach to efficiently and quickly detect cyber-attacks in the IoT. The NSL, credit card, and UNSW information bases were the three separate datasets used for the experiments. The suggested novel combinations of ensemble classifiers are done better than the other individual classifiers from the base model. Additionally, based on the test outcomes, it could be concluded that all tree and bagging-based combinations performed admirably and that, especially when their corresponding hyperparameters are set properly, differences in performance across methods are not significant statistically. Additionally, compared to other comparable PE (Portable Executable) malware detectors that were published recently, the suggested tree-based ensemble approaches outperformed them.