How to Build a Secured ASP.Net Website?
In coming section, we will see more about the below
security threats and different ways to prevent the same.
Code Injection Attacks
Session Hijacking
Identity spoofing
Network
eavesdropping
Information
disclosure
Web Security
Testing
Free Web Security
Testing Tools
Code Injection Attacks
This is one of the very common attacks where a malicious
user can inject some arbitrary scripts into our application. The injected code
will then get executed in the application identity to do the intended damage.
Sql Injection and Cross Site Scripting (XSS) attacks are
the 2 common attacks under this category. Read the below codedigest articles to
know more about these attacks and preventing it.
What
is SQL Injection Attack? How to prevent SQL Injection in ASP.Net?
What
is Cross-Site Scripting (XSS) attack? How to prevent XSS attack in
ASP.Net?
Session Hijacking
Session is a unique identifier generated by a web
application to identify a connected/authenticated user. These identifiers are
often stored in cookies and urls that travel forth and back the web server. In
this attack, an attacker can steal a user’s session id and connect to the
website with that session. The web application will receive the attacker’s
request and will allow the attacker to access anything the user has access to.
How it is done?
1. An attacker can use XSS attack
and inject some scripts which will then send the cookie information to the
attacker. This specific attack where an attacker hijacking a user’s cookie is
called Cookie Replay attack.
2. An attacker can use some
network sniffer tools and get the sensitive data that gets transported in the
network from the website. This is commonly called as Network eavesdropping.
How to prevent Session Hijacking?
1. Prevent Cross-Site Scripting
vulnerability in your websites. Read the above article.
2. Prevent storing some secured
information in Hidden Fields, Query Strings, View State, Form Fields, etc. This
is called Web Parameter Tampering or Parameter manipulation attack.
3. Always use SSL certificates
(https) on authentication pages and in the modules which does some secured
transactions.
4. Don’t allow multiple users to
connect to the same session from different machines. You can do this by
restricting user to connect only from one IP.
5. Re-Authenticate users when
doing secured transactions.
6. Verify the user by asking some
security verification questions when doing secured transactions.
Identity spoofing
Identity spoofing is a mechanism where an attacker
steals the identity of an existing user of your application and gaining access
to restricted sections. This is normally done by guessing the username and
password, stealing username and password in non-SSL communication link.
How it is done?
1. Guessing the username and
passwords. The attacker can use Brute force attack or Dictionary attack to do
this. This will happen when there is no password policy implemented in your
websites.
2. Using network sniffer tools to
read the protected data sent over non-SSL communication links i.e. Network
eavesdropping attack.
3. Using Sql Injection attack. An
attacker can get the username and password in application when the application
stores password as clear text in database.
How to prevent Identity Spoofing?
1. Have a strong password policy.
For example, accept the passwords that have at least one number and a symbol
with a minimum length of 8 characters when registering the user.
2. Always use SSL certificates
(https) on authentication pages and in the modules that does some secured
transactions.
3. Prevent code injection
attacks.
4. Display last visited time and
the IP from where the user visited to ensure when re-authenticating to the site.
This will enable users to reset the password when there is a suspicion.
5. If required, make the users to
change the password every 3 months as part of password policy.
Web Parameter
Tampering or Parameter manipulation
Form fields, View State, Query String are vulnerable to
this attack. A malicious user can get hold of the sensitive information that is
sent through these parameters and can exploit your application.
How it is done?
1. Using network sniffer tools to
read the protected data sent over non-SSL communication links i.e. Network
eavesdropping attack.
2. An attacker can steal the
session id from query string and gain access to restricted area.
3. An attacker can steal the
cookies and gain access to restricted area.
How to prevent Web Parameter Tampering or Parameter
manipulation?
1. Always use SSL certificates
(https) on authentication pages and in the modules that does some secured
transactions.
2. Don’t use persistent cookies
for storing authentication tokens (session ids).
3. As a user, don’t select
“Remember password” option in Logon screen in a public computer.
Network eavesdropping
An attacker can use some network monitoring tools to
obtain some sensitive data from the data packets sent between web server and the
user.
How it is done?
Using network sniffer tools to read the protected data
sent over non-SSL communication links i.e. Network eavesdropping attack.
How to prevent Web Parameter Tampering or Parameter
manipulation?
1. Always use SSL certificates
(https) on authentication pages and in the modules that does some secured
transactions.
2. Prevent storing some secured
information in Hidden Fields, Query Strings, View State, Form Fields, etc. This
is called Web Parameter Tampering or Parameter manipulation attack.
|