TORIPIYO DIARY

recent events, IoT, programming, security topics

CentOSのパッケージとセキュリティ

CentOSのパッケージのバージョンとセキュリティの関係について、いままであまりちゃんと調べてなかったので確認してそこそこまとめました。CentOS6で、CentOS公式のbaseレポジトリからphpをインストールするとphpのバージョン5.3がインストールされます。php5.3はPHPの開発元では2014年の8月14日にEOLを迎えています。

PHP: Unsupported Branches

この情報のみでは、CentOS6では開発が終わっているバージョンのphpを配布しているようにみえてセキュリティ的に心配になりますが、CentOSのクローン元であるRedHatは、セキュリティの修正に対してバックポートポリシーを採用しています。

Security Backporting Practice - Red Hat Customer Portal

これはどういうことかというと、セキュリティの脆弱性が発見された際、ソフトウェアのバージョンを上げて修正するのではなくて、セキュリティの修正箇所を既存のバージョンにインポートさせるという運用のようです。こうすることで、バージョンが上がることで生じる互換性の問題を可能な限りなくしてセキュリティの穴を塞ぐことが出来ます。ということで、CentOS6のPHP5.3にもセキュリティパッチが提供されています。phpパッケージの変更履歴を見ると、php5.3がEOLを迎えた2014年8月14日以降もセキュリティの修正パッチが提供され続けていることが分かります。RedhatのRemi Colletさんが、頑張ってphpの修正パッチを当てられていることが分かります。

[vagrant@localhost ~]$ rpm -q --changelog php | head -n 20
* Mon Nov 07 2016 Remi Collet <rcollet@redhat.com> - 5.3.3-49
- fix php-soap fails to connect to HTTPS web service sporadically
  as stream_socket_enable_crypto() uses NONBLOCK #1283153

* Mon Jul 25 2016 Remi Collet <rcollet@redhat.com> - 5.3.3-48
- don't set environmental variable based on user supplied Proxy
  request header CVE-2016-5385

* Wed Dec 09 2015 Remi Collet <rcollet@redhat.com> - 5.3.3-47
- fix wrong warning in openssl_encrypt() for missing IV
  when IV is not required #1260315
- fix segfault's when you try and allocate an SplFixedArray
  with size >= 9999 #1071344
- segfault in php_pgsql_meta_data CVE-2015-4644  #1234434
- add options to enable TLS in curl #1255920
- fix segfault in gc_collect_cycles #1122681

* Fri Jul 03 2015 Remi Collet <rcollet@redhat.com> - 5.3.3-46
- fix gzfile accept paths with NUL character #1213407
- fix patch for CVE-2015-4024

Remi ColletさんはRemiパッケージのメンテナーで、remiは最新のphpパッケージなどを提供しているようです。

English : FAQ - Remi's RPM repository - Blog

CentOS6のMaintenace Updatesは、2020年11月30日まで提供されるようなので、東京オリンピックまでには余裕を持ってCentOS7に移行したいですね。

About/Product - CentOS Wiki

ちなみに、最近出てきた脆弱性スキャナのvulsでは、CentOS6のphpパッケージは脆弱性のあるパッケージとして誤検知されるかどうか確認してみました。vagrantでCentOS6.9の環境にvulsをインストールして自分自身をスキャンさせます。phpは最新のパッケージにしています。
toripiyo.hatenablog.com

[vagrant@localhost ~]$ rpm -qa | grep php
php-common-5.3.3-49.el6.x86_64
php-5.3.3-49.el6.x86_64
php-cli-5.3.3-49.el6.x86_64

[vagrant@localhost ~]$ vuls report --ovaldb-path /home/vagrant/go/src/github.com/kotakanbe/goval-dictionary/oval.sqlite3  | head -n 20
[Jun 14 14:35:18]  INFO [localhost] Validating config...
[Jun 14 14:35:18]  INFO [localhost] cve-dictionary: /home/vagrant/cve.sqlite3
[Jun 14 14:35:18]  INFO [localhost] oval-dictionary: /home/vagrant/go/src/github.com/kotakanbe/goval-dictionary/oval.sqlite3
[Jun 14 14:35:18]  INFO [localhost] Loaded: /home/vagrant/results/2018-06-13T13:01:02Z
localhost (centos6.9)
=====================
Total: 75 (High:24 Medium:51 Low:0 ?:0)	393 installed, 45 updatable

CVE-2017-11176  	10.0 HIGH (nvd)
                	The mq_notify function in the Linux kernel through 4.11.9 does not set the sock
                	pointer to NULL upon entry into the retry logic. During a user-space close of a
                	Netlink socket, it allows attackers to cause a denial of service
                	(use-after-free) or possibly have unspecified other impact.
                	---
                	https://nvd.nist.gov/vuln/detail/CVE-2017-11176
                	https://access.redhat.com/security/cve/CVE-2017-11176 (RHEL-CVE)
                	10.0/AV:N/AC:L/Au:N/C:C/I:C/A:C (nvd)
                	https://nvd.nist.gov/vuln-metrics/cvss/v2-calculator?name=CVE-2017-11176
                	7.8/CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (redhat)
                	https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?name=CVE-2017-11176
                	Confidence: 100 / OvalMatch

CVE-2017-18017  	10.0 HIGH (nvd)
                	The tcpmss_mangle_packet function in net/netfilter/xt_TCPMSS.c in the Linux

[vagrant@localhost ~]$ vuls report --ovaldb-path /home/vagrant/go/src/github.com/kotakanbe/goval-dictionary/oval.sqlite3 2>&1 | grep -i php
[vagrant@localhost ~]$

vulsではphpのパッケージは脆弱性のあるものとして誤検知されませんでした。ただ、脆弱性スキャナの中には、php-5.3.3-49.el6.x86_64のパッケージ名のphp-5.3.3の箇所のみを見て脆弱性があると判定するものもあるそうなので注意が必要です。