Mobile Ad hoc Network (MANET) is a type of Ad hoc network. General properties of MANET open the network to various security threats. Network layer-based Active attacks are widespread and destructive. Available security solutions contain complex calculations. Therefore, the objective of this research is to propose a lightweight security mechanism to enhance the security of data communications between source and destination nodes in a MANET from network layer-based active attack. Blackhole is used as a network layer-based Active attack. The network performance is evaluated using Packet Delivery Ratio (PDR), Average End-to-End Delay (AEED), Throughput, and Simulation Processing Time at Intermediate Nodes (SPTIN). The controller network was used to compare the performance of each network. During the experiment due to the impact of the blackhole attack, compared to the controller network, the PDR was found to be 0.28%, AEED was infinity and Throughput was 0.33%. The performance of the proposed security mechanism was compared with that of the controller network, and the values of PDR, AEED, Throughput, and SPTIN were found to be 98.0825%, 100.9346%, 99.9988%, and 96.5660%, respectively. The data packet delivery ratio was 100.00% compared to that of the controller network. The network that was affected by a blackhole attack showed a higher amount of ADDR than the controller network and the lowest amount of PDR. The network that was affected by the blackhole showed underperformance compared to the controller network. The proposed security mechanism performs well in PDR, AEED, and Throughput compared to the controller network. The AEED and SPTIN values prove that the proposed solution is free from complex calculations. The scope of the solution can be expanded into a lightweight Intruder Detection System to handle different types of security attacks in MANETs.