当前位置:网站首页>[BJDCTF2020]The mystery of ip
[BJDCTF2020]The mystery of ip
2022-06-27 03:54:00 【借zj文章[de]BvxiE】
[BJDCTF2020]The mystery of ip

题目存在提示注意ip
观察界面,存在按钮,点进发现自己的ip,尝试进行抓包,伪造ip,X-Forwarded-For:127.0.0.1
可行,SSTI模板注入,继续往下,尝试X-Forwarded-For:{ {config}},报错,从报错提示中发现,这是Smarty 模板引擎
附上一个博客,有机会再系统学习!尝试{if phpinfo()}{/if}标签,执行成功回。
继续执行查看这个flag.php的文件,X-Forwarded-For:{if system('cat /flag')}{/if} 成功解题
总结一下:这个题
SSTI模板注入这个老生常谈的漏洞模板,摘抄于文中链接
将XFF头改为 {6*7} 会发现该位置的值变为了42,便可以确定这里存在SSTI。
SSTI 就是服务器端模板注入(Server-Side Template Injection)
当前使用的一些框架,比如python的flask,php的tp,java的spring等一般都采用成熟的的MVC的模式,用户的输入先进入Controller控制器,然后根据请求类型和请求的指令发送给对应Model业务模型进行业务逻辑判断,数据库存取,最后把结果返回给View视图层,经过模板渲染展示给用户。
漏洞成因就是服务端接收了用户的恶意输入以后,未经任何处理就将其作为 Web 应用模板内容的一部分,模板引擎在进行目标编译渲染的过程中,执行了用户插入的可以破坏模板的语句,因而可能导至了敏感信息泄露、代码执行、GetShell 等问题。其影响范围主要取决于模版引擎的复杂性。
凡是使用模板的地方都可能会出现 SSTI 的问题,SSTI 不属于任何一种语言,沙盒绕过也不是,沙盒绕过只是由于模板引擎发现了很大的安全漏洞,然后模板引擎设计出来的一种防护机制,不允许使用没有定义或者声明的模块,这适用于所有的模板引擎。
$smarty内置变量可用于访问各种环境变量
{
$smarty.version} #获取smarty的版本号
{
php}phpinfo();{
/php} #执行相应的php代码
{
if phpinfo()}{
/if}
Smarty的 {
if} 条件判断和PHP的if非常相似,只是增加了一些特性。每个{
if}必须有一个配对的{
/if},也可以使用{
else} 和 {
elseif},全部的PHP条件表达式和函数都可以在if内使用,如||*,or,&&,and,is_array()等等,如:{
if is_array($array)}{
/if}*
边栏推荐
- IOS development: understanding of dynamic library shared cache (dyld)
- Description of replacement with STM32 or gd32
- PostgreSQL basic command tutorial: create a new user admin to access PostgreSQL
- nignx配置单ip限流
- IDEA中好用的插件
- PAT甲级 1025 PAT Ranking
- 面试-01
- GAMES101作业7提高-微表面材质的实现过程
- [数组]BM94 接雨水问题-较难
- [promise I] introduction of promise and key issues of hand rolling
猜你喜欢
![[array]bm94 rainwater connection problem - difficult](/img/2b/1934803060d65ea9139ec489a2c5f5.png)
[array]bm94 rainwater connection problem - difficult

Stack overflow vulnerability

MATLAB | 基于分块图布局的三纵坐标图绘制

Career outlook, money outlook and happiness outlook

PostgreSQL basic command tutorial: create a new user admin to access PostgreSQL

Kotlin Compose compositionLocalOf 与 staticCompositionLocalOf

WPF 开源控件库Extended WPF Toolkit介绍(经典)

真xx相来了?测试/开发程序员为什么不愿意加班,这是个疯狂的状态......

百度飞桨“万有引力”2022首站落地苏州,全面启动中小企业赋能计划

ERP demand and sales management Kingdee
随机推荐
Knowledge of iPhone certificate structure
百度飞桨“万有引力”2022首站落地苏州,全面启动中小企业赋能计划
Network structure and model principle of convolutional neural network (CNN)
ESP8266
清华&华为等 综述 | 语义通信:原则与挑战
PostgreSQL basic command tutorial: create a new user admin to access PostgreSQL
Games101 job 7 improvement - implementation process of micro surface material
math_数集(数集符号)和集合论
2022 Chinese pastry (Advanced) recurrent training question bank and online simulation test
promise源码-class版本【三、Promise源码】【代码详细注释/测试案例完整】
Basic functions of promise [IV. promise source code]
Matlab | visualization of mathematical properties related to three interesting circles
解码苹果手机证书文件方法
PAT甲级 1023 Have Fun with Numbers
手机新领域用法知识
卷积神经网络(CNN)网络结构及模型原理介绍
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
IDEA中好用的插件
Baidu PaddlePaddle's "universal gravitation" first stop in 2022 landed in Suzhou, comprehensively launching the SME empowerment plan
Anaconda3安裝過程及安裝後缺失大量文件,沒有scripts等目錄