RPMパッケージの脆弱性(CVE-2014-0160)調査メモ

OpenSSLのheartbeat脆弱性(CVE-2014-0160)の調査をした時のメモです。

ソースインストールした際とRPMインストールした際で、バージョン情報の見え方が違いますね。RPMだと脆弱性の存在する可能性のあるバージョンを利用しているのか?ということを把握するのが面倒に思えます。ソースパッケージとRPMパッケージを対比付けしたりできないのかしら。。。

 

OpenSSLのheartbeat脆弱性(CVE-2014-0160)
先月フィーバーしたOpenSSLの脆弱性を対象にメモります。
影響を受けるバージョンの範囲指定が明確に記載されています。

■OpenSSLのheartbeat脆弱性(CVE-2014-0160)
https://www.jpcert.or.jp/at/2014/at140013.html

  以下のバージョンが本脆弱性の影響を受けます。
  - OpenSSL 1.0.1 から 1.0.1f
  - OpenSSL 1.0.2-beta から 1.0.2-beta1
 

  修正済みバージョン
  - OpenSSL 1.0.1g

 

バージョン確認

現在使っているバージョンは何だろう。
ビルド番号がふられていて、普通と違う見え方がしています。Versionを見る限りだと、影響を受ける可能性が高そうです。

・Version: 1.0.1e
・Release: 16.el6_5.4
・Build Date: 2014年01月09日 03時44分56秒

# rpm -qi openssl
Name        : openssl                      Relocations: (not relocatable)
Version     : 1.0.1e                            Vendor: CentOS
Release     : 16.el6_5.4                    Build Date: 2014年01月09日 03時44分56秒
Install Date: 2014年01月24日 15時11分27秒      Build Host: c6b9.bsys.dev.centos.org
Group       : System Environment/Libraries   Source RPM: openssl-1.0.1e-16.el6_5.4.src.rpm
Size        : 4205553                          License: OpenSSL
<以下略>

 

更新履歴確認

念のため、更新履歴を確認します。
CVE-2014-0160は出てこなかったので、修正はされていないでしょう。

# rpm -q --changelog openssl |grep CVE
- fix CVE-2013-4353 - Invalid TLS handshake crash
- fix CVE-2013-6450 - possible MiTM attack on DTLS1
- fix CVE-2013-6449 - crash when version in SSL structure is incorrect
<以下略>

 

PoC(Proof Of Concept)で確認

PoCを見つけたので動かして確認します。検証機が相手なので容赦なくトライ!
中略部分にsessionidやらが丸見えでしたので、脆弱性がある可能性は高そうです。

親切にも「server is vulnerable!」だと。。。

Connecting...
Sending Client Hello...
Waiting for Server Hello...
... received message: type = 22, ver = 0302, length = 58
... received message: type = 22, ver = 0302, length = 793
... received message: type = 22, ver = 0302, length = 397
... received message: type = 22, ver = 0302, length = 4
Sending heartbeat request...
... received message: type = 24, ver = 0302, length = 16384
Received heartbeat response:
  0000: 02 40 00 D8 03 02 53 43 5B 90 9D 9B 72 0B BC 0C  .@....SC[...r...
  0010: BC 2B 92 A8 48 97 CF BD 39 04 CC 16 0A 85 03 90  .+..H...9.......
<中略>
WARNING: server returned more data than it should - server is vulnerable!

 

新しいパッケージの確認

最新のリストを取得し、新しいパッケージが無いか確認すると、新しいソフトウェアが存在していますね。検証機なので、とりあえずアップデートです。

# yum list updates
<中略>
#
# yum list openssl
<中略>
Installed Packages
openssl.x86_64             1.0.1e-16.el6_5.4        @updates
Available Packages
openssl.i686               1.0.1e-16.el6_5.7        updates
openssl.x86_64             1.0.1e-16.el6_5.7        updates
#
# yum install openssl
<以下略>

 

バージョン確認

表示されるバージョンが変わりました。バージョンアップできたみたいです。

# rpm -qi openssl
Name        : openssl                      Relocations: (not relocatable)
Version     : 1.0.1e                            Vendor: CentOS
Release     : 16.el6_5.7                    Build Date: 2014年04月08日 11時43分19秒
Install Date: 2014年04月10日 13時56分12秒      Build Host: c6b10.bsys.dev.centos.org
Group       : System Environment/Libraries   Source RPM: openssl-1.0.1e-16.el6_5.7.src.rpm
Size        : 4209635                          License: OpenSSL
<以下略>

 

更新履歴確認

更新履歴をみると、CVE-2014-0160 の記載があるので、今回の脆弱性が修正されていますね。

# rpm -q --changelog openssl |grep CVE
- fix CVE-2014-0160 - information disclosure in TLS heartbeat extension
- fix CVE-2013-4353 - Invalid TLS handshake crash
- fix CVE-2013-6450 - possible MiTM attack on DTLS1
- fix CVE-2013-6449 - crash when version in SSL structure is incorrect
<以下略>

 

PoC(Proof Of Concept)で確認

同じPoCで再現しないか確認します。
前回と違って、メモリの中身が帰ってこなかったので、脆弱性は修正されているようです。

Connecting...
Sending Client Hello...
Waiting for Server Hello...
... received message: type = 22, ver = 0302, length = 58
... received message: type = 22, ver = 0302, length = 793
... received message: type = 22, ver = 0302, length = 397
... received message: type = 22, ver = 0302, length = 4
Sending heartbeat request...
Unexpected EOF receiving record header - server closed connection
No heartbeat response received, server likely not vulnerable