12
A scalable and lightweight code checker using document database ココココココココココココココココココ 2014 CSS 2014 – Computer Security Symposium 10 月 24 月 14:50 – 16:29 2D4: 月月月 月月月月月月 月月月月 月月月月月月月月 月月月月月月月月月月月月月月月

Css2014 ruo ando_2014-10-23-01

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Css2014 ruo ando_2014-10-23-01

A scalable and lightweight code checker using documentdatabase

コンピュータセキュリティシンポジウム 2014

CSS 2014 – Computer Security Symposium

10 月 24 日 14:50 – 16:29

2D4: 脆弱性・テイント解析

安藤類央情報通信研究機構ネットワークセキュリティ研究所

Page 2: Css2014 ruo ando_2014-10-23-01

概要: towards lightweight and scalable code checker

本論文では、 key-value を処理データ構造として持つ Document Dasebase を用いて、ドメイン固有知識と中間表現の分離を行い (lightweight) 、大規模なファイル処理に耐えるシステム (scalability) を構築する。

■ 脆弱性の性質の変化と検査方法のトレンド検査手法の性質の二極化。モデル駆動方式によるプロトコル脆弱性の解析と、広範なテキストファイルを処理するシステム脆弱性の解析

■ スケーラビリティと False Negative :Key-Value による検査対象コードと脆弱性情報の中間表現の構築NoSQL の適用によるアーキテクチャ面でのスケーラビリティの向上

■ 脆弱性攻撃の開発スパンの短縮:ドメイン固有知識と中間表現の分離

https://github.com/RuoAndo/Saturator-1http://www.slideshare.net/RuoAndo/css2014-ruo-ando2014102301

Page 3: Css2014 ruo ando_2014-10-23-01

設計方針 (Scalability vs False Negatives)In designing vulnerability checker, we face the difficult choice  between precision and scalability. Particularly, security system  design is forced to emphasize either false negatives or false positives. In todayfs large scale computing era, we conclude that a   false negative rate should be as close to 0 as possible.

As of January 2013, GitHub had grown to 3 million users and 4.9 million repositories (repositories are histories of code shared on the site). [9] And by December of this year, the company hit 10 million repositories.

http://slideplayer.us/slide/703331/

Page 4: Css2014 ruo ando_2014-10-23-01

Long term trend ( 検査方式と対象) 

ITS4ACSAC 2000

MOPSCCS 2002

MC Meta-Level CompilationOSDI 2000

MACEConcolic ExecutionUSENIX SEC 2011

COTS (ROP)Usenix 2013

AutomationNDSS 2000

Format StringUSENIX SEC 2001

MOPS (2)CCS 2004

MetaSymsploitUSENIX SEC 2013

CHUCKYCCS 2013

Computational Verification (proverif)

CCS 2012

ConfAidOSDI 2011

Metal Compiler ExtentionSSP 2002

SLAMPOPL 2002

ForNox Hot SDN 2012

DowserUSENIX SEC 2013

F7 verificationCCS 2010

StackGuardUSENIX SEC 1998

Branch Tracing (ROP) Usenix Sec 2013

ProverifSSP 2006 プロトコル検

複合型

設定整合性

誤警報・攻撃の迅速化

Page 5: Css2014 ruo ando_2014-10-23-01

検査方法の分類■ 構文主導型 (Syntax Directed Translation)  - This translator consists of a parser (or grammar) with embedded actions that immediately generate output.正規表現、有限オートマトンITS4: a static vulnerability scanner for C and C++   code, Computer Security Applications, ACSAC 2002Chucky: exposing missing checks in source code for vulnerability discovery ccs 2013

■ ルール方式 (Rule Based Translation) - Rule-based translators use the DSL of a particular rule engine to specify a set of “this goes to that” translation rules.遷移規則、プッシュダウンオートマトンUsing programmer-written compiler extensions to catch security holes SSP 2002Checking system rules using system-specific, programmer-written compiler extensions OSDI 2000

■ モデル駆動方式 (Model Driven Translation) - From the input model, a translator can emit output directly, build up strings, build up templates (documents with “holes” in them where we can stick values), or build up specialized output objectsモデル検査・実行系MOPS: an infrastructure for examining security properties of software CCS2002Chucky: exposing missing checks in source code for vulnerability discovery ccs 2013

Page 6: Css2014 ruo ando_2014-10-23-01

提案手法1Main Loop

Lexer

NFA (有限オートマトン)

PDA( プッシュダウンオートマトン)

Token Analyzer

Block Handler

識別子(制御文、メモリ操作命令など)

の検出と処理

ブロック文(繰り返し、分岐)のネスト

管理

Document Database

脆弱性に関する

ドメイン固有知識

Key-Value形式による

検索要求

Saturator-1lightweight code checker with document databasehttps://github.com/RuoAndo/Saturator-1

Key-Value(JSON)による中間表現の

構築

Iteration for each token

構文主導方式

ルール方式

Page 7: Css2014 ruo ando_2014-10-23-01

3つの検査方法:データ表現形式とドメイン固有知識検査対象

プログラム

状態遷移式

ルール

モデルチェッカー

実行系

データベース

正規表現

述語論理式 定理証明系

中間表現

トランスレータ・実行系

CFG

モデル駆動方式

ルール方式

ボトルネック:セキュリティに

関するドメイン固有知識

構文主導方式

Page 8: Css2014 ruo ando_2014-10-23-01

提案手法2Main Loop

Lexer

NFA (有限オートマトン)

PDA( プッシュダウンオートマトン)

Token Analyzer

Block Handler

識別子(制御文、メモリ操作命令など)

の検出と処理

ブロック文(繰り返し、分岐)のネスト

管理

Document Database

脆弱性に関する

ドメイン固有知識

Key-Value形式による

検索要求

Saturator-1lightweight code checker with document databasehttps://github.com/RuoAndo/Saturator-1

Key-Value(JSON)による中間表現の

構築

Iteration for each token

脆弱固有知識

の排除

ルール方式

構文主導方式

Page 9: Css2014 ruo ando_2014-10-23-01

提案手法3Main Loop

Lexer

NFA (有限オートマトン)

PDA( プッシュダウンオートマトン)

Token Analyzer

Block Handler

識別子(制御文、メモリ操作命令など)

の検出と処理

ブロック文(繰り返し、分岐)のネスト

管理

Saturator-1lightweight code checker with document databasehttps://github.com/RuoAndo/Saturator-1

Iteration for each token

    switch (charatyp[ch]) f

case Letter:for ( ; charatyp[ch]==Letter ||

charatyp[ch]==Digit;ch=nextCh())if (p < p 16) p++ = ch;p = '\0'

if(strcmp(tkn.text, “for")==0)

Document Database処理系の状態情報

(プログラム中の位置など)

問い合わせ

格納

Page 10: Css2014 ruo ando_2014-10-23-01

繰り返し( For 文){ “_id” : ObjectId(“53d28a5a40c2acf65bbbf9a9”), “ start_line" : "209", "end_line" : "250", "functionName" : "xc_domain_getinfo", “ functionLine" : "197", "filename" : "xc_domain.c“}

{"_id" : ObjectId("53d28ab940c2acf65bbbf9b1"), "start_line" : "212", "end_line" : "253", "functionName" : "xc_domain_getinfo", "functionLine" : "200", "filename" : "xc_domain.c“}

1 void DBop realloc(char line, char functionName, char functionLine, char filename)2 1415 mongoc init ();1617 client = mongoc client new (uristr);18 if (!client) f19 fprintf (stderr, "Failed to parse URI.\n");␣ ␣ ␣2122 bson init (&query);2324 bson append utf8 (&query, "located", line);25 bson append utf8 (&query, "functionName", -1,functionName);26 bson append utf8 (&query, "functionLine", -1,functionLine);27 bson append utf8 (&query, "filename", -1, filename,-1);2829 collection = mongoc client get collection (client, "cci",collection name);3031 mongoc collection insert (collection,32 MONGOC QUERY NONE,33 &query,34 NULL,35 NULL);

realloc

{"_id" : ObjectId("53d291fe40c2acf65bbbf9f7"), "located" : "145

"functionName" : "xc_vcpu_setaffinity", "functionLine" : "116", "filename" : "xc_domain.c" }

Page 11: Css2014 ruo ando_2014-10-23-01

評価実験 CVE-2013-4371

12

{"_id" : ObjectId("53f9ec4764e21cef244d69fb"), "located" : "402", "functionName" : "libxl_list_cpupool", "functionLine" : "388", "filename" : "libxl.c“}34{"_id" : ObjectId("53f9ec9464e21cef244d6a0e"), "start_line" : "398", "end_line" : "420", "functionName" : "libxl_list_cpupool", "functionLine" : "388", "filename" : "libxl.c“}

realloc

{"_id" : ObjectId("53d291fe40c2acf65bbbf9f7"), "located" : "145

"functionName" : "xc_vcpu_setaffinity", "functionLine" : "116", "filename" : "xc_domain.c" }

Xen-4.1.2real 2m25.632suser 0m9.233ssys 0m23.729s

> db.forloop.count() 15205> db.function.count() 1742> db.realloc.count()126

Xen-4.0.1real 4m3.567suser 0m9.289ssys 0m22.529s

> db.forloop.count() 27595> db.function.count() 3099> db.realloc.count() 228

Use-after-free vulnerability in the libxl_list_cpupool function in the libxl toolstack library in Xen 4.2.x and 4.3.x, when running "under memory pressure," returns the original pointer when the realloc function fails, which allows local users to cause a denial of service (heap corruption and crash) and possibly execute arbitrary code via unspecified vectors.http://www.cvedetails.com/cve/CVE-2013-4371/

We compiled our system on ubuntu12 LTS with Linux kernel 3.2.0. proposed system is hosted on Intel Xeon E5645 with 2.4 GHZ clock.

Page 12: Css2014 ruo ando_2014-10-23-01

まとめ: towards lightweight and scalable code checker

■ 脆弱性の性質の変化と検査方法のトレンド検査手法の性質の二極化。モデル駆動方式によるプロトコル脆弱性の解析と、広範なテキストファイルを処理するシステム脆弱性の解析

■ スケーラビリティと False Negative :Key-Value による検査対象コードと脆弱性情報の中間表現の構築NoSQL の適用によるアーキテクチャ面でのスケーラビリティの向上

■ 脆弱性攻撃の開発スパンの短縮:ドメイン固有知識と中間表現の分離

本論文では、 key-value を処理データ構造として持つ Document Dasebase を用いて、ドメイン固有知識と中間表現の分離を行い (lightweight) 、大規模なファイル処理に耐えるシステム (scalability) を構築した。

https://github.com/RuoAndo/Saturator-1http://www.slideshare.net/RuoAndo/css2014-ruo-ando2014102301