SCIS 2016: An efficient slab encryption using extended SASL protocol
1. An efficient slab encryption using
extended SASL protocol
Ruo ANDO
Network Security Institute,
National Institute of Information and
Communications Technology
暗号と情報セキュリティシンポジウム
2016年 1月 22日(金)
4C2 システムセキュリティ
11:00--12:40
3. 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 配備も該当。
可用性+分断耐性 (DNSSec, CryptoDB)
可用性+分断耐性のケースでも、一定時間以内に一貫性を成立させるシステム
(結果整合性; eventually consistent)は構築可能である。Amazon SimpleDB や
Apache Cassandra などがこの方式を採用している。DNS や HTTP キャッシュなど
も該当。3種の中ではこの方式が最も障害に強い。
一貫性+分断耐性 ( ??? )
Apache HBase などが採用している。HBase の場合、単一障害点がある上、ネット
ワーク分断に対して整合性をとる仕組みが不完全であるため、可用性が犠牲と
なっている。
CP(一貫性・分断耐性)型に適した暗号方式
については
殆ど検討されていない。
http://www.erlang-
factory.com/upload/presentations/330/riak-efl.pdf
6. 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
現在、これらの問題についてのシステムレベルでの根本的な対応策は提示されてない。情報漏洩
を防ぐためにはプロトコルを拡張して暗号化して守る必要がある。
7. Slab allocator
問題点1 inline関数のインターセプトの非現実性
Slab Allocatorはアプリケーション特有に実装される
ため、カーネル側の処理(malloc, freeのフックなど)
で暗号化するには現実的ではない。
Hash Table
88 bytes 88 bytes
88 bytes
Slab Class 1
112 bytes 112 bytes
112 bytes
Slab Class 2
144 bytes 144 bytes
144 bytes
Slab Class 3
n bytes n bytes
n bytes
Slab Class n / m
Class
ID
Table
#0 do_slabs_newslab (id=id@entry=1) at slabs.c:196
#1 0x0000000000411ef7 in do_slabs_alloc (id=1,
size=82) at slabs.c:235
#2 slabs_alloc (size=size@entry=82, id=id@entry=1) at
slabs.c:404
#3 0x0000000000412c19 in do_item_alloc
(key=0x7fffec0390a4 "keystring",
nkey=9, flags=<optimized out>, exptime=0, nbytes=10,
cur_hv=0) at items.c:188
Key-Value
“keystring”
問題点2 OS primitiveとのsemantic gap
Slab class 1-n は起動時に初期化され、
アプリケーション固有に処理される。そのため、OS
のプリミティブ関数(malloc, free)の操作と、Slab
Allocatorの処理との間にsemantic gapが生じる。
12. 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:
サーバライブラリと
クライアントで共有される手順
(拡張・修正不可能)
13. SASL protocol header
(RFC 4422)
#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.この部分を援用してストリーム暗号の
鍵交換に使う。