rgielen / struts1filter

A request parameter filter solution for Struts 1 CVE-2014-0114 based on the work of Alvaro Munoz and the HP Fortify team
Apache License 2.0
12 stars 8 forks source link

pattern.matcher returns false #4

Open bhayanisohil opened 9 years ago

bhayanisohil commented 9 years ago

pattern.matcher(parameterName).matches() line returns false when "][]Class][<>" is passed as parameterName. I am not sure if this is a code issue or testing issue. Please provide some guidance on how to test classloader manipulation issue.

pwntester commented 9 years ago

Hi,

That parameter name should not be a problem since it cannot dereference the class property. In order to access the class property you need to use:

Thats why the regular expression checks for the single or double quotes

Cheers, A

bhayanisohil commented 9 years ago

Hi,

test/#$".class as well as test&(){]['class'] also returns false. It would be great if you can provide me with couple of values that would return true.

Thanks, Sohil

pwntester commented 9 years ago

The regexp looks like:

We are trying to protect access to the class.classloader property, so values that return true are:

xxx.class.classloader
xxx['class'].classloader
xxx['class']['classloader']
...

Note: xxx is the name of one of the action public properties.

This regular expression is the one used by Struts2 paramterInterceptor to protect from classloader manipulation

bhayanisohil commented 9 years ago

we are using struts 1 in our application. I am using debug mode in eclipse and changing the value of the parameter as you suggested in above comment but still no luck. Currently I am using below regex: (..|^|.|[('|"))(c|C)lass(.|('|")]|[).,^dojo..,^struts..,^session..,^request..,^application..,^servlet(Request|Response)..,^parameters..,^action:.,^method:. I have also tried using below regex but same issue: (..|^|[('|"))(c|C)lass(.|('|")]|[). Can you guide which is the correct regex?

pwntester commented 9 years ago

(.*\\.|^|.*|\\[('|\"))(c|C)lass(\\.|('|\")]|\\[).*