We consider cooperative spectrum sensing based on energy detection. The performance of cooperative spectrum sensing is largely degraded if there are some malfunctioning sensing devices. As methods to mitigate the effects of malicious nodes on cooperative spectrum sensing, pre-filtering and weighting of sensing data are shown to be effective. As malicious nodes, three types of the nodes that regularly produce false values far above or below the threshold have been considered. However, anything other than the three kinds of malicious nodes has not been considered. In this paper, we present techniques to identify not only malicious nodes that give false values far above or below the threshold but also malicious nodes that give false values slightly above or below the threshold or random false values, and to mitigate their harmful effects on the cooperative spectrum sensing. By results of simulations, we show that the proposed algorithm can identify all those malicious nodes, and can mitigate their harmful effects.