Due to their diverse applications, ad hoc networks are appealing for use in many domains. However, their features of open medium, absence of infrastructure, dynamic changing network topology, cooperative algorithms, lack of centralized monitoring and management point, resource constraints and lack of a clear line of defense, they are vulnerable to many attacks. Therefore, there is a major concern about their security. Amongst attacks we are particularly interested in a severe attack called the wormhole attack. In this paper, we propose a scheme for the wormhole attack detection and prevention