A Mobile Ad hoc Network (MANET) is a dynamic wireless network that can be formed infrastructure less connections in which each node can act as a router. The nodes in MANET themselves are responsible for dynamically discovering other nodes to communicate. Although the ongoing trend is to adopt ad hoc networks for commercial uses due to their certain unique properties, the main challenge is the vulnerability to security attacks. In the presence of malicious nodes, one of the main challenges in MANET is to design the robust security solution that can protect MANET from various routing attacks. Different mechanisms have been proposed using various cryptographic techniques to countermeasure the routing attacks against MANET. As a result, attacks with malicious intent have been and will be devised to exploit these vulnerabilities and to cripple the MANET operations. Attack prevention measures, such as authentication and encryption, can be used as the first line of defense for reducing the possibilities of attacks. However, these mechanisms are not suitable for MANET resource constraints, ie, limited bandwidth and battery power, because they introduce heavy traffic load to exchange and verifying keys. In this paper, we identify the existent security threats an ad hoc network faces, the security services required to be achieved and the countermeasures for attacks in routing protocols. To accomplish our goal, we have done literature survey in gathering information related to various types of attacks and solutions. Finally, we have identified the challenges and proposed solutions to overcome them. In our survey, we focus on the findings and related works from which to provide secure protocols for MANETs. However, in short, we can say that the complete security solution requires the prevention, detection and reaction mechanisms applied in MANET.