building your own waf as a service and forgetting about
play

Building Your Own WAF as a Service and Forgetting about False - PowerPoint PPT Presentation

Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner 1 About me Lead security developer @Booking.com Twitter: @89berner medium.com/@89berner 2 Building Your Own WAF as a Service and Forgetting


  1. Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner 1

  2. About me ● Lead security developer @Booking.com ● Twitter: @89berner ● medium.com/@89berner 2 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  3. WAF? ● Web Application Firewall ● Mainly used to protect against Application Attacks ● SQLi, RCE, Protocol Violations, Rate Limiting ... 3 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  4. Deployment mode - Inline ● Pros: ○ Traffic inspection ○ Ability to block ○ Transparent for web servers ● Cons: ○ Network placement ○ Latency 4 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  5. Deployment mode - Out of band ● Pros: ○ Traffic inspection ○ Transparent for web servers ○ Simpler network placement ● Cons: ○ Can’t block attacks ○ PFS 5 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  6. Deployment mode - Agent ● Pros: ○ Easier network placement ○ Simple to scale ● Cons: ○ More invasive on deployment environment ○ Can be less efficient on resource allocation 6 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  7. Deployment mode - Cloud ● Pros: ○ Simple to setup and scale ○ Network effect ● Cons: ○ Out of your control ○ Latency 7 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  8. Caveats with typical WAF Solutions ● Network placement ● False positive rate ● Lack of control from developers 8 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  9. A challenging environment ● No acceptance for false positives ● Reluctance towards commercial appliances ● Blocking could only happen through the Application ● Latency would not be acceptable 9 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  10. Building the WAF as a Service ● Removes false positives by having an understanding of the application context ● No need for an appliance, just add an API call ● Blocking behaviour is decided by the application ● Ability to avoid latency for regular users 10 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  11. How could you build one? ● Open source components already exist ● Creating a log processing pipeline ● Building a WAF API ● Library for logs and calling API 11 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  12. Study case: Simple web application ● Setup in Google Cloud ● Simple Flask Application ● Code available in github 12 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  13. Deployment mode? ● Let’s compare 13 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  14. Out of band mode 14 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  15. Inline mode 15 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  16. Every application is different ● Threat model ● FP tolerance ● Risk acceptance 16 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  17. Finding a middle ground ● Out of band mode removes latency concerns on users ● Inline mode provides security by blocking attacks ● Could we get the best of both worlds? 17 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  18. Hybrid mode 18 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  19. Components - Web application ● Can decide which mode to work on ○ Inline ○ Out of band ● Sends logs with partial request data encrypted Example: Flask API 19 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  20. Components - Agent ● Acts as a proxy to Web Application ● Minimal footprint ● Application agnostic ● Gets settings from application 20 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  21. Components - Agent 21 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  22. Components - Library ● Simpler to implement ● Will be tied to Application framework ● Inherent risks ● Strategy for this talk 22 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  23. Components - Historical database ● Historical activity ● Business value ● Patterns of behaviour for FP 23 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  24. Components - State store ● Allows to store configuration ● Ideally fast lookup for caching 24 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  25. Components - Log streaming ● Streaming pipeline ● Web requests are encapsulated and sent through it Google PusbSub 25 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  26. Components - Log processing ● Replays events not in line against WAF ● Calculates scores through windows of time Google Dataflow 26 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  27. Components - Log processing 27 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  28. Components - Log processing 28 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  29. Components - Log processing 29 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  30. Components - WAF service ● Pluggable architecture ● Parallel nature of their components ● Applications can decide how to react 30 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  31. Components - WAF service ● Open source components ○ Modsecurity ○ Naxsi 31 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  32. Components - WAF service ● Custom modules ○ Apply custom business logic ○ Implement simple services ■ Rate limiting ■ Rule engine for blocking ○ ML models 32 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  33. Components - WAF service ● Proprietary software or appliances ○ Reduced complexity of installation ○ Simple way of evaluation 33 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  34. WAF service - Example: Modsecurity ● Could be made api driven through libModSecurity ● Can run on Apache HTTP Server or NGINX ● Results are written as logs 34 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  35. WAF service - Modsecurity as an API ● SecRule REMOTE_ADDR "@unconditionalMatch" "phase:4,id:999434,prepend: ... 35 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  36. WAF service - Modsecurity as an API ● Implementing response body analysis ● Body is sent to CGI for replay 36 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  37. WAF service 37 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  38. How to block? ● We decide when to send traffic to the WAF ● Manually or automatically decided 38 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  39. Traffic routing ● Fingerprint based routing ○ Blocks based on scores ○ IP, client_id, combinations, 0day fingerprints.. ○ Added automatically or manually 39 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  40. Traffic routing ● Net block based routing ○ ISP ○ Hosting providers ○ Tor exit nodes / Proxies 40 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  41. Traffic routing ● Virtual Patching ○ Always route particular vulnerable endpoints ○ Select for combination of parameters if needed ○ Example: website.com/? vuln_param = 41 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  42. FP rate management ● Detection FP vs blocking FP ● Key to allow blocking without impacting users ● Acceptable rate might change per application 42 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  43. FP rate management ● Business logic ○ How trustworthy is a user/ip? ○ Key business activity ○ What would be the impact on blocking them 43 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

  44. FP rate management ● Historical Analysis ○ How normal is this type of request for this endpoint? ○ How does this user compare with others ○ How common are detection FP in this endpoint 44 Building Your Own WAF as a Service and Forgetting about False Positives Juan Berner

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend