what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

ModSecurity 2.5.9 Filter Bypass

ModSecurity 2.5.9 Filter Bypass
Posted Jun 11, 2009
Authored by Lavakumar Kuppan

ModSecurity versions 2.5.9 and below using ModSecurity Core Rules versions 2.5-1.6.1 and below suffer from a HPP filter bypass vulnerability.

tags | exploit, bypass
SHA-256 | 2f61c414417e494073857e6cf0e2a2326c2b1a0f0799ba9d2d5afabe77938145

ModSecurity 2.5.9 Filter Bypass

Change Mirror Download
  ========================================================================
ModSecurity (Core Rules) HPP Filter Bypass Vulnerability
========================================================================

Affected Software : ModSecurity <= 2.5.9 using ModSecurity Core Rules <= 2.5-1.6.1
Author : Lavakumar Kuppan - lavakumar[dot]in[at]gmail[dot]com
Advisory URL : http://www.lavakumar.com
Severity : High
Local/Remote : Remote

[Vulnerability Details]

Modsecurity is an Open source Web Application firewall which runs as an Apache
module. It has a comprehensive set of rules called 'ModSecurity Core Rules' for common web application
attacks like SQL Injection, Cross-Site Scripting etc.

It is possible to bypass the ModSecurity Core Rules due to the difference in behaviour
of ModSecurity and ASP/ASP.NET applications in handling duplicate HTTP GET/POST/Cookie
parameters. Using duplicate parameters has been termed as HTTP Parameter Pollution by Luca Carettoni
and Stefano Di Paola.

When multiple GET/POST/Cookie parameters of the same name are passed in the HTTP request
to ASP and ASP.NET applications they are treated as an array collection.
This leads to the values being concatenated with a comma inbetween them.

For example when the following query is sent to the server:
-----------------------------
POST /index.aspx?a=1&a=2
Host: www.example.com
Cookie: a=5; a=6
Content-Length: 7

a=3&a=4
-----------------------------

The server side interpretation of this data is as follows:

Request.Params["a"] --> "1,2,3,4,5,6" ( if "a" was registered as a server-side control ) (ASP.NET Only)
Request.Params["a"] --> "1,2,5,6" ( if "a" was not registered as a server-side control ) (ASP.NET Only)
Request.QueryString["a"] --> "1,2" (ASP and ASP.NET)
Request.Form["a"] --> "3,4" (ASP and ASP.NET)

This behaviour is unique to ASP and ASP.NET applications and ModSecurity does not interpret this data in the
same way. When dealt with multiple parameters of the same name ModSecurity matches the value of each instance
of the parameter seperately against its rule base. Incase of the above example ModSecurity would run '1' against
the rule set first then '2' and so on till '6'.

Since data is interpreted differently by the Web Application and the Firewall this produces intresting possibilities
for a filter bypass scenario.

This theory was tested against the SQL Injection rule base of ModSecurity Core Rules and was found to bypass the
default-enabled rule set successfully.

The following request is blocked by ModSecurity as this matches its Generic SQL Injection Attack rule.

http://example.com/search.aspx?value=select 1,2,3 from table

ModSecurity Interpretation:
value = select 1,2,3 from table
Web Application Interpretation:
value = select 1,2,3 from table

However the same payload can be sent to the server by splitting it using duplicate parameters like below.

http://example.com/search.aspx?value=select 1&value=2,3 from table

ModSecurity Interpretation:
value = select 1
value = 2,3 from table
Web Application Interpretation:
value select 1,2,3 from table

The attack can be made more flexible by using the inline comment feature in MS SQL servers.

http://example.com/search.aspx?value=select/*&value=*/1,2,3/*&value=*/from/*&value=*/table

ModSecurity Interpretation:
value=select/*
value=*/1,2,3/*
value=*/from/*
value=*/table
Web Application Interpretation:
value = select/*,*/1,2,3/*,*/from/*,*/table

This technique could possibly be extended to exploit other types of Web Application vulnerabilities as well.

Refer the whitepaper 'Split and Join' (see references) for more details on this attack.

[Fix Information]

N/A

[References]

http://www.lavakumar.com/Split_and_Join.pdf
http://www.owasp.org/images/b/ba/AppsecEU09_CarettoniDiPaola_v0.8.pdf

[Legal Notices]

The information in the advisory is believed to be accurate at the
time of publishing based on currently available information.
This information is provided as-is, as a free service to the community.
There are no warranties with regard to this information.
The author does not accept any liability for any direct,
indirect, or consequential loss or damage arising from use of,
or reliance on, this information.
Permission is hereby granted for the redistribution of this alert,
provided that the content is not altered in any way, except
reformatting, and that due credit is given.

This vulnerability has been disclosed in accordance with the RFP
Full-Disclosure Policy v2.0, available at:
http://www.wiretrip.net/rfp/policy.html



Login or Register to add favorites

File Archive:

May 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    44 Files
  • 2
    May 2nd
    5 Files
  • 3
    May 3rd
    11 Files
  • 4
    May 4th
    0 Files
  • 5
    May 5th
    0 Files
  • 6
    May 6th
    28 Files
  • 7
    May 7th
    3 Files
  • 8
    May 8th
    4 Files
  • 9
    May 9th
    54 Files
  • 10
    May 10th
    12 Files
  • 11
    May 11th
    0 Files
  • 12
    May 12th
    0 Files
  • 13
    May 13th
    17 Files
  • 14
    May 14th
    11 Files
  • 15
    May 15th
    0 Files
  • 16
    May 16th
    0 Files
  • 17
    May 17th
    0 Files
  • 18
    May 18th
    0 Files
  • 19
    May 19th
    0 Files
  • 20
    May 20th
    0 Files
  • 21
    May 21st
    0 Files
  • 22
    May 22nd
    0 Files
  • 23
    May 23rd
    0 Files
  • 24
    May 24th
    0 Files
  • 25
    May 25th
    0 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close