Improving Web Application Security: Threats and Countermeasures