The primary deterrent to the implementation of distributed cognitive radios for many years has been their vulnerability to a number of physical layer attacks. In particular, attacks exploiting the spectrum sensing phase of the cognition cycle have been identified as highly susceptible. This paper presents a method to diagnose and neutralise one such attack, the spectrum sensing data falsification (SSDF) attack. We propose a belief propagation based statistical reputation function (BPB-SRF). BPBSRF is able to statistically analyse spectrum sensing information from a transmitter and identify the legitimacy of the data. We introduce a trust factor between pairs of users, which is implemented through a dynamic reputation function. In addition, we define two new types of attack: a data mining attack and a reset attack. We introduce a probation period and a random back off period to combat these attacks. The BPBSRF method is an effective, yet efficient method that was designed to be used in distributed networks where users are limited in power and computational complexity.