現実世界での機械学習によるアノマリ検知システムの構築と回避 by Clarence Chio - CODE BLUE 2015

CODE BLUE
CODE BLUECODE BLUE
現実世界での
機械学習による
アノマリ検知システムの
構築と回避
機械学習
私の目標
• 機械学習によるアノマリ検知システムの概略を伝える
• いつ/どこで/どのように システムを構築するか議論に火をつける
• システムが どれくらい 「安全」 か調査する
• 私達はここからどこに向かうか議論する
アノマリ検知 機械学習vs.
分類基準
分類基準
アノマリ検知機械学習
ヒューリスティック/ルールベース
予測モデルによる機械学習
侵入検知?
現実世界での機械学習によるアノマリ検知システムの構築と回避 by Clarence Chio - CODE BLUE 2015
199.72.81.55 - - [01/Jul/1995:00:00:01 -0400] "GET /history/apollo/ HTTP/1.0" 200 6245
unicomp6.unicomp.net - - [01/Jul/1995:00:00:06 -0400] "GET /shuttle/countdown/ HTTP/1.0" 200 3985
199.120.110.21 - - [01/Jul/1995:00:00:09 -0400] "GET /shuttle/missions/sts-73/mission-sts-
73.html HTTP/1.0" 200 4085
burger.letters.com - - [01/Jul/1995:00:00:11 -0400] "GET /shuttle/countdown/liftoff.html HTTP/
1.0" 304 0
199.120.110.21 - - [01/Jul/1995:00:00:11 -0400] "GET /shuttle/missions/sts-73/sts-73-patch-
small.gif HTTP/1.0" 200 4179
burger.letters.com - - [01/Jul/1995:00:00:12 -0400] "GET /images/NASA-logosmall.gif HTTP/1.0" 304 0
burger.letters.com - - [01/Jul/1995:00:00:12 -0400] "GET /shuttle/countdown/video/
livevideo.gif HTTP/1.0" 200 0
205.212.115.106 - - [01/Jul/1995:00:00:12 -0400] "GET /shuttle/countdown/countdown.html HTTP/
1.0" 200 3985
この中からどのようにアノマリを見つける???
機械学習の技術は
しきい値/ルールベースの
ヒューリスティックと比べて
なぜ魅力的なのか?
• 適応的
• 動的
• (理論的に)人の介入が最小
しかし…
しきい値/ルールベースの
ヒューリスティックはなぜ良いか?
• 簡単な理由
• シンプル&理解しやすい
• 動的/適応的にも出来る
好評な機械学習のアプリケーション
好評な機械学習のアプリケーション
好評な機械学習のアプリケーション
期待値を設定
機械学習+アノマリ検知の大問題点
多くの機械学習+アノマリ検知の研究があるが、
現実世界で成功したシステムはあまり多くない。
なぜ?
アノマリ検知:
従来の機械学習:
新規の攻撃を発見する、
今まで見たことないものを見分ける
パターンを学習する、
似たものを見分ける
機械学習+アノマリ検知の大問題点
アノマリ検知は何が違うのか?
機械学習の他の問題点と基本的に異なる
• とても多い誤検知
• 訓練データの不足
• 「意味上の隔たり」
• 評価の難しさ
• 攻撃者の設定
もしシステムが間違ったら・・・
本当に悪い
• 他の学習アプリケーションと
比べて、誤検知の被害が
とても大きい
• もし高い偽陽性率なら何が
起こるか?
• 高い偽陰性率なら?
訓練データの不足・・・
• どのデータでモデルを学習させるか?
• 入力データをクリーンにすることが大変!
結果/警告を解釈することが大変・・・
「意味上の隔たり」
ok… 警告は分かった…
なぜ警告が出ているのか…?
評価の問題
• しっかりした評価体系を考案することはシステムそのもの
を構築するよりさらに難しい
• 学術研究論文での機械学習によるアノマリ検知評価に
依存しているという問題
攻撃者の影響
高度な当事者は
システムを回避するために
時間と労力を費やすことが
出来る(費やすだろう)
どのようにして現実世界の
アノマリ検知システムは
失敗してきたのか?
• 多くの偽陽性
• 攻撃がない訓練データの発見が大変
• 深く理解しないで使用
• ポイズニングモデル
それで・・・絶望した?
こうしよう!
• 時系列を生成する
• 代表的な特徴を選び出す
• 「正常」のモデルを訓練/調整する
• 入力点がモデルから外れたら警告する
インフラの例
Sensitivity of PCA for Traffic Anomaly Detection, Ringberg et. al.
密度に基づく
部分空間/相関に基づく
サポートベクターマシン
クラスタリング
ニューラルネットワーク
共通の技術
「モデル」?
クラスタ
• 重心法
• 「逐次学習」によい
どのようにして特徴を選び出すか?
• 結局は問題の最も挑戦的な部分にたびたびなる
• 単なるパラメータの最適化問題ではないか?
どのようにして特徴を選び出すか?
難しさ:
• 繰り返すべき組み合わせが非常に多い!
• 評価が大変
• 頻繁に「最適」が変わる
• 基準だけではなく性能の精度
• 改良されたモデルの説明力
• より短い訓練期間
• 高度な一般化/削減された過学習
主成分分析
• 自動的に特徴を選び出すための共通の
統計的な手法
どのように?
• データを異なる次元に変換する
• データの分散を最もよく表すことの出来る
次元の順序付きのリスト(主成分)を返す
主成分分析
http://setosa.io/ev/principal-component-analysis/
射影
主成分分析
http://setosa.io/ev/principal-component-analysis/
主成分分析
http://setosa.io/ev/principal-component-analysis/
本当の主成分分析の結果、
分散を最大化した図
主成分分析
データセットの分散の80-90%に及ぶ
主成分を選ぶ
「固有値」プロット
効果がより大きい
主成分分析
使用した主成分の数
累積的な%分散図
100804020060
10^0 10^1 10^2 10^3
効果がより小さい
主成分分析
どのように共通的な落とし穴を
回避するか?
• 脅威モデルをよく理解する
• 検知範囲を狭めたままにする
• 偽陰性/陽性の損失を減らす
意味上の
隔たりを
補う
もし、未来に問題が有るのであれば、それは、過去を分析
することと現在を理解することに失敗したからでしかない。
私のアノマリ検知器は
どれくらい良いか?
偽陽性を
どのくらい簡単に除外できるか?
本当のポジティブを評価する?
私のアノマリ検知器は
どれくらい良いか?
どのように攻撃するか?
最も重要な質問・・・
どのように攻撃するか?
特定の攻撃を許すように
学習システムを操作する
信頼性を損なうように
システムの性能を低下させる
つまらないもの
主成分分析システムへの攻撃
攻撃前の
中心
攻撃後の
中心
「つまらないもの」
攻撃前
攻撃後
「つまらないもの」
明確ではない
攻撃の方向
主成分分析システムへの攻撃
茹でガエル
攻撃
主成分分析システムへの攻撃
つまらない量 vs. 注入期間
検知を回避するために、ゆっくりする!
どのようにこれを防ぐか?
較正テストセットを整備する
どのようにこれを防ぐか?
後前
決定境界の
検出率
どのようにこれを防ぐか?
主成分分析システムへの攻撃
攻撃前
攻撃後
決定境界の領域
機械学習を安全に出来るか?
教師なし逐次学習での実現は簡単ではない
攻撃の速度を落とす
攻撃目標にされたときに
検知する時間が与えられる
どのようにこれを防ぐか?
改良された主成分分析
• 対策
• 主成分の追及
• ロバスト主成分分析
ロバスト統計
平均の代わりに中央値を使う
主成分分析の「分散」最大化 vs. 対策の「中央絶対偏差」
データセットをモデル化する適切な分布を見つける
正規/ガウス分布 vs. ラプラス分布
ロバスト主成分分析を使う
自分のテスト
本物のデータを使って
自分のシミュレーションを動かした・・・
なぜこんなことをしたか?
第一主成分に射影
「攻撃目標の流れ」に射影
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
ところで、
このつまらない
ものを生成する
ことは大変
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
「攻撃目標の流れ」に射影
第一主成分に射影
間違った警告率(偽陽性率)
ポイズニング検知率(真陽性率)
1.00.80.40.200.6
0 0.2 0.4 0.6 0.8 1.0
真陽性率 vs. 偽陽性率
攻撃期間
(訓練期間の数)
回避成功率(偽陰性率)
1.00.80.40.200.6
0 2 4 6 8 10
つまらないものを注入 0% 10% 20% 30% 40% 50%
茹でガエル向け
単純な注入向け
回避成功率
単純な主成分分析 ロバスト(な)主成分分析
単純なつまらな
いものの注入
(50%の注入、
たった一つの訓練期間)
~ 76% 回避成功 ~ 14% 回避成功
茹でガエルの
注入
(10の学習期間)
~ 87% 回避成功 ~ 38% 回避成功
• あまり良くないけど、改良されている・・・
• 純粋な機械学習のアノマリ検知システムは
ずっと妥協されやすい
• 特徴やしきい値を見つけるために機械学習を使い、
静的ルールを用いてアノマリ検知を流動的に行う
今日のアノマリ検知システム
次はなに?
• 他の人が作ったアノマリ検知システムでさらにテストする
• ポイズニング技術に対する他の防御
• 機械学習モデルの耐障害モードで実験する
現実世界での機械学習によるアノマリ検知システムの構築と回避 by Clarence Chio - CODE BLUE 2015
現実世界での機械学習によるアノマリ検知システムの構築と回避 by Clarence Chio - CODE BLUE 2015
cchio@shapesecurity.com
@cchio
1 of 75

More Related Content

What's hot(20)

情報アーキテクチャ入門情報アーキテクチャ入門
情報アーキテクチャ入門
Manami Nakamura3.2K views
Data-Centric AIの紹介Data-Centric AIの紹介
Data-Centric AIの紹介
Kazuyuki Miyazawa3.8K views
Data-centricなML開発Data-centricなML開発
Data-centricなML開発
Takeshi Suzuki4.7K views
UXデザイン概論 2019UXデザイン概論 2019
UXデザイン概論 2019
Masaya Ando12.8K views
AWSではじめるMLOpsAWSではじめるMLOps
AWSではじめるMLOps
MariOhbuchi3.2K views
Slideshare JapaneseSlideshare Japanese
Slideshare Japanese
Hidenori Goto127K views

More from CODE BLUE(20)

現実世界での機械学習によるアノマリ検知システムの構築と回避 by Clarence Chio - CODE BLUE 2015

Editor's Notes

  1. What anomaly detection can do for you what anomaly detection cannot do for you When is anomaly detection helpful? When is anomaly detection not helpful?
  2. If you came into this with a blank slate, and wanted to set up an anomaly detection system, how would you do it? (step-by-step) come up with an hypothetical, specific use case, walk through the steps. generating time-series extracting features tuning model parameters evaluating
  3. If you came into this with a blank slate, and wanted to set up an anomaly detection system, how would you do it? (step-by-step) come up with an hypothetical, specific use case, walk through the steps. generating time-series extracting features tuning model parameters evaluating
  4. briefly evaluate various ways, classification models, why PCA is helpful (extract features in high dimensionality spaces)
  5. briefly evaluate various ways, classification models, why PCA is helpful (extract features in high dimensionality spaces)
  6. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  7. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  8. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  9. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  10. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  11. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  12. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  13. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  14. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  15. given that the nature of traffic is often changing and non-uniform, how do you consistently select features in an online fashion that keeps up with the seasonality of the data? it turns out that this is unarguably the hardest part of outlier detection, and has to be done, because in very few scenarios can you just train a static model once and the detector will work fine forever. thinking about it, if that is indeed the case, then you don’t have to deal with the complexity of ML anomaly detection techniques. you can use a simple rule/detector engine to alert when datapoints that does not fit the expected trend arrive. Explain PCA, demo of PCA, visualization of what PCA looks like
  16. how would you go about evaluating the efficacy of the system? finding the true FNR of the detector - hard? non-trivial problem, but it all boils down to FNR vs FPR define fnr and fPr does FNR/FPR change over time?
  17. how would you go about evaluating the efficacy of the system? finding the true FNR of the detector - hard? non-trivial problem, but it all boils down to FNR vs FPR define fnr and fPr does FNR/FPR change over time?
  18. lets say you wanted to get past an anomaly detector we can make several different assumptions about the power that you have. what do you know? global knowledge? local knowledge?
  19. lets say you wanted to get past an anomaly detector we can make several different assumptions about the power that you have. what do you know? global knowledge? local knowledge?