The Internet of Things (IoT) will not only connect computers and mobile devices but also interconnect smart buildings, homes, and cities, as well as electrical grids, gas, and water networks, automobiles, airplanes, etc. IoT will lead to the development of a wide range of advanced information services that need to be processed in real time and require large storage and computational power. The integration of IoT with fog and cloud computing not only brings the computational requirements but also enables IoT services to be pervasive, cost‐effective, and accessible from anywhere and at anytime. In any IoT application, sensors are indispensable to bring the physical world into the digital world that can be implemented by leveraging fog computing. However, IoT sensors will introduce major security challenges as they contribute to a significant increase in the IoT attack surface. In this paper, we present a methodology to develop an intrusion detection system on the basis of anomaly behavior analysis to detect when a sensor has been compromised and used to provide misinformation. Our preliminary experimental results show that our approach can accurately authenticate sensors on the basis of their behavior and can detect known and unknown sensor attacks with high detection rate and low false alarms.