## 1 Introduction  
Population growth, climate change, and rising affluence leading to more resource-intensive diets all mean that today, global food security is seen as a major challenge. According to the United Nations' Food and Agriculture Organization (FAO), global food production needs to be increased by 70% in order to feeding 10 billion people by 2050 [1, 2]. Keeping pace with this growing demand for food while also working towards sustainable development requires new approaches to agriculture [2, 3]. To this end, different cutting edge technologies that use IoT are supporting food industries [4] and industrial agriculture [5]. However, the development in these industries and their applications brings about a broad range of security challenges [6, 7, 8]. Moreover, the increased population will cause constraints in terms of land and water that will encourage adoption of farming techniques designed to improve agriculture resource utilization and crop yield. Applying IoT technology is a viable solution towards increased efficiency to tackle the challenges facing modern agriculture. As a result, we are observing the emergence of Smart Farming (SF) and Precision Agriculture (PA). Recent literature comes with numerous research works focusing on SF [9, 10, 11] and PA [12, 13]. In general, both PA and SF refer to the use of modern technologies such as Internet of Things (IoT), drones, robotics and Artificial Intelligence (AI) in the control and management of farms in order to improve productivity and yield, while reducing input, land, and labor requirements. A typical multi-layer SF architecture is shown in Figure 1. This architecture has been used as the reference architecture in several research projects [14; 15; 16; 17]. In the architecture of Figure 1, the \"Cloud\", \"Network Communication\", \"Edge\" and \"Physical\" layers connect various smart IoT devices such as sensors and actuators as well as heterogeneous Cyber-Physical System (CPSs) to each other and to the internet [18; 19]. A SF platform with the architecture of Figure 1 collects data from IoT devices, and then forms, processes, and controls data to provide various applications as well as various access levels to the users [20; 21]. PA is distinct from SF in that it specifically refers to IoT-based approaches aiming at improving the efficiency of input use through providing farmers with tools that increase the granularity of decision making. In other words, PA is so sensitive and accurate that the minimum adversaries' activities simply can change the control system, target and damage valuable resources. Indeed, the PA is highly related to data and information of the system that can lead to costly, disruptive decisions and actions from the farmers via invalid data during run time. For instance, in terms of crops, PA allows farmers the ability to move from managing fields to tailoring management to square meters or even individual plants within fields. For livestock farmers, PA means using IoT to shift from flock/herd scale management to being able to manage the needs of individual animals. A wide range of enabling technologies such as fog computing [22], AI [23], Unmanned Aerial Vehicles (UAVs) [24; 25] and sensor networks [26] have been used to support both PA and SF. Especially, IoT can be considered as one of the most important technologies for SF [27; 28; 29] and PA [30] due to its capabilities of remote sensing and operation without human interference. However, these IoT-based technologies create new cyber-security vulnerabilities and cyber-threats [1; 3], which can be exploited to gain control on on-field actuators, sensors, and autonomous vehicles such as tractors, drones, sprayers, and planters, Refs. [1; 3; 31] as well as related databases and applications. A cyber-attack could have severe consequences on a farm. For instance, unauthorized changes to data could deceive a farmer to make changes that negatively influence the health of a herd. Poultry production relies  
Figure 1: A typical SF architecture.