Identifying Information Disclosure in Web Applications with - - PowerPoint PPT Presentation

identifying information disclosure in web applications
SMART_READER_LITE
LIVE PREVIEW

Identifying Information Disclosure in Web Applications with - - PowerPoint PPT Presentation

Identifying Information Disclosure in Web Applications with Retroactive Auditing Haogang Chen , Taesoo Kim, Xi Wang Nickolai Zeldovich, and M. Frans Kaashoek MIT CSAIL Data breach: an enduring problem Data breach: an enduring problem What


slide-1
SLIDE 1

Identifying Information Disclosure in Web Applications with Retroactive Auditing

Haogang Chen, Taesoo Kim, Xi Wang
 Nickolai Zeldovich, and M. Frans Kaashoek MIT CSAIL

slide-2
SLIDE 2

Data breach: an enduring problem

slide-3
SLIDE 3

Data breach: an enduring problem

slide-4
SLIDE 4

What to do about it?

slide-5
SLIDE 5

What to do about it?

  • Before data breach: prevention techniques
  • privilege separation
  • encryption
  • information flow control
slide-6
SLIDE 6

What to do about it?

  • Before data breach: prevention techniques
  • privilege separation
  • encryption
  • information flow control
  • After a potential data breach: damage control
slide-7
SLIDE 7

Observation:
 Damage control is costly

  • Notify the victims
  • Data Breach Notification Laws (40/50 states)

slide-8
SLIDE 8

Observation:
 Damage control is costly

  • Notify the victims
  • Data Breach Notification Laws (40/50 states)


“…… However, your contact information — name, address, phone number and email address — was compromised.”

slide-9
SLIDE 9

Observation:
 Damage control is costly

  • Notify the victims
  • Data Breach Notification Laws (40/50 states)

  • Pay for credit monitoring & fraud protection
slide-10
SLIDE 10

Observation:
 Damage control is costly

  • Notify the victims
  • Data Breach Notification Laws (40/50 states)

  • Pay for credit monitoring & fraud protection
  • e.g., University of Maryland pledges to offer its

309,079 victims for 5-year of credit monitoring

slide-11
SLIDE 11

Opportunity: Some data might not be leaked

slide-12
SLIDE 12

Opportunity: Some data might not be leaked

  • The vulnerability might not have been exploited yet
slide-13
SLIDE 13

Opportunity: Some data might not be leaked

  • The vulnerability might not have been exploited yet
  • Attackers might not steal all data that they can

slide-14
SLIDE 14

Opportunity: Some data might not be leaked

  • The vulnerability might not have been exploited yet
  • Attackers might not steal all data that they can

  • Goal: precisely identify breached data items
slide-15
SLIDE 15

Opportunity: Some data might not be leaked

  • The vulnerability might not have been exploited yet
  • Attackers might not steal all data that they can

  • Goal: precisely identify breached data items
  • Target damage control at real victims only
slide-16
SLIDE 16

State of the art

  • Log all accesses to sensitive data
  • Inspect logs after an intrusion
slide-17
SLIDE 17

State of the art

  • Log all accesses to sensitive data
  • Inspect logs after an intrusion
  • Problems
  • Need to know what is sensitive data beforehand
slide-18
SLIDE 18

State of the art

  • Log all accesses to sensitive data
  • Inspect logs after an intrusion
  • Problems
  • Need to know what is sensitive data beforehand
  • Hard to tell legal v.s. illegal accesses
slide-19
SLIDE 19

State of the art

  • Log all accesses to sensitive data
  • Inspect logs after an intrusion
  • Problems
  • Need to know what is sensitive data beforehand
  • Hard to tell legal v.s. illegal accesses
  • Takes a long time:


e.g., University of Maryland: one month to inspect 309,079 breached records

slide-20
SLIDE 20

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed

slide-21
SLIDE 21

Web
 Application

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed

slide-22
SLIDE 22

Web
 Application

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed

Alice Pumpkin

slide-23
SLIDE 23

Web
 Application

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed

patch fix ACL

  • r
slide-24
SLIDE 24

Web
 Application

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed replay

patch fix ACL

  • r

Pumpkin

slide-25
SLIDE 25

breach report Web
 Application

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed replay

patch fix ACL

  • r
slide-26
SLIDE 26

breach report Web
 Application

Solution: Rail

  • Goal: precisely identify previously breached data

after a vulnerability is fixed replay

session info
 (IP, user, time) data item fields patch fix ACL

  • r
slide-27
SLIDE 27

Challenge

  • State during replay can diverge from the original execution
slide-28
SLIDE 28

Challenge

  • State during replay can diverge from the original execution
  • Prior systems use record and replay for integrity



 
 
 
 


slide-29
SLIDE 29

Challenge

  • State during replay can diverge from the original execution
  • Prior systems use record and replay for integrity



 
 
 
 


Retro [OSDI ’10]
 Warp [SOSP ’11]

Record Replay

slide-30
SLIDE 30

Challenge

  • State during replay can diverge from the original execution
  • Prior systems use record and replay for integrity



 
 
 
 


Rad [APSys ’11] Poirot [OSDI ’12] Retro [OSDI ’10]
 Warp [SOSP ’11]

Record Replay

slide-31
SLIDE 31

Challenge

  • State during replay can diverge from the original execution
  • Prior systems use record and replay for integrity



 
 
 
 


  • Rail focuses on confidentiality

Rad [APSys ’11] Poirot [OSDI ’12] Retro [OSDI ’10]
 Warp [SOSP ’11]

Record Replay

slide-32
SLIDE 32

Challenge

  • State during replay can diverge from the original execution
  • Prior systems use record and replay for integrity



 
 
 
 


  • Rail focuses on confidentiality
  • For precision, Rail must match up state and minimize

state divergence between the two executions

Rad [APSys ’11] Poirot [OSDI ’12]

Rail

Retro [OSDI ’10]
 Warp [SOSP ’11]

Record Replay

slide-33
SLIDE 33

Contribution

  • Record and replay scheme for identifying data

disclosures

  • APIs for application developers
  • Context matching to improve precision
  • Prototype based on Meteor web framework
  • Result: few changes to applications, precise, fast
slide-34
SLIDE 34

Focus and assumptions

  • Focus: web applications
  • Our prototype is based on, but not limited to, Meteor
slide-35
SLIDE 35

Focus and assumptions

  • Focus: web applications
  • Our prototype is based on, but not limited to, Meteor
  • Assumptions
  • Trusts the software stack below the web application
  • TCB: web framework, runtime, DBMS, OS, etc.
  • Requests do not change during replay, except for fixes
  • Requests are serializable, etc.
slide-36
SLIDE 36

Basic approach

  • Record and replay the web application
  • Compare the outputs of two executions
slide-37
SLIDE 37

Basic approach

  • Record and replay the web application
  • Compare the outputs of two executions

web app
 + Rail API

slide-38
SLIDE 38

Basic approach

  • Record and replay the web application
  • Compare the outputs of two executions

web app
 + Rail API

request

  • utput

log record

slide-39
SLIDE 39

Basic approach

  • Record and replay the web application
  • Compare the outputs of two executions

web app
 + Rail API

request

web app
 + patch

  • utput

log record

slide-40
SLIDE 40

Basic approach

  • Record and replay the web application
  • Compare the outputs of two executions

web app
 + Rail API

request

web app
 + patch

  • utput
  • utput’

log record replay

slide-41
SLIDE 41

Basic approach

  • Record and replay the web application
  • Compare the outputs of two executions

web app
 + Rail API

request

web app
 + patch

  • utput
  • utput’

diff

𝚬

log record replay

slide-42
SLIDE 42

Technical challenges

web app + Rail API request web app
 + patch

  • utput
  • utput’

diff

𝚬

log record replay

slide-43
SLIDE 43

Technical challenges

  • Compare & identify data items at object level

web app + Rail API request web app
 + patch

  • utput
  • utput’

diff

𝚬

log record replay

slide-44
SLIDE 44

Technical challenges

  • Compare & identify data items at object level
  • Make replay deterministic

web app + Rail API request web app
 + patch

  • utput
  • utput’

diff

𝚬

log record replay

Non-deterministic inputs (date, random)

slide-45
SLIDE 45

Technical challenges

  • Compare & identify data items at object level
  • Make replay deterministic
  • Selective replay


for performance

web app + Rail API request web app
 + patch

  • utput
  • utput’

diff

𝚬

log record replay

Non-deterministic inputs (date, random)

slide-46
SLIDE 46

Technical challenges

  • Compare & identify data items at object level
  • Make replay deterministic
  • Selective replay


for performance

  • Minimize code changes


in the application

web app + Rail API request web app
 + patch

  • utput
  • utput’

diff

𝚬

log record replay

Non-deterministic inputs (date, random)

slide-47
SLIDE 47

Design: action history graph (AHG)

  • AHG [OSDI ’10] tracks dependencies among actions and
  • bjects
slide-48
SLIDE 48

Design: action history graph (AHG)

  • AHG [OSDI ’10] tracks dependencies among actions and
  • bjects
  • Actions
  • Triggered by external events

request /
 timer

slide-49
SLIDE 49

Design: action history graph (AHG)

  • AHG [OSDI ’10] tracks dependencies among actions and
  • bjects
  • Actions
  • Triggered by external events
  • All application code


is executed in the
 context of an action

action request /
 timer

slide-50
SLIDE 50

Design: action history graph (AHG)

  • AHG [OSDI ’10] tracks dependencies among actions and
  • bjects
  • Actions
  • Triggered by external events
  • All application code


is executed in the
 context of an action

  • Rail connects actions and

  • bjects as the code runs

action db/users args code db/log request /
 timer view/<sid> write read trigger

slide-51
SLIDE 51

Design: action history graph (AHG)

  • AHG [OSDI ’10] tracks dependencies among actions and
  • bjects
  • Actions
  • Triggered by external events
  • All application code


is executed in the
 context of an action

  • Rail connects actions and

  • bjects as the code runs
  • Rail stores AHG in a persistent log

action db/users args code db/log request /
 timer view/<sid> write read trigger

slide-52
SLIDE 52

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed
slide-53
SLIDE 53

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed

code

slide-54
SLIDE 54

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed

action #4 action #1 code action #3

Time

action #2

slide-55
SLIDE 55

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed

action #4 db/users db/log login/sid action #1 code action #3

slide-56
SLIDE 56

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed

action #4 db/users db/log login/sid action #1 code action #3 login/sid

slide-57
SLIDE 57

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed

action #4 db/users db/log login/sid action #1 action
 #8 code action #3 action #12 login/sid

slide-58
SLIDE 58

Selective replay using AHG

  • Rail replays each action


sequentially in the time order

  • Replays an action if


any of its inputs or


  • utputs are changed
  • Replay is guaranteed


to terminate

  • Never runs actions earlier


than current replaying action

action #4 db/users db/log login/sid action #1 action
 #8 code action #3 action #12 login/sid

slide-59
SLIDE 59

Selective replay using Object API

  • Rail must intercept all accesses to global objects
  • e.g., inputs, outputs, database items, 


session states, …

slide-60
SLIDE 60

Selective replay using Object API

  • Rail must intercept all accesses to global objects
  • e.g., inputs, outputs, database items, 


session states, …

  • Reasons
  • to track dependency between actions
  • to make continuous checkpoints of object states
slide-61
SLIDE 61

Selective replay using Object API

  • Developer must wrap all global objects in the app

using Rail’s object API
 
 
 
 


slide-62
SLIDE 62

Selective replay using Object API

  • Developer must wrap all global objects in the app

using Rail’s object API
 
 
 
 


slide-63
SLIDE 63

Selective replay using Object API

  • Developer must wrap all global objects in the app

using Rail’s object API
 
 
 
 


  • Global objects are quite standard in all web apps.
slide-64
SLIDE 64

Selective replay using Object API

  • Developer must wrap all global objects in the app

using Rail’s object API
 
 
 
 


  • Global objects are quite standard in all web apps.
  • Most wrappers can be done once in the framework
slide-65
SLIDE 65

// ¡Server ¡side ¡code ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡(new ¡Date)) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡Math.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

Example: homework submission

slide-66
SLIDE 66

// ¡Server ¡side ¡code ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡(new ¡Date)) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡Math.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

Example: homework submission

slide-67
SLIDE 67

// ¡Server ¡side ¡code ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡(new ¡Date)) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡Math.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

Example: homework submission

// ¡Server ¡side ¡code ¡using ¡Rail ¡API ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ var ¡ctx ¡= ¡Rail.inputContext(hw_id, ¡uid); ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡ctx.date()) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡ctx.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

slide-68
SLIDE 68

// ¡Server ¡side ¡code ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡(new ¡Date)) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡Math.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

Example: homework submission

// ¡Server ¡side ¡code ¡using ¡Rail ¡API ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ var ¡ctx ¡= ¡Rail.inputContext(hw_id, ¡uid); ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡ctx.date()) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡ctx.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

slide-69
SLIDE 69

// ¡Server ¡side ¡code ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡(new ¡Date)) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡Math.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

Example: homework submission

// ¡Server ¡side ¡code ¡using ¡Rail ¡API ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ var ¡ctx ¡= ¡Rail.inputContext(hw_id, ¡uid); ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡ctx.date()) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡ctx.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡ “call” action

input
 context

slide-70
SLIDE 70

// ¡Server ¡side ¡code ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡(new ¡Date)) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡Math.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡

Example: homework submission

// ¡Server ¡side ¡code ¡using ¡Rail ¡API ¡ var ¡Homeworks ¡= ¡App.getDBCollection(‘hws’); ¡ var ¡Answers ¡= ¡App.getDBCollection(‘answers’); ¡

  • App.method(‘submit’, ¡function ¡(hw_id, ¡answer) ¡{


¡ var ¡uid ¡= ¡App.getSessionUserId(); ¡ ¡ var ¡hw ¡= ¡Homework.findOne( ¡{_id: ¡hw_id} ¡);
 ¡ var ¡ctx ¡= ¡Rail.inputContext(hw_id, ¡uid); ¡ ¡ if ¡(!uid ¡|| ¡!hw ¡|| ¡hw.dueDate ¡< ¡ctx.date()) ¡ ¡ ¡ throw ¡new ¡Error(’Submission ¡failed’); ¡ ¡ Answers.insert( ¡{_id: ¡ctx.random(), ¡ ¡ ¡ ¡ ¡hw: ¡hw_id, ¡user: ¡uid, ¡answer: ¡answer} ¡); ¡ }); ¡ “call” action

database
 (answers) handler
 table code action argument input
 context session
 state database
 (hws)

slide-71
SLIDE 71

view

Uniform Object API

  • Rail provides a uniform API for different types of objects
  • Rail takes care of dependency tracking and

checkpointing

RailObject

+ getValue() ¡

// ¡accessor ¡

+ add(…,…) ¡

// ¡mutators ¡

+ …

  • ­‑ rollback(ts) ¡
  • ­‑ equiv(ts) ¡
  • ­‑ …

code argument

login database

context

inputs global
 states

slide-72
SLIDE 72
  • utputs

view

Uniform Object API

  • Rail provides a uniform API for different types of objects
  • Rail takes care of dependency tracking and

checkpointing

RailObject

+ getValue() ¡

// ¡accessor ¡

+ add(…,…) ¡

// ¡mutators ¡

+ …

  • ­‑ rollback(ts) ¡
  • ­‑ equiv(ts) ¡
  • ­‑ …

code argument

view login database

context

inputs global
 states

slide-73
SLIDE 73

Tracking data items in output

slide-74
SLIDE 74

Tracking data items in output

  • Rail maintains a view object for every session
  • tracks all data items sent to the client
slide-75
SLIDE 75

Tracking data items in output

  • Rail maintains a view object for every session
  • tracks all data items sent to the client
  • To do output book-keeping, one adds objects to the view
  • e.g., view.add(“db/users/admin”, ¡{“name”, ¡“email”}); ¡
  • change the template rendering system
slide-76
SLIDE 76

Tracking data items in output

  • Rail maintains a view object for every session
  • tracks all data items sent to the client
  • To do output book-keeping, one adds objects to the view
  • e.g., view.add(“db/users/admin”, ¡{“name”, ¡“email”}); ¡
  • change the template rendering system
  • During replay, Rail reruns actions and re-compute the

view objects for every session

  • if old_view − new_view ≠ ∅ ➜ Breach!
slide-77
SLIDE 77

Replay with non-deterministic inputs

Goal: minimize state divergence

slide-78
SLIDE 78

Replay with non-deterministic inputs

App.method(‘populate_admins’, ¡function ¡() ¡{
 ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

  • ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{


¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-79
SLIDE 79

Replay with non-deterministic inputs

  • How to handle randomness during replay?

App.method(‘populate_admins’, ¡function ¡() ¡{
 ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

  • ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{


¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ }); App.method(‘populate_admins’, ¡function ¡() ¡{ ¡

  • ­‑ ¡var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

+ ¡var ¡admins ¡= ¡[‘Alice’, ¡‘Bob’]; ¡ ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{ ¡ ¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-80
SLIDE 80

Replay with non-deterministic inputs

  • How to handle randomness during replay?
  • Strawman 1: return a new random number

App.method(‘populate_admins’, ¡function ¡() ¡{
 ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

  • ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{


¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ }); App.method(‘populate_admins’, ¡function ¡() ¡{ ¡

  • ­‑ ¡var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

+ ¡var ¡admins ¡= ¡[‘Alice’, ¡‘Bob’]; ¡ ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{ ¡ ¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-81
SLIDE 81

Replay with non-deterministic inputs

  • How to handle randomness during replay?
  • Strawman 1: return a new random number
  • Strawman 2: log and return random numbers in order

App.method(‘populate_admins’, ¡function ¡() ¡{
 ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

  • ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{


¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ }); App.method(‘populate_admins’, ¡function ¡() ¡{ ¡

  • ­‑ ¡var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡

+ ¡var ¡admins ¡= ¡[‘Alice’, ¡‘Bob’]; ¡ ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{ ¡ ¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i], ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-82
SLIDE 82

Stabilize non-deterministic inputs with context identifiers

  • To avoid false report, Rail must reconcile state divergence
  • f two executions w.r.t. non-deterministic inputs
slide-83
SLIDE 83

Stabilize non-deterministic inputs with context identifiers

  • To avoid false report, Rail must reconcile state divergence
  • f two executions w.r.t. non-deterministic inputs
  • Solution: use input context object to access non-

deterministic input

slide-84
SLIDE 84

Stabilize non-deterministic inputs with context identifiers

  • To avoid false report, Rail must reconcile state divergence
  • f two executions w.r.t. non-deterministic inputs
  • Solution: use input context object to access non-

deterministic input

App.method(‘populate_admins’, ¡function ¡() ¡{ ¡ ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡ ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{ ¡

  • ­‑ ¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡

+ ¡ ¡ var ¡pwd ¡= ¡Rail.inputContext(
 + ¡ ¡ ¡ ¡ ‘populate’, ¡admins[i]).random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i],
 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-85
SLIDE 85

Stabilize non-deterministic inputs with context identifiers

  • To avoid false report, Rail must reconcile state divergence
  • f two executions w.r.t. non-deterministic inputs
  • Solution: use input context object to access non-

deterministic input

  • developer supplies


a stable context ID

  • during replay:


same context ID ➜
 return same value

App.method(‘populate_admins’, ¡function ¡() ¡{ ¡ ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡ ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{ ¡

  • ­‑ ¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡

+ ¡ ¡ var ¡pwd ¡= ¡Rail.inputContext(
 + ¡ ¡ ¡ ¡ ‘populate’, ¡admins[i]).random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i],
 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-86
SLIDE 86

Stabilize non-deterministic inputs with context identifiers

  • To avoid false report, Rail must reconcile state divergence
  • f two executions w.r.t. non-deterministic inputs
  • Solution: use input context object to access non-

deterministic input

  • developer supplies


a stable context ID

  • during replay:


same context ID ➜
 return same value

App.method(‘populate_admins’, ¡function ¡() ¡{ ¡ ¡ var ¡admins ¡= ¡[‘Alice’, ¡‘Mallory’, ¡‘Bob’]; ¡ ¡ for ¡(var ¡i ¡= ¡0; ¡i ¡< ¡admins.length; ¡++i) ¡{ ¡

  • ­‑ ¡ ¡ var ¡pwd ¡= ¡Math.random(); ¡

+ ¡ ¡ var ¡pwd ¡= ¡Rail.inputContext(
 + ¡ ¡ ¡ ¡ ‘populate’, ¡admins[i]).random(); ¡ ¡ ¡ Users.insert({name: ¡admins[i],
 ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡passwd: ¡pwd}); ¡ ¡ } ¡ });

slide-87
SLIDE 87

Other issues

  • How to port other web frameworks to support Rail?
  • e.g., Django, Ruby, etc.
  • How to choose context identifiers?
  • What if developers misuse Rail API?
  • … …
slide-88
SLIDE 88

Evaluation

slide-89
SLIDE 89

Benchmarks

Application Submit EndoApp Telescope Description homework grading medical survey social news (open source)

slide-90
SLIDE 90

Benchmarks

Application Submit EndoApp Telescope Description homework grading medical survey social news (open source) Attack workload ACL error: administrator erroneously granting “staff” privilege to a student Stolen password: attacker creating a malicious root account using a surgeon’s weak password Code bugs: permission checks based on client-supplied user ID
 —— a real bug in commit history

slide-91
SLIDE 91

Porting applications to Rail is easy

  • Most of the changes are related to non-deterministic inputs

LOC in JavaScript (only server-side code is changed) Application Changed Server Client Submit 24 769 891 EndoApp 2 599 900 Telescope 20 1,169 1,781

slide-92
SLIDE 92

Porting applications to Rail is easy

  • Most of the changes are related to non-deterministic inputs
  • Framework wrappers (422 lines in Meteor) offload most

burdens from the application developer

LOC in JavaScript (only server-side code is changed) Application Changed Server Client Submit 24 769 891 EndoApp 2 599 900 Telescope 20 1,169 1,781

slide-93
SLIDE 93

Rail is more precise than
 access log based approaches

# of data items (run with benign workloads in the background) Workload Accessed Reported Missed False ACL error (Submit) 1,121 193 Stolen password
 (EndoApp) 3,521 197 1 Code bugs (Telescope) 23 10

slide-94
SLIDE 94

Rail is more precise than
 access log based approaches

# of data items (run with benign workloads in the background) Workload Accessed Reported Missed False ACL error (Submit) 1,121 193 Stolen password
 (EndoApp) 3,521 197 1 Code bugs (Telescope) 23 10

The malicious account created by the attacker
 (not a “breach”, but related to the attack)

slide-95
SLIDE 95

Rail replays only relevant requests

ACL error
 (Submit) Stolen password
 (EndoApp) Code bugs
 (Telescope)

Replayed request (%)

0% 25% 50% 75% 100%

10.7% 3.1% 0.1%

Replayed Total

slide-96
SLIDE 96

Rail replays only relevant requests

ACL error
 (Submit) Stolen password
 (EndoApp) Code bugs
 (Telescope)

Replayed request (%)

0% 25% 50% 75% 100%

10.7% 3.1% 0.1%

Replayed Total

  • Rail replays only a small fraction of original

requests that are related to the attack

slide-97
SLIDE 97

Rail replays only relevant requests

ACL error
 (Submit) Stolen password
 (EndoApp) Code bugs
 (Telescope)

Replayed request (%)

0% 25% 50% 75% 100%

10.7% 3.1% 0.1%

Replayed Total

  • Rail replays only a small fraction of original

requests that are related to the attack Changed code is on the critical path of all login requests

slide-98
SLIDE 98

Rail replays only relevant requests

ACL error
 (Submit) Stolen password
 (EndoApp) Code bugs
 (Telescope)

Replayed request (%)

0% 25% 50% 75% 100%

10.7% 3.1% 0.1%

Replayed Total

Time (seconds)

200 400 600 800

603 640 664

61.2 10.0 3.2

Replay Recording

  • Rail replays only a small fraction of original

requests that are related to the attack

  • Replay time is proportional to


the number of replayed requests

slide-99
SLIDE 99

Rail’s recording overhead
 is moderate

  • Performance
  • 5% for an under-

loaded server
 (< 90% CPU utilization)

  • 22% for an over-

loaded server

Throughput Overhead for “Submit” Throughput (req/sec) 10 18 26 34 42 50 Number of clients 16 32 48 64 80 96 112 128

Rail Stock

5% 22%

slide-100
SLIDE 100

Rail’s recording overhead
 is moderate

  • Performance
  • 5% for an under-

loaded server
 (< 90% CPU utilization)

  • 22% for an over-

loaded server

  • Storage
  • ~ 0.5KB / request
  • or 500GB / year for


a full-loaded server

Throughput Overhead for “Submit” Throughput (req/sec) 10 18 26 34 42 50 Number of clients 16 32 48 64 80 96 112 128

Rail Stock

5% 22%

slide-101
SLIDE 101

Related Work

  • Record and replay
  • Recovery: Retro [OSDI ’10]; Warp [SOSP ’11]
  • Auditing: Rad [APSys ’11]; Poirot [OSDI ’12]
  • Detecting data breaches
  • Access log: Keypad [EuroSys ’11]; Pasture [OSDI ’12]
  • Information flow: TightLip [NSDI ’07]; TaintDroid [OSDI ’10]
slide-102
SLIDE 102

Conclusion

  • Rail can precisely identify breached data items

after a disclosure in web applications

  • Provides developers with APIs that help to identify

data items, track dependencies, and match up states

  • Requires few changes to applications
  • Precise, efficient, and practical
slide-103
SLIDE 103

Questions?