Expand my Community achievements bar.

SOLVED

Need to block the below access in dispatcher file

Avatar

Level 2

Hi All,

As part of aem_hacker.py reports,requested us block the below access in our application.

bin/querybuilder.json.css
bin/querybuilder.feed.css
ibs/cq/security/userinfo.css
crx/de/index.jsp;%0aa.css


I have tried with the below deny rule in dispatcher.any file and it's not worked

 

  1. { /type "deny"  /url"/bin/querybuilder.feed.css" }
  2. { /type "deny"  /url"/bin/querybuilder.json.servlet;%0aa.css" }
  3. { /type "deny"  /url"/crx/de/index.jsp;%0aa.css" }
  4. { /type "deny" /path "/bin/querybuilder*" /selectors '(feed|servlet|json)' /extension '(css)'}
  5. { /type "deny" /url "*.userinfo.css"}
  6. { /type "deny" /url "/crx/*.css"
  7. { /type "deny" /path "/libs/*" }
  8. { /type "deny" /path "/bin/querybuilder*" }

Could you please suggest with solution to fix the hacker.py report issues ?

1 Accepted Solution

Avatar

Correct answer by
Level 2

We are also looking for a solution to block the querybuilder on publisher. 

 

We denied access to /bin. But we have to allow few extensions 

 

/0040 { /type "allow" /extension '(css|jpg|gif|ico|js|xml|txt)' }

 

We blocked CSS as below

 

/0120 { /type "deny" /path "/bin/querybuilder*" /selectors '(feed|servlet|json)' /extension '(css)'}

 

However following is accessible on another extension

https://aemsite/bin/querybuilder.json.jpg?path=/etc/cloudservices/application/&p.hits=full&p.lim...

 

Do we have to disallow querybuilder on all extensions which were allowed in /0040 rule. Any thoughts to do this little more deligently. 

 

 

 

 

 

View solution in original post

8 Replies

Avatar

Employee

The following rules have been tested in local setup. Please try below deny rules:

{ /type "deny" /url "/bin/querybuilder*.css" }
{ /type "deny" /url "/crx/*.css" }
{ /type "deny" /url "/bin/querybuilder*.*.css" }

 

Regards,

Vishu

Avatar

Employee Advisor
Hi Vishu, it may not be just css extension and not just querybuilder servlet. It could be all the allowed extensions like js, png etc combined with the servlet Url

Avatar

Employee Advisor

You need to make sure there is no other rule that allows thew access as the last dispatcher rule will be honoured. Example:

 

1) You denied access to files as part of a rule

2) If there is a rule below the rule at 1 that allows the access, users will be able to access that file.

 

 

Avatar

Level 2

We implemented with below rule to avoid querybuilder execution.

/0001

{
/type "deny"
/path "*/bin/querybuilder*"
/selectors "*"
/extension "*"
}

Avatar

Employee Advisor

Nice one, are you going to do the same for all the other exposed servlets
/libs/cq/security/userinfo
/libs/granite/security/currentuser

etc which can also be hacked above the deny rule with an extension or selector rules

Avatar

Correct answer by
Level 2

We are also looking for a solution to block the querybuilder on publisher. 

 

We denied access to /bin. But we have to allow few extensions 

 

/0040 { /type "allow" /extension '(css|jpg|gif|ico|js|xml|txt)' }

 

We blocked CSS as below

 

/0120 { /type "deny" /path "/bin/querybuilder*" /selectors '(feed|servlet|json)' /extension '(css)'}

 

However following is accessible on another extension

https://aemsite/bin/querybuilder.json.jpg?path=/etc/cloudservices/application/&p.hits=full&p.lim...

 

Do we have to disallow querybuilder on all extensions which were allowed in /0040 rule. Any thoughts to do this little more deligently. 

 

 

 

 

 

Avatar

Level 6

Hi @vivianseba ,

 

Some of these rules can still be bypassed by putting multiple slashes in the URL.

 

As per Adobe documentation: 

In Dispatcher versions later than 4.2.0, you can include POSIX Extended Regular Expressions in your filter patterns.

 

You might want to try something similar to the below rule (This takes care of the URL part. You can add extension if needed):

{ /type "deny" /url '([/]+bin[/]+querybuilder(.*))' }

 

As rightly mentioned earlier, a higher number in dispatcher doesn't mean higher priority. The rule that comes last always takes effect. So it is better to structure the filters in a way that there is nothing that allows these paths later on.

 

Thanks,

Ram