Saturday, 2 February 2013

Top 10 Web Application Attacks

1. SQL Injection


SQL Injection is a type of web application security vulnerability in which an attacker is able to submit a database SQL command which is executed by a web application, exposing the back-end database.

How SQL injection is done ?


Consider the SQL code to get the username and password from the users table.The query will be executed if the name and password are valid.

 

 Using SQL Injection given below,an unauthorized user can view sensitive information .



 

 since '0=0' the query returns a true value thus an authorized user can easily see the information without giving the password.


How to prevent SQL Injection?


1. Prevent unnecessary database users and stored procedure
2. Parametrize the variable ( using 'PreparedStatement' in java).



2. Cross Site Scripting Attack(XSS)


XSS allows attackers to inject client side script into web pages. By injecting malicious scripts into web pages, an attacker can gain access-privileges to sensitive page content, session cookies, and a variety of other information maintained by the browser on behalf of the user.


How to prevent Cross Site Scripting?


It can be prevented by filtering and escaping  mechanism.In filtering mechanism 
the external data are passed through a filter which removes dangerous keyword such as JavaScript commands, CSS styles and other dangerous HTML markup.
In Escaping we are telling the browser that the data we are sending should be treated as data and should not be interpreted in any other way.

3. Buffer Overflow Attack


Hackers exploit buffer overflows by executing instructions and causing that code to overwrite adjacent memories. It can cause DOS attack and remote command execution.

How to prevent Buffer Overflow?


Bound checking within application is one way of preventing buffer overflow.

4. Session Hijacking


Session hijacking is exploiting of valid computer session to gain unauthorized access to services in a computer system.

How to prevent Session Hijacking?


Prevention 

1. Match connection with timestamp ,ip address etc
2. Encrypting the data which are transfered between the two entities
3. Using a long random number or string as session key


5. Source Code Disclosure


Here attacker can retrieve the source code of the web application. The code can then be used for further loopholes in the application.This occurs because of poor application design.

How to prevent Source Code Disclosure?


1.locking down web server configuration.
2.Secure coding practices.

6. Retrieving "non web " Files


Here the attacker can access "non web" application which includes zip files,text files,backup files etc.

How to prevent Retrieving "non web" Files?


One way to prevent is avoid presence of such files. The administrator should disable serving such file.

7. Directory Browsing


Here the attacker can retrieve complete directory listing within directories of the web server.This happens when the default document is missing.

How to prevent Directory browsing?


1.By locking down the web server configuration.
2.Disable serving of directory content.

8. Denial Of Service


This attack is making unavailable a resource (site, application, server) for the purpose it was designed. There are many ways to make a service unavailable for users by manipulating network packets, programming, logical, or resources handling vulnerabilities. If a service receives a very large number of requests, it may stop providing service to legitimate users. 


How to prevent Denial of Service?


1. Defines a Maximum Segment Life. This is the maximum amount of time to wait for an ACK in reply to a SYN-ACK or FIN-ACK, in milliseconds.
2. Through web application firewall inspects your HTTP traffic and checks their packets against rules so as to stop web applications from being exploited.


9. Server-Side-Include(SSI)

 
Here the attacker can send code to the web application which will later be executed in locally by the web server. This is done by injecting HTML scripts or any executable codes remotely.
 

How to prevent Server-Side-Include?

This can be prevented by controlling the type and size of character that are expected by the web server .


10. Cross-Site Request Forgery (CSRF)


Here the attacker tricks the victim into loading a page that contains a malicious request. It is malicious in the sense that it inherits the identity and privileges of the victim to perform an undesired function.



How to prevent Cross-Site Request Forgery?


1. Add a hash to URL and all forms.
2. Checking the referrer in the client's HTTP request will prevent CSRF attacks.



 




 

No comments:

Post a Comment