探寻Bottle框架内存马
0x00 环境搭建
我们直接pip3 install bottle下载最新版本即可
然后在这里写一段代码,手动添加一条测试路由大概如下
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from bottle import template, Bottle,request,error
app = Bottle()
@error(404)
@app.route(‘/memshell’)
def index():
result = eval(request.params.get(‘cmd’))
return template(‘Hello {
{result}}, how are you?’,result)
@app.route(‘/’)
def index():
return ‘Hello world’
if name == ‘main’:
app.run(host=‘0.0.0.0’, port=8888,debug=True)
在cmd我们可以执行python代码 即可开始测试
0x01 Bottle路由规则
我对内存马的理解就是注入一段执行命令的代码,把他找一个回显位点或者说绑定一个自定义的路由
在这之前 我们要理清整个框架的路由如何解析 方便我们日后的自定义路由的绑定
首先在装饰器的使用 直接调用一个route函数
我们跟进来看 他其实有很多默认的参数 在不看代码前 我们在看文档描述其实就能知道意义
首先我们传进去的 如图所示的 /memshell 就是我们的path
跟进代码