Skip to Content
Web Application Defender's Cookbook
book

Web Application Defender's Cookbook

by Ryan C. Barnett, Jeremiah Grossman
December 2012
Intermediate to advanced
552 pages
13h 16m
English
Wiley
Content preview from Web Application Defender's Cookbook
Recipe 14-8: Forcing an Application Logout
This recipe shows you how to use ModSecurity’s exec action to send a request to log the user out of the application.
Ingredients
  • ModSecurity
    • exec action
An excellent and highly underutilized response action is to forcibly log a user out of the application. This type of response action is ideal for postauthentication attack scenarios where malicious transactions are identified, such as suspected session hijacking attacks. Implementing a forced application logout makes the application SessionID invalid, and the attacker must reinitiate his attack to obtain a new SessionID from a victim.
The ModSecurity exec action allows you to externally execute any local script that you would like when a rule matches. With this ability, you can rather easily fire off a curl command from the local web server to spoof an application logoff request.
Profiling Application Logins/Logouts
To use an external curl request, you must first profile what an actual application logout request looks like. This is easy enough to do if you have the proper ModSecurity audit logging enabled. For demonstration purposes, we will use the WordPress application. When a user successfully logs into WordPress, she receives a response similar to the following:
HTTP/1.1 200 OK Date: Wed, 05 Sep 2012 19:40:06 GMT Server: Microsoft-IIS/7.0 Expires: Wed, 11 Jan 1984 05:00:00 GMT Last-Modified: Wed, 05 Sep 2012 19:40:07 GMT Cache-Control: no-cache, must-revalidate, max-age=0 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Web Site Cookbook

Web Site Cookbook

Doug Addison

Publisher Resources

ISBN: 9781118417058Purchase book