The wormhole attack, which is accomplished by selectively relaying packets between two adversaries, can ruin routing and communication of the network without compromising any legitimate nodes. There have been a few countermeasures against the wormhole attack in generic ad hoc networks, but they are not appropriate for sensor networks since they require special devices (e.g. directional antenna) or put much overhead on each node. In this paper, we propose a new countermeasure against the wormhole attack for sensor networks, named WODEM. In WODEM, a few detector nodes equipped with location-aware devices and longer-lasting batteries detect wormholes, and normal sensor nodes are only required to forward control packets from the detector nodes. Therefore, WODEM is efficient in cost and energy. From the simulation results, we show that 10 detector nodes can detect a wormhole within the accuracy of 90% in a densely deployed sensor network.