The IoT ecosystem faces increasingly complex security challenges due to the rapid growth of global IoT devices. Security risks related to device identification and credential compromise are on the rise, especially with the proliferation of IoT devices in various aspects of life. This research highlights the need to address these vulnerabilities through the development of robust security protocols, aiming to create a more secure IoT ecosystem and enhance user trust in this technology. The objective of the research is the development of an innovative IoT security protocol; High-Accuracy Device Identification and Resilience Against Credential Compromise (HADIRACC). This paper contributes significantly to enhancing the security and reliability of the IoT ecosystem. The research methods employed encompass the development of security protocols, the development of a proximity-based solution, and the classification of IoT devices using data processing techniques and machine learning-based classification. This study involves the collection and pre-processing of datasets, training different classifiers using 70% of the dataset, and testing the classifiers using the remaining 30%. The proposed protocol can effectively enhance the security of IoT devices by addressing various scenario-based attacks. Furthermore, the results of the analysis of the five classifiers used in this study indicate that Random Forest has the highest F1 score accuracy, reaching 88.8%. This suggests that Random Forest, as a classifier, can make the most accurate predictions compared to other classifiers.