Wireless Sensor Networks (WSNs) are emerging as a rich field of active research that is involved different aspects. Nowadays, sensors are used in many domains as applications that can monitor and control. These domains include applications such as environmental, home, commercial, military, health, etc. WSNs are used in numerous applications that involves sensitive information needs to be secure and confidential. Especially in applications that deal with top secret information such as military applications. Therefore, the important of security issues in WSNs have received potential attention from designers, developers, and security professionals. Moreover, this type of network is highly vulnerable to numerous security attacks due to its resource constraints and mobility. This paper gives comprehensive details in WSN constraints, vulnerabilities, and security attacks. In addition, the paper investigates the recent countermeasures that are used to counter WSN attacks in terms of their achievements and limitations. The paper concludes that security is the key to success for WSN applications, However, still many critical security problems are remained unsolved. Moreover, when designing an adequate security solution; productivity, usability, mobility, resource constraints and privacy preservation should all be taken into account. Therefore, a huge challenge still facing researchers and designers to bring up sufficient solutions to secure WSN applications.