In this work, we address the question of how to enable a system to operate despite the presence of misbehavior. Specifically, in a mobile ad-hoc network, how can we keep the network functional for normal nodes when other nodes do not route and forward correctly? Node misbehavior due to selfish or malicious reasons or faulty nodes can significantly degrade the performance of mobile ad-hoc networks. Existing approaches such as economic incentives or secure routing by cryptographic means alleviate some of the problems, but not all. For instance, nodes can still forward packets on bogus routes. We propose a protocol called CONFIDANT (Cooperation Of Nodes --- Fairness In Dynamic Ad-hoc NeTworks) to cope with misbehavior. It enables nodes to detect misbehavior by first-hand observation and use of second-hand information provided by other nodes. The view a node has about the behavior of another node is captured in a reputation system, which is used to classify nodes as misbehaving or normal. Once a misbehaving node is detected, it is isolated from the network. Reputation systems can, however, be tricked by the spread of false reputation ratings, be it false accusations or false praise. Simple solutions such as exclusively relying on one`s own direct observations have drawbacks, as they do not make use of all the information available. To solve this problem, we propose a fully distributed reputation system that can cope with false information and effectively use second-hand information in a safe way. Our approach is based on a modified Bayesian estimation and classification procedure. In our approach, each node maintains a reputation rating and a trust rating about all other nodes it cares about. Reputation ratings capture the quality of the behavior of a node as an actor in the network performing routing and forwarding tasks. From time to time first-hand reputation information is exchanged with others; using a modified Bayesian approach we designed, second-hand reputation information is only accepted if it is compatible with the current reputation rating. Reputation ratings are only slightly modified by accepted information. Trust ratings capture the quality of a node as an actor in the reputation system and reflect whether the reported first hand information summaries published by node are likely to be true. Trust ratings are updated based on the compatibility of second-hand reputation information with prior reputation ratings. We enable node redemption and prevent the sudden exploitation of good reputation built over time by introducing reputation fading. Data is entirely distributed, the reputation and trust value of a node is the collection of ratings maintained by others. We use simulation to evaluate and demonstrate the performance. We found that CONFIDANT can keep the network performance high even when up to half of the network population misbehaves. We show that our approach of using second-hand information significantly speeds up the detection of misbehaving nodes while keeping the number of false positives and negatives negligibly low.