A high level of security is required in the area of wireless sensor networks. Security in communication has become a major concern. The field of network security faces many challenges i.e. the ability to identify and prevent attacks on the network. Wireless Sensor Networks (WSNs) consist of sensor nodes deployed in a manner to collect information about the surrounding environment. Their distributed nature, multi-hop data forwarding and open wireless medium are the factors that make wireless sensor networks highly vulnerable to security attacks at various levels.