In wireless sensor networks (WSNs), sensor nodes are randomly distributed to transmit sensed data packets to the base station periodically. These sensor nodes, because of constrained battery power and storage space, cannot utilize conventional security measures. The widely held challenging issues for the network layer of WSNs are the packet-dropping attacks, mainly sinkhole and wormhole attacks, which focus on the routing pattern of the protocol. This thesis presents an improved version of the second level of the guard to the system, intrusion detection systems (IDSs), to limit the hostile impact of these attacks in a Low Energy Adaptive Clustering Hierarchy (LEACH) environment. The proposed system named multipath intrusion detection system (MIDS) integrates an IDs with ad hoc on-demand Multipath Distance Vector (AOMDV) protocol. The IDS agent uses the number of packets transmitted and received to calculate intrusion ratio (IR), which helps to mitigate sinkhole attacks and from AOMDV protocol round trip time (RTT) is computed by taking the difference between route request and route reply time to mitigate wormhole attack. MATLAB simulation results show that this cooperative model is an effective technique due to the higher packet delivery ratio (PDR), throughput, and detection accuracy. The proposed MIDS algorithm is proven to be more efficient when compared with an existing LEACH-based IDS system and MS-LEACH in terms of overall energy consumption, lifetime, and throughput of the network.