当前位置:网站首页>[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}*
边栏推荐
- 再探Handler(上)(Handler核心原理最全解析)
- Static timing analysis OCV and time derive
- PostgreSQL基础命令教程:创建新用户admin来访问PostgreSQL
- Method of decoding iPhone certificate file
- Questions and answers of chlor alkali electrolysis process in 2022
- PAT甲级 1018 Public Bike Management
- [promise I] introduction of promise and key issues of hand rolling
- Overview of Tsinghua & Huawei | semantic communication: Principles and challenges
- PAT甲级 1019 General Palindromic Number
- Implementation of window encryption shell
猜你喜欢

Fplan powerplan instance

There are two problems when Nacos calls microservices: 1 Load balancer does not contain an instance for the service 2. Connection refused

Kotlin Compose compositionLocalOf 与 staticCompositionLocalOf

办公室VR黄片,骚操作!微软HoloLens之父辞职!

事业观、金钱观与幸福观

IOS development: understanding of dynamic library shared cache (dyld)

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

WPF open source control library extended WPF toolkit Introduction (Classic)

快速掌握 ASP.NET 身份认证框架 Identity - 通过邮件重置密码

Is the truth XX coming? Why are test / development programmers unwilling to work overtime? This is a crazy state
随机推荐
USB DRIVER
Career outlook, money outlook and happiness outlook
面试-01
Il manque beaucoup de fichiers et de répertoires tels que scripts pendant et après l'installation d'anaconda3
Six possible challenges when practicing Devops
733. image rendering
办公室VR黄片,骚操作!微软HoloLens之父辞职!
ESP8266
Why does C throw exceptions when accessing null fields?
真xx相来了?测试/开发程序员为什么不愿意加班,这是个疯狂的状态......
Uni app's uparse rich text parsing perfectly parses rich text!
PostgreSQL基础命令教程:创建新用户admin来访问PostgreSQL
文旅夜游|以沉浸式视觉体验激发游客的热情
CVPR2021:Separating Skills and Concepts for Novel Visual Question Answering将技巧与概念分开的新视觉问答
2020:MUTANT: A Training Paradigm for Out-of-Distribution Generalizationin Visual Question Answering
Promise [II. Promise source code] [detailed code comments / complete test cases]
math_数集(数集符号)和集合论
PAT甲级 1019 General Palindromic Number
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
Pat grade a 1023 have fun with numbers