Home > Articles > Security > Network Security

Stateful Web Application Firewalls with .NET

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Close Window

Shreeraj Shah 

Learn more…

Sorry, this author hasn't posted any blogs.

A Web Application Firewall (WAF), though still evolving, is crucial for strong application layer defense. Unfortunately, HTTP is a stateless protocol, and session management is addressed at the application layer and not at the protocol layer. It is possible to bridge WAF and session objects on the .NET platform to build a stateful WAF (SWAF). Security expert Shreeraj Shah covers the concept, implementation, and deployment of SWAF.

A Web Application Firewall (WAF) is emerging as the first line of defense for Web applications. A WAF provides sound content filtering on both incoming and outgoing HTTP(S) traffic. Its working is simple: It looks for malicious attack vectors arriving at the Web application—vectors that can contain payloads for SQL injection, Cross-Site Scripting, LDAP, or OS command injection. WAF compares each incoming request with its own rule or signature database. Another important aspect of WAF is its logging and auditing capability, which is most useful in Web application forensics and activity measurement.

Problem Domain

A WAF is usually stateless and cannot provide session-based stateful defense for Web applications. WAF treats each incoming request independently without considering the state of the request. Each HTTP request arriving at the Web application may have states that can be defined by internal session variables. These states can be maintained over the network by using session cookies that are passed by the Web application to respective clients.

Here’s an example. Consider of the various banking transactions being carried out by a customer with a valid account. John makes a first request to his banking login page and gets a session cookie along with the login page. Simultaneously, the application creates a session variable login in memory and sets it to untrusted.

Now John makes a second request that includes his credentials (a username and password combination). The state of this request would be untrusted for the Web application. The application verifies the credentials against those stored in the backend SQL Server database and authenticates the user. The application then alters the state of the login variable in memory to successful and sets other session variables as well. In a similar manner, each incoming request may alter the state of the application depending on its logic. Subsequent HTTP requests would have different states.

To reiterate, each HTTP request can have a specific state, and these states can be mapped to internal session variables. But what if a rule set based on the state of the HTTP request needs to be built? One of the approaches to resolving this problem is to build a firewall module with access to session variables. Each incoming request can then be analyzed against this session-based rule set prior to being served the response.

Our objective here is to build a stateful WAF using HttpModule on the .NET framework.

  • Share ThisShare This
  • Your Account

Discussions

Stateful Web Application
Posted Sep 18, 2008 12:57 PM by rajpparmar
0 Replies

Make a New Comment

You must log in in order to post a comment.

Related Resources

Rick KughenTop 10 Things to Do with Your BlackBerry After Purchasing an iPhone
By Rick Kughen on August 30, 2010 No Comments

Are you the proud owner of a new iPhone? Have an old BlackBerry that you don't know what to do with? Never fear. Following are 10 ways you can still enjoy your Blackberry (albeit temporarily):

Seth FogieUsing Fake GPS Coordinates to Spoof Facebook Places
By Seth Fogie on August 20, 2010 No Comments

With the release of Facebook Places, there has been a lot of discussion around the privacy issues. Seth Fogie takes a another position and looks at Facebook Places as the perfect way to create an alibi by spoofing the coordinates that Facebook uses to determine where you are located.

Did You Know 4.0
By John Traenkenschuh on August 14, 2010 No Comments

There's an old video on You Tube that purports to be a true indicator of massive world changes.  What do you think of it?

See All Related Blogs

Informit Network