In this paper, we analyze the effect of the wormhole attack on shortest-path routing protocols for wireless ad hoc networks. Using analytical and simulation results, we show that a strategic placement of the wormhole when the nodes are uniformly distributed can disrupt/control on average 32% of all communications across the network. We also analyze a scenario in which several attackers make wormholes between each other and a case where two malicious nodes attack a target node in the network. We show how to evaluate the maximum effect of the wormhole attack on a given network topology. Then, we compute the maximum effect of the wormhole attack on grid topology networks and show that the attackers can disrupt/control around 40% to 50% of all communications when the wormhole is strategically placed in the network. Finally, to defend against the wormhole attack, we propose a timing-based countermeasure that avoids the deficiencies of existing timing-based solutions. Using the proposed countermeasure, the nodes do not need synchronized clocks, nor are they required to predict the sending time or to be capable of fast switching between the receive and send modes. Moreover, the nodes do not need one-to-one communication with all their neighbors and do not require to compute a signature while having to timestamp the message with its transmission time.