Though the security of wireless sensor networks (WSNs) has been studied deeply, the inside attacks still are very difficult to defend. The inside attacks are not detectable with only the classic cryptographic techniques and the attacks mainly include two types of attack: exceptional message attack and abnormal behavior attack. In this paper, we present an inside attacker detection approach, which can efficiently defend these two types of attack. On the one hand, we distinguish the exceptional message using spatiotemporal correlation and consistency in some spatial granularity (e.g. in one cluster); on the other hand, we evaluate the node behavior via a frequency mechanism. Simulation results indicate that our approach can efficiently detect and defend the inside attacker.