To run a Web site, your Web server must at least have port 80 open to process HTTP requests for Web pages. Unfortunately,
attackers can modify or manipulate these requests to cause the server problems or to trick it into revealing valuable information. By using an HTTP request, an attacker has a legitimate path to your Web server and therefore can easily bypass firewalls and other security measures to initiate an attack.
There are two common HTTP attacks. One involves sending a long URL to a Web server with the goal of triggering a buffer overflow. The other attack is the SQL injection, which is the process of sending appended SQL commands to a URL to gain access to the backend database. Attackers often use forms to perform these attacks, as they both look to exploit poorly-written applications using unexpected, user-submitted data to initiate the attack. This means all user input data needs to be checked before being sent to another process. For example, if input data is used to build a Web page or is retrieved from a database, it must be checked before being published to ensure that any erroneous data is removed and the code runs correctly.
To prevent these types of attack, your organization's application security strategy should include the following:
- Continual testing for technical and logical vulnerabilities during the development cycle. Two approaches to this are dynamic analysis and static analysis. Dynamic analysis involves actually running the software. Static analysis involves analyzing the software without executing it, which offers the benefit of performing the test earlier in the development cycle.
- Develop procedures for completing component-level integration testing, system integration testing, and application function and deployment testing. While this may seem onerous, Gartner estimates that the cost of removing a vulnerability during testing is less than 2% of the cost of removing it from a production system.
- Make sure you include change management, because the change rate in Web application code is normally high, which rapidly reduces the relevance of existing security reviews. In order to evaluate the impacts of any changes on overall system application security, the security assessment process should always be repeated when the business logic in the application changes.
- Ensure proper training of developers. While training developers to write secure code doesn't necessarily mean the code they write will be secure, the more they understand how Web servers and browsers interact, and the protocols used in Internet communications, the more likely they are to build applications that aren't vulnerable to these attacks. Microsoft, in partnership with SPI Dynamics, is running an application development security awareness campaign and is providing free webcasts and workshops.
Here are 11 rules that developers should follow during any Web application development cycle:
- Never trust user supplied data
- Clean and validate all user input
- Validate data on the server
- Use taint checking or .NET validation controls
- Use POST instead of GET
- Avoid the use of HIDDEN form fields
- Locate different file types in separate directories
- Use absolute path and filenames
- Open files as read-only where possible
- Keep up to date on the latest attack methods
About the author:
Michael Cobb, CISSP-ISSAP is the founder and managing director of Cobweb Applications Ltd., a consultancy that offers IT training and support in data security and analysis. He co-authored the book IIS Security and has written numerous technical articles for leading IT publications. Mike is the guest instructor for SearchSecurity's Web Security School and, as a SearchSecurity.com site expert, answers user questions on application and platform security.