A mobile node in ad hoc networks may move arbitrarily and acts as a router and a host simultaneously. Such a characteristic makes nodes in MANET vulnerable to potential attacks. The black hole problem, in which some malicious nodes pretend to be intermediate nodes of a route to some given destinations and drop any packet that subsequently goes through it, is one of the major types of attack. In this paper, we propose a distributed and cooperative mechanism to tackle the black hole problem. The mechanism is distributed so that it can fit with the ad hoc nature of network, and nodes in the protocol work cooperatively together so that they can analyze, detect, and eliminate possible multiple black hole nodes in a more reliable fashion. Simulation results show that our method achieves a high black hole detection rate and good packet delivery ratio, while the overhead is comparatively lower as the network traffic increases.