web application firewalls: what the vendors do …...web application firewalls: what the vendors do...

35
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation and http://www.owasp.org Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity [email protected] Wendel G. Henrique Trustwave [email protected]

Upload: others

Post on 07-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

Copyright © The OWASP FoundationPermission is granted to copy, distribute and/or modify this document under the terms of the OWASP License.

The OWASP Foundation

OWASPEU09 Poland

http://www.owasp.org

Web Application Firewalls: What the vendors do NOT want you to know

Sandro Gauci [email protected]

Wendel G. [email protected]

Page 2: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

2OWASP AppSecEU09 Poland

$ whois WendelGHenrique

PT Consultant at Trustwave's SpiderLabs.

Over 7 years in the security industry.

Vulnerability discovery Webmails, AP, Citrix, etc.

Spoke in YSTS 2.0, Defcon 16, H2HC and others.

Affiliated to Hackaholic team.

Page 3: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

3OWASP AppSecEU09 Poland

$ whois SandroGauci

Founder and CSO EnableSecurity.

VOIPPACK (CANVAS addon).

Security research papers.

SIPVicious and SurfJack.

Over 9 years in the security industry.

Page 4: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

4OWASP AppSecEU09 Poland

Introduction

WAF - Web Application Firewall.

Can be identified, detected.

Security software is not necessarily secure.

Page 5: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

5OWASP AppSecEU09 Poland

What is WAF

WAFs are often called 'Deep Packet Inspection

Firewall'.

Some WAFs look for attack signatures while others look for abnormal behavior.

WAFs products: software or hardware appliance.

Page 6: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

6OWASP AppSecEU09 Poland

What is WAF

WAFs can be installed as a reverse proxy, embedded or connected in a switch (SPAN or RAP).

Nowadays many WAF products detect both inbound and outbound attacks.

Page 7: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

7OWASP AppSecEU09 Poland

Who uses WAF?

Many banks around the world.

Companies which need high protection.

Many companies in compliance with PCI DSS (Payment Card Industry - Data Security Standard).

Page 8: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

8OWASP AppSecEU09 Poland

Operation Modes:

Negative model (blacklist based).

Positive model (whitelist based).

Mixed / Hybrid (mix negative and positive model protection).

Page 9: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

9OWASP AppSecEU09 Poland

Operation Mode: Negative

A negative security model recognize attacks by relying on a database of expected attack signatures.

Example:

Do not allow in any page, any argument value (user input) which match potential XSS strings like <script>, </script>, String.fromCharCode, etc.

Page 10: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

10OWASP AppSecEU09 Poland

Operation Mode: Positive

A positive security model enforces positive behavior by learning the application logic and then building a security policy of valid know good requests.

Example:

Page news.jsp, the field "id" only accept numbers [0-9] and starting at 0 until 65535.

Page 11: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

11OWASP AppSecEU09 Poland

Common Weaknesses

Bad design.

Bad implementation.

Vulnerable to the same flaws they intend to protect.

Page 12: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

12OWASP AppSecEU09 Poland

Detection

Cookies: Some WAF products add their own cookie in the HTTP communication.

Page 13: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

13OWASP AppSecEU09 Poland

demo

Page 14: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

14OWASP AppSecEU09 Poland

Detection

Header Rewrite: Some WAF products allow the rewriting of HTTP headers. The most common field is "Server", this is used to try to deceive the attackers (server cloaking).

Example: Connection might be changed to Cneonction or

nnCoection.

Page 15: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

15OWASP AppSecEU09 Poland

demo

Page 16: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

16OWASP AppSecEU09 Poland

Detection

Different 404 error codes for hostile and non existent pages.

Different error codes (404, 400, 401, 403, 501, etc) for hostile parameters (even non existent ones) in valid pages.

Page 17: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

17OWASP AppSecEU09 Poland

demo

Page 18: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

18OWASP AppSecEU09 Poland

Detection

WAF systems leave several signs which permit us to detect them, one of them are Drop Connection:

Example: Drop Action: Immediately initiate a "connection

close" action to tear down the TCP connection by sending a FIN packet.

Page 19: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

20OWASP AppSecEU09 Poland

Detection

WAF systems leave several signs which permit us to detect them, one of them are Pre Built-in Rules:

Pre Built-in Rules: All (at least all that we know) WAF systems have a built-in group of rules in negative mode, these rules are different in each products, this can help us to detect them.

Page 20: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

22OWASP AppSecEU09 Poland

Detection

You should be thinking…

It’s so boring.

We have to know a lot of products to identify them correctly.

What about create a tool for that?

Page 21: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

23OWASP AppSecEU09 Poland

WAFW00F

That’s our answer for your prays:

Detect over 20 different WAF products.

Do not stop at the first WAF system found.

Follow HTTP redirects to identify more systems.

Much more coming soon.

Page 22: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

24OWASP AppSecEU09 Poland

Page 23: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

25OWASP AppSecEU09 Poland

demo

Page 24: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

26OWASP AppSecEU09 Poland

Bypassing

WAF systems can be bypassed by changing the attack to do not match the rules:

Detect allowed / denied strings.

Detect sequences of good and bad strings together.

Modify your attack to match the good rules.

Page 25: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

28OWASP AppSecEU09 Poland

Bypassing

WAF systems allow us to bypass them in different ways, one of them are using old tricks like encoding and language support:

Spaces, comments, case sensitive mutation, Unicode, etc.

The web server can parse, decode and interpret and HTTP request differently from the WAF.

Page 26: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

30OWASP AppSecEU09 Poland

Bypassing

WAF systems allow us to bypass them in different ways, one of them are using the flexibility of the web languages:

HTML and JS is very flexible.

Example: XSS Case.

Page 27: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

31OWASP AppSecEU09 Poland

demo

Page 28: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

32OWASP AppSecEU09 Poland

Bypassing

WAIT!

What about positive model?

They are really secure?

If we find a positive model we should give up?

Page 29: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

33OWASP AppSecEU09 Poland

demo

Page 30: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

34OWASP AppSecEU09 Poland

Bypassing

You should be thinking…

It’s time consuming.

The are so much different techniques to remember.

There are so many specific techniques product dependent.

What about a tool for that?

Page 31: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

35OWASP AppSecEU09 Poland

WAFFUN

That’s our answer for your prays:

Test the target and point weakness in the WAF system.

Use with WAFW00F for better results.

Working in Windows and Unix.

Beta version! We need the community help.

Page 32: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

36OWASP AppSecEU09 Poland

demo

Page 33: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

37OWASP AppSecEU09 Poland

Other Vulnerabilities

XSS (in the own WAF system?)

Overflows

DoS

Page 34: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

38OWASP AppSecEU09 Poland

demo

Page 35: Web Application Firewalls: What the vendors do …...Web Application Firewalls: What the vendors do NOT want you to know Sandro Gauci EnableSecurity sandro@enablesecurity.com Wendel

39OWASP AppSecEU09 Poland

Thank you!

Do you have ideas / resources to improve our tools?

Do you just don’t have with who talk?

wsguglielmetti [em] gmail [ponto] com

sandro [em] enablesecurity [ponto] com