SpiderLabs Blog

ModSecurity Life cycle

Written by SpiderLabs Anterior | Oct 22, 2010 9:03:00 AM

We are proud to announce the new release 2.5.13 is under development and will be released next month! it will be the last release of 2.5 series and will fix some important issues reported by the community.
Also we decided to release two new important features for the community:

* New setvar Lua API

The new hook can be used to push back data from a Lua script to ModSecurity.As an example let's suppose you wanna change all single quotes (') present into request arguments by quotes (")

/etc/modsecurity/example_setvar.lua:

require('m')

function main()
-- Start Converter code
-- Retrieve all parameters
vars = m.getvars("ARGS", "none", "urlDecodeUni");
-- Examine all variables
for i = 1, #vars do
value = (vars[i].value);
m.log(4, "value is: " .. value .. ".");
tmp_value = string.gsub(value, "\'", "\"");
m.log(4, "tmp_value is: " .. tmp_value .. ".");

m.setvar("tx.QuoteDecoded",tmp_value);
return ("Normalized Payload: " .. vars[i].name .. " = " .. tmp_value .. "");
end
-- Nothing wrong found.
return nil;
end

So, the new QuoteDecoded variable can be accessed by getvar Lua hooks or/and by a SecRule and be used in another rule and/or scripts.

ie: SecRule TX:QuoteDecoded

* New base64 transformation function base64DecodeExt

Some months ago a researcher called Stefano Di Paola posted in his blog a method that can be used to bypass WAFs protections by sending malicious data encoded with base64 plus special characters.
Most applications will recognize this malicious traffic as an invalid base64, but some others (ie. based on PHP) will skip the invalid characters and will decode the data. We know, analyzing the user survey, that most ModSecurity users are protecting PHP applications, for this reason we decided to create a new transformation function called base64DecodeExt which will decode base64 data skipping special characters.

We are going to update our documentation to provide more information and examples about advanced ModSecurity features (GeoIP, Lua API …).

After the last 2.5 release we are going to start the new 2.6 series, which already has a big list of features and issues to solve. I'm going to publish the new 2.6 roadmap soon here in this blog.
Thinking more in the future, for medium (2.7, 2.8 and 2.9 series) and long term (3.0) we are looking for interesting features like:

* More sophisticated DDoS detection engine
* Positive security model (Learning)
* Expand Lua API
* Cuda Support
* Provide an API to de-attach Modsecurity from Apache and plug in other
applications (IDS/IPS, Firewalls etc)
* Unicode Mappings
* More transformation functions
… And a lot of more

Also In a near future i'm going to write a new post about current ModSecurity source code organization and code style. So, anybody in the community who want to contribute will be well accepted!

Thanks for your attention