Upload
ruo-ando
View
247
Download
4
Embed Size (px)
Citation preview
An extension of cryptographic protocol
in distributed in-memory caching system
Ruo ANDO Network Security Institute,
National Institute of Information and Communications Technology
情報セキュリティ研究会(ISEC)2015 年 9 月 4 日 ( 金 ) 11:45-12:10 機械振興会館
Introduction ( キャッシュレイヤーでの暗号プロトコル拡張)■ 近年、クラウドコンピューティングの普及などにより、分散システムを高速化するキャッシュレイヤーの導入が盛んに行われている。■ しかしながら、キャッシュは局所性を利用した性能向上を主眼としており、攻撃解析の対象になりやすく、キャッシュ上に置かれるデータの安全性については殆ど検討されていないのが現状である。■ また、キャッシュと本体システムの通信はコールバック関数を多用した非同期方式をとるため、システム的な見地から、暗号プロトコルをどのように組み合わせるか、またかは拡張するかについては殆ど考慮されないまま放置されている。■ 本論文では Memcached –Distibuted Object caching system を対象に、キャッシュレイヤーに適した暗号方式の拡張方法を提案する。■ プロトコルは SASL ( Simple Authentication Security Layer )を扱い、許容可能なシステム負荷で運用が可能なストリーム暗号を組み込むことを成功した。(CPU負荷率で1~2%、メモリ利用率で1%以下)
Cache security■Cross VM 攻撃• Thomas Ristenpart, Eran Tromer, Hovav Shacham, and Stefan Savage, "Hey, You, Get Off of My Cloud! Exploring
Information Leakage in Third-Party Compute Clouds, In Proceedings of CCS 2009, pages 199–212. ACM Press, Nov. 2009
• Set Associative Cache を共有している「悪意のある VM 」が連続してキャッシュを叩く。キャッシュの 反応が遅れると他の VM でアクセスしていることが判る。限定した環境だが鍵漏洩の恐れがある。■Memached のセキュリティ(設定不備など)• Marco Slaviero, Lifting the Fog, BlckHat 2010 https://www.blackhat.com/html/bh-us-10/bh-us-10-
briefings.htmlエンドポイントの対策(SASL)はあるが、通信路が保護されてない、サーバの稼動位置がセキュアではない。■Memached のセキュリティ(SQLインジェクションに似た脆弱性がある)Ivan Novikov, "The New Page of Injections Book: Memcached Injections", BlachHat USA 2014
現在、これらの問題についてのシステムレベルでの根本的な対応策は提示されてない。情報漏洩を防ぐためにはプロトコルを拡張して暗号化して守る必要がある。
Third party sorftware security• 現在、暗号化は Third-party software( 第三者によるオープンスース)に依存している。 Third-party software は高度に抽象化、カプセル化、そして汎用化されており、その結果、一度脆弱性が発見されると、クラスブレイク効果により被害が多数のシステムに渡り、利用者による対策が不可能なことから被害が深刻化する。• Third-party software 内の暗号プロトコルだけではなく、 Third-party software が組み込まれた通信システムのプロトコルの状態範囲を包括的把握し、適切な箇所に暗号化を施して情報の秘匿性を確保す必要が生じている。POODLE: SSLv3.0 脆弱性 (CVE-2014-3566) 「 Red Hat Product Security チームは、 SSLv3 プロトコルの脆弱性 ( 通称 POODLE) について認識しており、 CVE-2014-3566 でこの問題に対応しています。 SSLv3 のすべての実装がこの問題の影響を受けます . 」https://access.redhat.com/ja/node/1232403
Memcached (very large hash table with LRU)Memcached. Memcached adopts LRU for purging older data for subsequent insertion in the case of full table entries. Not surprisingly, the size of hash table becomes very large which results in that available memory over all the servers is limited. For countermeasures, hash table can be stretched to many gigabytes.
一貫性+可用性一般的な関係データベース、 LDAP 、 NFS などは一貫性と可用性しか成立しない。 2相コミットはこれに該当。ネットワーク分断が発生した際は、片方を切り捨てる。 Amazon Relational Database Service の Multi-AZ 配備も該当。可用性+分断耐性可用性+分断耐性のケースでも、一定時間以内に一貫性を成立させるシステム(結果整合性 ; eventually consistent )は構築可能である。 Amazon SimpleDB や Apache Cassandra などがこの方式を採用している。 DNS や HTTP キャッシュなども該当。 3種の中ではこの方式が最も障害に強い。一貫性+分断耐性Apache HBase などが採用している。 HBase の場合、単一障害点がある上、ネットワーク分断に対して整合性をとる仕組みが不完全であるため、可用性が犠牲となっている。
CP(一貫性・分断耐性)型に適した暗号方式については殆ど検討されていない。
http://www.erlang-factory.com/upload/presentations/330/riak-efl.pdf
drive_machine
event_handler
conn_new
update_eventitem_remove
Item_free
try_read_command
complete_nreadout_string
try_read_network
complete_nread_binary
store_item
get_item
Basic State Transition of Memcached
item_link
Binary Protocol Substates
trigger
Request handler
Commit
Binary protocolstates
ASYNCASYNC
ASYNC
外部入力からの状態遷移
Encryption Phase はRequest Handler (赤)に組み込む
consequence
内部更新からの状態遷移
Extension Target: Memcached and Binary Protocolenum bin_substates { bin_no_state, bin_reading_set_header, bin_reading_cas_header, bin_read_set_value, bin_reading_get_key, bin_reading_stat, bin_reading_del_header, bin_reading_incr_header, bin_read_flush_exptime, bin_reading_sasl_auth, bin_reading_sasl_auth_data, bin_reading_touch_key,};header.h
drive_machine
event_handler update_event
complete_nread
nread_binary store_item
item_link
nread_ascii
Dispatch_event
SASL mechs
nread_binaryKey
Excahnge
Key Excahnge
Substate to be modified
Substate to be appdended
①Entering binary protocol
②Enterint SASL protocol
プロトコル拡張のポイント① 認証手順が入るとバイナリプロトコルにスイッチし、テキストプロトコルには戻らない。② バイナリプロトコルとSASLプロトコルの入り口となる状態を見つけ、修正・拡張する。
SASL_Client_Start
Check Return
Get Requested Data
SASL Client StepFree SASL Context
Send Selected SASL Mechanism and
Data
Get Selected SASL Mechanism and
Data
Call Server Start
Send LIST MECHs
Request LIST MECHs
Free SASL Context
Server Action
Client Action
Simple Security Authentication Layer
Loop of Third-party Software:サーバライブラリとクライアントで共有される手順(拡張・修正不可能)
drive_machine
event_handler
conn_new
update_event
try_read_command
complete_nread
complete_nread_binary
SASL and Memcached (Event handler-> drive_machine -> binary protocol -> SASL )
SASL_LIST_DATA
SASL_AUTH_STEP
SASL_LIST_MECHs
store_item
Binary Protocol Substates
Reentrant TriggerState
Entering State
Returning State Loop of client-to-server-library
Event_handler ( 非同期)Driver_machine ( 核ステートマシン)Complete_nread ( プロトコルスイッチ)
drive_machine
event_handler
conn_new
update_event
try_read_command
complete_nread
complete_nread_binary
RC4_key_exchange
bin_list_sasl_mechs
Decryption of user/passwd
Shared varibaleRC4 key
Extension 1: Inserting new state (Key Exchange)
SASL Loop
Binary Protocol Transitions
Entering state 2(SASL protocol)
Entering state 1(Binary protocol) SASL loop に入る前にプロトコル種別と鍵を確認する
drive_machine
event_handler
conn_new
update_event
try_read_command
complete_nread
complete_nread_binary
Handling ID and Password
SASL_LIST_DATA
SASL_AUTH_STEP
SASL_LIST_MECHs
store_item
Binary Protocol Substates
Reentrant TriggerState
Entering State
Returning State
Loop of Third-party Software修正不可能
プロトコル拡張のポイント① システムが Third-party software(SASLライブラリ)のループに入ると、サーバソフトウェアでの修正は不可能になる。② ループに入る前の条件分岐( switch-case) の直前の case の関数を修正する。
Extention 2:Inserting new state (ID and password)
#0 process_bin_complete_sasl_auth (c=0x7ffff00261c0) at memcached.c:1727#1 0x0000000000408e85 in complete_nread_binary (c=0x7ffff00261c0) at memcached.c:2265#2 0x000000000040b7f1 in complete_nread (fd=<value optimized out>, which=<value optimized out>, arg=0x7ffff00261c0) at memcached.c:2296#3 drive_machine (fd=<value optimized out>, which=<value optimized out>, arg=0x7ffff00261c0) at memcached.c:3979#4 event_handler (fd=<value optimized out>, which=<value optimized out>, arg=0x7ffff00261c0) at memcached.c:4193#5 0x00007ffff7dd6b44 in event_base_loop () from /usr/lib64/libevent-1.4.so.2#6 0x00000000004109ed in worker_libevent (arg=0x62ee50) at thread.c:385#7 0x00000034496079d1 in start_thread () from /lib64/libpthread.so.0#8 0x0000003448ee8b6d in clone () from /lib64/libc.so.6
0x7fffe80263ed: "root"0x7fffe80263f2: "root"0x7fffe80263f7: "memcached"0x7fffe8026401: ""0x7fffe8026402: ""Continuing.
drive_machine
complete_nread_binary(c)
process_bin_complete_sasl_auth(c)
event_handler
#0 process_bin_complete_sasl_auth (c=0x7ffff00261c0) at memcached.c:1727#1 0x0000000000408e85 in complete_nread_binary (c=0x7ffff00261c0) at memcached.c:2265どちらの状態を修正しても暗号化は可能。システム負荷率などの副作用については調査中
修正候補の状態*2
do_store_item
do_item_get_nocheck
do_item_get_nodeleted
do_item_remove
do_store_replace
do_item_link
accoc_insert
do_item_update
Item_link_q
assoc_find
hash
item_free
item_unlink
Item_delete_lock_over
complete_nread_binary
store_item
drive_machinecomplete_nread
Handling key-value itemsDelete
Store
Prepare
Extention 3:Inserting new state (Items Encyrption) #0 do_store_item (it=0x7ffff7f07f70, comm=2, c=0x6b6170, hv=238646833)
at memcached.c:2307#1 0x00000000004147a5 in store_item (item=0x7ffff7f07f70, comm=2, c=0x6b6170) at thread.c:607#2 0x0000000000405ad1 in complete_update_bin (c=0x6b6170) at memcached.c:1170#3 0x00000000004087bf in complete_nread_binary (c=0x6b6170) atmemcached.c:2241#4 0x000000000040893d in complete_nread (c=0x6b6170) at memcached.c:2296#5 0x000000000040db1a in drive_machine (c=0x6b6170) at memcached.c:3979#6 0x000000000040e604 in event_handler (fd=34, which=2, arg=0x6b6170)at memcached.c:4193#7 0x00007ffff7ba6254 in event_base_loop () from /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5of #8 0x0000000000413fbd in worker_libevent (arg=0x636af0) at thread.c:385#9 0x00007ffff755cb50 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0#10 0x00007ffff72a695d in clone () from /lib/x86_64-linux-gnu/libc.so.6#11 0x0000000000000000 in ?? ()$5 = 0x2 <Address 0x2 out of bounds>
2308 item *old_it = do_item_get(key, it->nkey, hv);$6 = 0x7ffff7f07fa8 "abcI 0 6\r\nvalue2\r\nroot"Continuing.
do_store_itemdo_item_get_n
ocheck
do_item_get_nodeleted
complete_nread_binary
store_item
complete_nread# global -t itemitem memcached.h 353
struct conn
struct item
ExperimentWe compiled our sys- tem on Linux 2.6.32-358.18.1.el6.x86_64. Proposed system is hosted on Intel Xeon E312xx with 2.5 GHZ clock.
1 2 3 4 5 6 7 8 9 1011 12131415 161718 192021 2223 242526 27282930 313233 343536 373839 404142728000
729000
730000
731000
732000
733000
734000
735000
736000 memory 利用率 (per sec)
encryptionno encryption no encryption
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2941.5
42
42.5
43
43.5
44
44.5
45
45.5
46
46.5
CPU 負荷率( idle time, per sec)
encyrption no encyption
Conclusion( キャッシュレイヤーでの暗号プロトコル拡張)■ 近年、クラウドコンピューティングの普及などにより、分散システムを高速化するキャッシュレイヤーの導入が盛んに行われている。■ しかしながら、キャッシュは局所性を利用した性能向上を主眼としており、攻撃解析の対象になりやすく、キャッシュ上に置かれるデータの安全性については殆ど検討されていないのが現状である。■ また、キャッシュと本体システムの通信はコールバック関数を多用した非同期方式をとるため、暗号プロトコルをどのように組み合わせるか、またかは拡張するかについては殆ど考慮されてない。■ 本論文では Memcached –Distibuted Object caching sysmtem を対象に、キャッシュレイヤーに適した暗号方式の拡張方法を提案する。■ プロトコルは SASL ( Simple Authentication Security Layer )を扱い、許容可能なシステム負荷で運用が可能なストリーム暗号を組み込むことを成功した。(CPU負荷率で1~2%、メモリ利用率で1%以下)