In wireless ad hoc networks, all its nodes behave as routers and take part in its discovery and maintenance of routes to other nodes. Thus, the presence of selfish or malicious nodes could greatly degrade the network performance and might even result in a total communication breakdown. However, the majority of ad hoc networks secure routing protocols assumed that all nodes participating in the network are cooperative to support different network functionalities and did not provide a complete solution against these attacks. In this paper, we propose a cooperative secure routing protocol based on reputation system (CSRAN) for wireless ad hoc networks to defend against these attacks efficiently. It is based on ARAN secure routing protocol and detailed analysis is given to show it proves to be more efficient and more secure than original ARAN secure routing protocol in defending against both malicious and authenticated selfish nodes.