runcの脆弱性(CVE-2019-5736)対応でdocker.ioをUpdateした

 dockerやkubernetesなどで使用されているコンテナランタイムのruncの脆弱性がCVE-2019-5736として公開されました。
CVE - CVE-2019-5736
 

CVE-2019-5736の概要

 MITREには以下のように記載されています。

runc through 1.0-rc6, as used in Docker before 18.09.2 and other products, allows attackers to overwrite the host runc binary (and consequently obtain host root access) by leveraging the ability to execute a command as root within one of these types of containers: (1) a new container with an attacker-controlled image, or (2) an existing container, to which the attacker previously had write access, that can be attached with docker exec. This occurs because of file-descriptor mishandling, related to /proc/self/exe.

 適当に意訳すると、以下のような感じになるかと思います。

Docker(18.09.2より前のバージョン)などの製品で使われていたrunc(1.0-rc6までのバージョン)には、攻撃者にホストのruncバイナリの上書きを許し、以下のようなコンテナ内からホストのroot権限でコマンドを実行される可能性がある。

  • 新規のコンテナで、攻撃者が管理するイメージを使った場合
  • 攻撃者が以前に書き込み権限を持っていたことがある既存のコンテナでdocker execできるもの。これは/proc/self/exeに関連してファイルデスクリプタの不適切なハンドリングによって発生する。

 基本的には外部から取得したイメージを使用している(いたことがある)場合に、本脆弱性を悪用される可能性があるとみればよさそうです。
 

Docker公式の対応

 最新版(18.09.2)で修正されており、Docker公式にはDocker Engine*1 release notesに以下の記述があります。

18.09.2
2019-02-11

Security fixes for Docker Engine - Enterprise and Docker Engine - Community
Update runc to address a critical vulnerability that allows specially-crafted containers to gain administrative privileges on the host. CVE-2019-5736
Ubuntu 14.04 customers using a 3.13 kernel will need to upgrade to a supported Ubuntu 4.x kernel

Docker Engine release notes | Docker Documentation
 

Community Edition

 商用のDocker EE(Enterprise Edition)だけではなく、Docker CE(Community Edition)の方も最新版(18.09.2)で修正されていることが確認できます。

18.09.2 (2019-02-11)
Security
Update runc to address a critical vulnerability that allows specially-crafted containers to gain administrative privileges on the host. (CVE-2019-5736)

Release 18.09.2 · docker/docker-ce · GitHub
 

docker.io

 Ubuntuのパッケージマネージャから導入可能なdocker.ioについても最新版で既に修正されています。

 例えばxenial(Ubuntu 16.04)ではパッケージバージョン18.06.1-0ubuntu1.2~16.04.1で修正されています。

docker.io (18.06.1-0ubuntu1.2~16.04.1) xenial-security; urgency=medium

* SECURITY UPDATE: Container escape and root privilege escalation
- debian/patches/CVE-2019-5736.patch: nsenter: clone /proc/self/exe to
avoid exposing host binary to container
- CVE-2019-5736

http://changelogs.ubuntu.com/changelogs/pool/universe/d/docker.io/docker.io_18.06.1-0ubuntu1.2~16.04.1/changelog

 bionic(Ubuntu 18.04)では18.06.1-0ubuntu1.2~18.04.1で同様の修正が為されています。

 参考までに、私はARM版xenial環境でdocker.ioを使用していますが、Update後のバージョン表記は以下のようになっており、一見するとDocker CEのようなバージョン表記に見えます。紛らわしいですが、前述の通りCEなら18.09.2でないとCVE-2019-5736パッチは適用されていないことになるので、docker.ioのdockerコマンドのバージョン表示からCVE-2019-5736対応済か識別するのは困難だと思われます。

$ docker --version
Docker version 18.06.1-ce, build e68fc7a

 パッケージバージョンの方で18.06.1-0ubuntu1.2~16.04.1以降(xenialの場合)がinstalledであることを確認すれば間違いないので、Ubuntuでdocker.ioを使用している方はご参考までに。

$ sudo apt list docker.io
Listing... Done
docker.io/xenial-security,xenial-updates,now 18.06.1-0ubuntu1.2~16.04.1 armhf [installed]
N: There is 1 additional version. Please use the '-a' switch to see it

 



以上。

*1:Docker Engine Enterprise Edition (Docker EE) and Community Edition (CE)