【无标题】

安装docker

sudo apt update
sudo apt install docker.io

启动docker

sudo systemctl start docker
sudo systemctl enable docker

测试

docker --version
docker info

漏洞复现

1.创建一个包含以下文件的文件夹

  • app.py
  • templates/index.htm

 打开终端并在上述文件夹中,创建app.py文件,将以下代码复制进去。

# app.py
from flask import Flask, render_template, request
 
app = Flask(__name__)
 
@app.route('/')
def index():
    return render_template('index.html')
 
@app.route('/redirect')
def redirect_page():
    user_input = request.args.get('url')
    return f'Redirecting to: {user_input}'
 
if __name__ == '__main__':
    app.run(debug=True) 

在上述文件夹中,创建templates文件夹,然后在其中创建index.html文件,将以下代码复制进去。

<!-- templates/index.html -->
<!DOCTYPE html>
<html>
<body>
 
<h2>CRLF Injection Example</h2>
 
<form action="/redirect">
    Enter URL: <input type="text" name="url">
    <input type="submit" value="Submit">
</form>
 
</body>
</html> 

在同一文件夹中创建名为Dockerfile的文件,并将以下代码复制进去 

# Dockerfile
FROM python:3.8-slim
 
WORKDIR /app
 
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
 
COPY . .
 
EXPOSE 5000
 
CMD ["python", "app.py"]

找到改文件,运行

docker build -t crlf-injection-app .
docker run -p 5000:5000 crlf-injection-app

打开浏览器,访问http://localhost:5000。在表单中输入一个URL,并尝试在输入中插入CRLF字符(如 %0d%0a 或 &#x0d;&#x0a;),观察应用程序是否产生预期外的行为 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值