背景知识FlaskFlask作为Python语言中最为轻量的Web框架, 由于其核心内容的简洁以及良好的可拓展性, 一直受到广泛的开发者所喜爱。由于是轻量级的Web框架,使得Flask的Session机制是使用JWT保存在客户端的,当我们得知flask的SECRET_KEY即可进行Session的伪造。JSON Web Token(JWT)JSON Web Token (JWT)是一个开放标准(RFC 7519),它定义了一种紧凑的、自包含的方式,用于作为JSON对象在各方之间安全地传输信息。该信息可以被验证和信任,因为它是数字签名的。JSON Web Token由三部分组成,它们之间用圆点(.)连接。这三部分分别是:Header,存放签名算法Payload,存放数据Signature,存放签名值因此,一个典型的JWT看起来是这个样子的:xxxxx.yyyyy.zzzzz因为使用了base64编码,这个字符串通常以eyJ开头。Flask的JWT实现与标准JWT略有不同。Flask Session 的组成结构主要由三部分构成:第一部分为Session Data ,即会话数据。第二部分为T
一、SSTI简介SSTI就是服务器端模板注入(Server-Side Template Injection),实际上也是一种注入漏洞。由于未对用户输入的数据进行过滤,导致由用户输入的模板引擎渲染标识符中的内容被渲染,导致RCE(任意代码执行)漏洞。二、判断模板引擎最出名的一张图。解释:绿色箭头指成功执行,红色箭头指原样返回或报错。区分Jinja2与Twig通过{{7*'7'}}返回的值。Jinja2:7777777Twig:49三、Smarty1. 简介这是一个基于PHP服务的模板引擎,是为了让前端界面(html)与程序代码(php)分离而产生的一种解决方案,Smarty 的原理是变量替换原则,我们只需要在html文件里写好Smarty的标签即可,如果对用户的输入不加处理直接回显可能会导致SSTI漏洞。2. 漏洞确认POC:{$smarty.version}返回版本号。3. 任意文件读取POC:string:{include file='[file path]'}解释:{include}标签所导致,被该标签引入的文件只会单纯的输出文件内容,就算引入 php 文件也是如此。通过self获
Equinox
一个乐于分享的网安人