Internet of Things (IoT) devices are growing to be more than 20 billion by the end of 2020. IoT devices were evolved from wireless sensor networks (WSNs). IoT devices are applicable in numerous scientific fields and hence becoming a universal application for every need. Industry 4.0 is a result of the ever-growing IoT network. In IoT, sensor nodes are deployed and managed dynamically in the application/service layer of the IoT model and WSNs act as a network/communication layer, whereas WSNs with existing information and communication technology are enabling the continuous integration of the IoT devices and applications. WSNs are vulnerable to security attacks as they are deployed in hostile environments, hence affecting network performance and users’ security and privacy concerns. The ever-growing need for IoT devices for business value poses various security and privacy concerns for the end users. Several security challenges arise when heterogeneous sensors are integrated into the IoT network, but security needs to be considered from a global perspective. In this chapter, we have discussed the security requirements, challenges, and solutions of security problems prominent in WSNs, IoT networks, and cyber–physical systems (CPS). We have also determined and proposed a unified and scalable security framework for CPS encompassing the security and privacy issues in a CPS network.