Connected objects are one of the most important vectors for the collection of personal data. With the increase in data volumes, we are observing an increase in network vulnerabilities and data breaches.Data-centric security (DCS) and its related protocols such as the NATO STANAG 4774 have become a suited approach to address diverse data protection and secure information exchange. Despite the novelty of the approach, it comes with a challenge regarding its implementation to ensure the integrity of data in real scenario. In this paper, we are evaluating the NATO STANAG 4774 protocol when securing smart home data. Then, we use Random Forest to detect cyber attacks based on malware injection. We conduct an empirical study to evaluate the performance of our approach and we show how a machine learning technique can be used to ensure the integrity of data when using a data-centric security protocol. In fact, our proposed approach has a recall of 0.781 —in other words, it correctly identifies more than 78% of all malicious data injection.