1. 程式人生 > 其它 >關於SQL注入的過濾和繞過方式總結

關於SQL注入的過濾和繞過方式總結

  • 過濾關鍵字:
    • 一般繞過方式:
      1. 大小寫
      2. 雙寫
      3. /**/,<>分割關鍵字
      4. 編碼繞過
    • 過濾information_shcema:使用sys.x$schema_flattened_keys、sys.schema_table_statistics_with_buffer 、sys.schema_auto_increment_columns、mysql.innodb_table_stats、mysql.innodb_index_stats等代替
  • 過濾空格:
    1. /**/等註釋符
    2. 使用括號包裹語句
  • 過濾"#"和"--+":
    1. ;%00
  • 過濾"=":
    1. 在union注入中where後面的=可以用like代替
  • 過濾"<>"(大於小於號):
    1. greatest(n1,n2,n3,...)
    2. strcmp(str1,str2)
    3. in
    4. between..and...
  • 過濾逗號:
    1. union可以使用join方法繞過 union select 1,2,3 變成 union select * from (select 1)a join (select 2)b join (select 3)
    2. substr和mid() 可以使用from for的方法解決 substr(str from start for len) //在str中從第start位擷取len長的字元 mid(str from start for len)//在str中從第start位擷取len長的字元
    3. limit可以用offset的方法繞過 ,limit 2 offset 1//從第一位(不包括)取出兩條資料(第2,3位資料)
  • 過濾order by:
    1. 使用group by
  • 未完待續...
It is never too late to learn 個人部落格:yiaho.cn