当前位置:网站首页>[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}*
边栏推荐
- Questions and answers of chlor alkali electrolysis process in 2022
- A^2=e | the solution of the equation | what exactly can this equation tell us
- ESP8266
- 苹果手机证书构体知识
- PAT甲级 1019 General Palindromic Number
- 2021:Graphhopper: Multi-Hop Scene Graph Reasoning for Visual Question Answering
- 发现一款 JSON 可视化工具神器,太爱了!
- Is the money invested in financial products guaranteed? Is there no more?
- fplan-布局
- IDEA中好用的插件
猜你喜欢
低代码开发平台NocoBase的安装
How can e-commerce products be promoted and advertised on Zhihu?
Ldr6028 OTG data transmission scheme for mobile devices while charging
Pat grade a 1023 have fun with numbers
Why does C throw exceptions when accessing null fields?
Pat class a 1024 palindromic number
2021:Graphhopper: Multi-Hop Scene Graph Reasoning for Visual Question Answering
办公室VR黄片,骚操作!微软HoloLens之父辞职!
PAT甲级 1021 Deepest Root
【promise一】promise的介绍与手撸的关键问题
随机推荐
再探Handler(下)(Handler核心原理最全解析)
ERP demand and sales management Kingdee
promise源码-class版本【三、Promise源码】【代码详细注释/测试案例完整】
Further exploration of handler (Part 2) (the most complete analysis of the core principles of handler)
IDEA中好用的插件
Promise [II. Promise source code] [detailed code comments / complete test cases]
真xx相来了?测试/开发程序员为什么不愿意加班,这是个疯狂的状态......
与STM32或GD32替换说明
733. image rendering
nignx配置单ip限流
通信中的机器学习最佳阅读资料列表
Resnet152 pepper pest image recognition 1.0
人间清醒:底层逻辑和顶层认知
Further exploration of handler (I) (the most complete analysis of the core principle of handler)
PostgreSQL basic command tutorial: create a new user admin to access PostgreSQL
解码苹果手机证书文件方法
Pat grade a 1020 tree Traversals
Argo workflows - getting started with kubernetes' workflow engine
ESP8266
[array]bm94 rainwater connection problem - difficult