Analyzing Information Flow in JSEs Nick Taylor David - - PowerPoint PPT Presentation

analyzing information flow in jse s
SMART_READER_LITE
LIVE PREVIEW

Analyzing Information Flow in JSEs Nick Taylor David - - PowerPoint PPT Presentation

Analyzing Information Flow in JSEs Nick Taylor David Erichsen Introduction: JavaScript Dynamic computer programming language Generally used by client


slide-1
SLIDE 1

Analyzing ¡Information ¡ Flow ¡in ¡JSE’s ¡ ¡

Nick ¡Taylor ¡ David ¡Erichsen ¡

slide-2
SLIDE 2

Introduction: ¡JavaScript ¡

Dynamic ¡computer ¡programming ¡language ¡ Generally ¡used ¡by ¡client ¡to ¡allow ¡scripts ¡to ¡interact ¡with ¡ users ¡ Supported ¡by ¡all ¡major ¡browsers ¡ Easy ¡to ¡code ¡in ¡for ¡inexperienced ¡developers ¡and ¡easy ¡to ¡ modify ¡by ¡others ¡ Can ¡be ¡readily ¡ported ¡across ¡platforms ¡ Useful ¡for ¡creating ¡frameworks ¡ ¡

slide-3
SLIDE 3

Introduction: ¡JSEs ¡

JavaScript-­‑based ¡browser ¡extensions ¡(JSEs) ¡improve ¡ core ¡functionality ¡of ¡web ¡browsers ¡

PDF ¡Readers ¡ Flash ¡Players ¡ File ¡Downloaders ¡

  • Greasemonkey ¡

Firebug ¡

  • NoScript ¡
slide-4
SLIDE 4

Are ¡JSE’s ¡Secure? ¡

To ¡enable ¡more ¡elaborate ¡functionalities, ¡browsers ¡ execute ¡JSE’s ¡with ¡elevated ¡privileges ¡ Malicious ¡JSEs ¡can ¡misuse ¡these ¡privileges ¡to ¡ compromise ¡confidentiality ¡and ¡integrity ¡

Stealing ¡sensitive ¡data ¡ Executing ¡arbitrary ¡code ¡on ¡host ¡system ¡

Even ¡if ¡a ¡JSE ¡is ¡not ¡overtly ¡malicious, ¡vulnerabilities ¡in ¡ the ¡JSE ¡and ¡the ¡browser ¡may ¡allow ¡a ¡remote ¡attacker ¡ to ¡compromise ¡browser ¡security. ¡

¡

slide-5
SLIDE 5

Evaluation ¡of ¡problem ¡

The ¡problem ¡is ¡that ¡JSE’s ¡are ¡not ¡secure. ¡ ¡Thus ¡JSE’s ¡pose ¡a ¡threat ¡ to ¡browser ¡security. ¡ Factors ¡that ¡add ¡to ¡the ¡problem ¡

Inadequate ¡sandboxing ¡of ¡Javascript ¡in ¡a ¡JSE. ¡

  • Javascript ¡code ¡in ¡a ¡JSE ¡executes ¡with ¡the ¡privileges ¡of ¡the ¡web ¡

browser ¡e.g ¡can ¡freely ¡access ¡sensitive ¡entities ¡such ¡as ¡the ¡cookie ¡store ¡ and ¡browsing ¡history ¡

Browser ¡and ¡JSE ¡vulnerabilities ¡

Even ¡if ¡a ¡JSE ¡is ¡not ¡malicious, ¡vulnerabilities ¡in ¡the ¡browser ¡and ¡in ¡JSEs ¡ may ¡allow ¡a ¡malicious ¡website ¡to ¡access ¡and ¡misuse ¡the ¡privileges ¡of ¡a ¡ JSE ¡

slide-6
SLIDE 6

Prior ¡Research ¡

Tracked ¡information ¡flow ¡at ¡the ¡system ¡level ¡by ¡tracking ¡ information ¡flow ¡at ¡the ¡machine ¡instruction ¡level ¡

Didn’t ¡allow ¡analysts ¡to ¡observe ¡flow ¡of ¡information ¡at ¡JavaScript ¡

  • bjects ¡and ¡instructions ¡

Restricted ¡to ¡memory ¡words ¡and ¡machine ¡instructions ¡ Developed ¡techniques ¡to ¡identify ¡spyware ¡behavior ¡in ¡untrusted ¡ browser ¡extensions, ¡particularly ¡in ¡plugins ¡and ¡BHOs ¡(Browser ¡ Helper ¡Object), ¡which ¡are ¡distributed ¡as ¡binary ¡executable. ¡ ¡

These ¡approaches ¡rely ¡on ¡whole-­‑system ¡information ¡flow ¡ tracking ¡and ¡on ¡monitoring ¡plugin/browser ¡interactions. ¡ ¡

slide-7
SLIDE 7

Solution ¡

Security ¡Architecture ¡for ¡Web ¡Browsers ¡(Sabre) ¡

A ¡system ¡that ¡uses ¡in-­‑browser ¡information-­‑flow ¡ tracking ¡to ¡analyze ¡JSEs ¡ Associates ¡each ¡JavaScript ¡object ¡in-­‑memory ¡with ¡a ¡ label ¡that ¡determines ¡if ¡the ¡object ¡contains ¡sensitive ¡ information ¡ Modifies ¡the ¡label ¡when ¡corresponding ¡object ¡is ¡ modified ¡by ¡JavaScript ¡code ¡(JSEs ¡and ¡Web ¡Apps) ¡ Raises ¡alert ¡if ¡it ¡deems ¡object ¡containing ¡sensitive ¡ information ¡is ¡uses ¡in ¡unsafe ¡way ¡

slide-8
SLIDE 8

Sabre’s ¡Security ¡Goals ¡

Detecting ¡confidentiality ¡violations ¡

If ¡a ¡JSE ¡attempts ¡to ¡send ¡a ¡JavaScript ¡object ¡containing ¡ sensitive ¡data ¡over ¡a ¡network ¡or ¡write ¡to ¡a ¡file ¡

Detecting ¡integrity ¡violations ¡

If ¡a ¡JSE ¡attempts ¡to ¡execute ¡a ¡script ¡received ¡from ¡an ¡ untrusted ¡domain ¡with ¡elevated ¡privileges ¡

slide-9
SLIDE 9

Sabre’s ¡Techniques ¡

Precisely ¡tracks ¡information ¡flows ¡across ¡different ¡ browser ¡subsystems, ¡including ¡DOM, ¡local ¡storage ¡ and ¡the ¡network ¡ Is ¡able ¡to ¡declassify ¡or ¡endorse ¡information ¡flows ¡ Handles ¡information ¡flows, ¡some ¡implicit ¡flows ¡and ¡ cross-­‑domain ¡flows ¡

SABRE ¡TRACKS ¡INFORMATION ¡FLOW ¡

slide-10
SLIDE 10

Monitor ¡All ¡JavaScript ¡ Execution ¡

Includes ¡code ¡executed ¡by ¡web ¡applications, ¡JSEs ¡and ¡ all ¡other ¡JavaScript ¡that ¡comprises ¡the ¡browser ¡ Guards ¡against: ¡

Attackers ¡trying ¡to ¡hide ¡malicious ¡code ¡using ¡ JavaScript ¡in ¡multiple ¡browser ¡subsystems ¡ Code ¡that ¡is ¡used ¡in ¡XUL ¡overlays ¡that ¡may ¡be ¡included ¡ into ¡browser ¡core ¡

slide-11
SLIDE 11

Ease ¡Action ¡Attribution ¡

Sabre ¡identifies ¡an ¡information ¡flow ¡violation ¡by ¡a ¡ JSE ¡

An ¡analyst ¡may ¡be ¡needed ¡to ¡determine ¡whether ¡the ¡ violation ¡is ¡an ¡attack ¡or ¡part ¡of ¡the ¡valid ¡behavior ¡of ¡ the ¡JSE ¡à à ¡whitelist ¡

Ex) ¡PwdHash ¡– ¡searches ¡and ¡modifies ¡passwords ¡entered ¡

  • n ¡pages ¡which ¡could ¡raise ¡a ¡violation ¡if ¡the ¡JSE ¡isn’t ¡

trusted ¡

slide-12
SLIDE 12

Track ¡Information ¡Flow ¡ Across ¡Browser ¡ Subsystems ¡

JavaScript ¡code ¡in ¡a ¡browser ¡and ¡its ¡JSEs ¡interacts ¡ heavily ¡with ¡other ¡subsystems ¡ex) ¡DOM, ¡cookies, ¡ saved ¡passwords, ¡local ¡file ¡system ¡ Must ¡monitor ¡all ¡information ¡flows ¡across ¡all ¡the ¡ subsystems ¡because ¡attackers ¡often ¡use ¡multiple ¡ subsystems ¡for ¡JSE ¡attacks ¡

slide-13
SLIDE 13

Implementation ¡of ¡ Sabre ¡

Used ¡a ¡modified ¡version ¡of ¡SpiderMonkey ¡(a ¡JavaScript ¡ interpreter ¡in ¡Firefox) ¡to ¡track ¡information ¡flow ¡

Altered ¡representation ¡of ¡JavaScript ¡objects ¡to ¡include ¡ security ¡labels ¡ Improved ¡interpretation ¡of ¡JavaScript ¡byte ¡code ¡instructions ¡ to ¡modify ¡labels ¡à à ¡propagate ¡info ¡flow ¡ Modified ¡browser ¡subsystems ¡(DOM ¡and ¡XPCOM) ¡to ¡store ¡ and ¡propagate ¡security ¡labels ¡ JavaScript ¡code ¡is ¡executed ¡by ¡interpreter ¡ Identifies ¡source ¡of ¡JavaScript ¡byte ¡code ¡being ¡interpretted ¡

slide-14
SLIDE 14

Sources ¡& ¡Sinks ¡

Sabre ¡detects ¡flows ¡from ¡sensitive ¡sources ¡(information) ¡to ¡low-­‑ sensitivity ¡sinks ¡which ¡includes ¡file ¡systems ¡and ¡networks. ¡ In ¡addition ¡to ¡modifying ¡the ¡JS ¡interpreter ¡to ¡raising ¡an ¡alert ¡ when ¡a ¡sensitive ¡object ¡is ¡written ¡to ¡a ¡low-­‑sensitivity ¡sink, ¡Sabre ¡ also ¡modifies ¡the ¡browser’s ¡document ¡interface ¡to ¡raise ¡an ¡alert ¡ when ¡a ¡DOM ¡node ¡that ¡stores ¡sensitive ¡data ¡derived ¡from ¡a ¡JSE ¡is ¡ sent ¡over ¡the ¡network. ¡ A ¡file ¡system ¡is ¡both ¡a ¡source ¡and ¡a ¡sink ¡ Confidentiality-­‑violating ¡information-­‑flows ¡can ¡also ¡be ¡detected ¡ using ¡a ¡similar ¡set ¡of ¡low-­‑integrity ¡sources ¡and ¡high-­‑integrity ¡ sinks ¡

slide-15
SLIDE 15

Security ¡Labels ¡

Associates ¡each ¡in-­‑memory ¡JS ¡object ¡with ¡a ¡pair ¡of ¡ security ¡labels ¡which ¡track ¡the ¡flow ¡of: ¡

Sensitive ¡information ¡ Low-­‑integrity ¡information ¡ ¡

Each ¡label ¡stores: ¡

Sensitivity ¡level-­‑ ¡does ¡it ¡store ¡sensitive ¡info? ¡ Boolean ¡flag-­‑ ¡was ¡object ¡modified ¡by ¡JS ¡code ¡in ¡JSE ¡ Names ¡of ¡JSEs ¡and ¡web ¡domains ¡that ¡have ¡been ¡ modified ¡by ¡object ¡

slide-16
SLIDE 16

Propagating ¡Labels ¡

Explicit ¡Flows-­‑ ¡handles ¡assignments ¡by ¡propagating ¡ the ¡label ¡of ¡the ¡RHS ¡of ¡an ¡assignment ¡to ¡its ¡LHS ¡

If ¡RHS ¡is ¡complex ¡algorithm/logic ¡operation, ¡the ¡result ¡ is ¡considered ¡sensitive ¡if ¡any ¡arguments ¡are ¡sensitive ¡ JS ¡supports ¡dynamic ¡creation ¡of ¡complex ¡objects ¡

Labels ¡inherit ¡parent ¡labels, ¡though ¡they ¡can ¡be ¡modified ¡ Parents ¡of ¡arrays ¡and ¡other ¡similar ¡data ¡structures ¡inherit ¡ the ¡aggregate ¡of ¡their ¡children ¡to ¡prevent ¡information ¡ leaks ¡ Function ¡calls ¡inherit ¡the ¡label ¡of ¡the ¡parent ¡scope ¡ 127 ¡models ¡to ¡handle ¡cross-­‑domain ¡function ¡calls ¡

slide-17
SLIDE 17

Propagating ¡Labels ¡

Implicit ¡Flows-­‑ ¡Used ¡for ¡conditions, ¡loops, ¡exception ¡ and ¡other ¡related ¡statements ¡

Control ¡dependency ¡between ¡a ¡conditional ¡expression ¡ and ¡statements ¡executed ¡within ¡the ¡conditional ¡

if(document.cookie.length ¡> ¡0) ¡then ¡{T} ¡else ¡{F} ¡

Scope ¡of ¡each ¡branch ¡inherits ¡the ¡label ¡of ¡its ¡conditional ¡

Some ¡implicit ¡flows ¡cannot ¡be ¡detected ¡using ¡labeled ¡ scopes ¡

Instruction ¡Provenance-­‑ ¡the ¡provenance ¡of ¡each ¡JS ¡ instruction ¡is ¡used ¡to ¡determine ¡whether ¡a ¡JS ¡object ¡ is ¡modified ¡by ¡a ¡JSE ¡

slide-18
SLIDE 18

Declassifying ¡and ¡ Endorsing ¡Flows ¡ ¡

To ¡support ¡declassification ¡of ¡sensitive ¡information, ¡Sabre ¡ extends ¡the ¡JS ¡interpreter ¡with ¡the ¡ability ¡to ¡declassify ¡

  • flows. ¡ ¡A ¡security ¡analyst ¡supplies ¡a ¡declassification ¡policy, ¡

which ¡specifies ¡how ¡the ¡browser ¡must ¡declassify ¡a ¡ sensitive ¡object. ¡ ¡Flows ¡that ¡violate ¡integrity ¡can ¡similarly ¡ be ¡handled ¡with ¡an ¡endorsement ¡policy. ¡ Sabre ¡Supports ¡two ¡kinds ¡of ¡declassification ¡(and ¡ endorsement) ¡policies: ¡

Sink-­‑specific ¡ JSE-­‑specific ¡

slide-19
SLIDE 19

Declassifying ¡and ¡ Endorsing ¡Flows ¡ ¡

A ¡sink-­‑specific ¡policy ¡permits ¡declassification ¡of ¡

  • bjects ¡by ¡allowing ¡an ¡analyst ¡to ¡specify ¡the ¡location ¡
  • f ¡a ¡byte ¡code ¡instruction ¡and ¡the ¡object ¡externalized ¡

by ¡that ¡instruction. ¡ A ¡JSE-­‑specific ¡policy ¡permits ¡declassification ¡of ¡all ¡ flows ¡from ¡a ¡JSE ¡and ¡can ¡be ¡used ¡when ¡a ¡JSE ¡is ¡

  • trusted. ¡
slide-20
SLIDE 20

Greasemonkey ¡ Vulnerability ¡

slide-21
SLIDE 21

FFsniFF ¡ Vulnerability ¡

slide-22
SLIDE 22

Evaluation/Performance ¡

Using ¡24 ¡JSE ¡for ¡testing ¡Sabre ¡the ¡test ¡set ¡included ¡ both ¡JSE’s ¡with ¡known ¡malicious ¡flows ¡as ¡well ¡as ¡ JSE’s ¡with ¡unknown ¡flows. ¡ Performance ¡

Using ¡a ¡V8 ¡suite, ¡the ¡Sabra-­‑enabled ¡browser ¡had ¡a ¡ mean ¡score ¡of ¡29.16 ¡compared ¡to ¡97.91 ¡for ¡an ¡ unmodified ¡browser ¡ Had ¡a ¡2.36x ¡and ¡1.6x ¡runtime ¡overhead ¡with ¡V8 ¡suite ¡& ¡ SunSpider ¡respectively ¡ Cause ¡for ¡overhead ¡is ¡analyzing ¡overlays ¡(without ¡

  • verhead ¡is ¡77% ¡ad ¡42% ¡respectively) ¡
slide-23
SLIDE 23

JSEs ¡With ¡Unknown ¡ Information ¡Flows ¡

  • Interaction ¡with ¡HTML ¡Forms ¡
  • PwdHash-­‑ ¡declassified ¡request ¡
  • Sending/receiving ¡data ¡over ¡an ¡HTTP ¡channel ¡
  • Web-­‑Of-­‑Trust-­‑ ¡declassified ¡request ¡
  • Interaction ¡with ¡the ¡file ¡system ¡
  • Video ¡DownloadHelper ¡& ¡Greasemonkey-­‑ ¡endorsed ¡
  • ForecastFox-­‑ ¡declassified ¡
  • Loading ¡a ¡URL ¡
  • PDF ¡Download-­‑ ¡endorsed ¡
  • JS ¡Events ¡
  • Handles ¡differently ¡based ¡on ¡the ¡event ¡
slide-24
SLIDE 24

JSEs ¡With ¡Known ¡ Malicious ¡Flows ¡

¡In ¡testing ¡vulnerable ¡JSE ¡the ¡researchers ¡used ¡one ¡JSE ¡to ¡ discuss ¡which ¡is ¡the ¡exploit ¡against ¡Greasemonkey ¡which ¡ attempted ¡to ¡transmit ¡the ¡contents ¡of ¡a ¡file ¡on ¡the ¡host ¡to ¡an ¡ attacker, ¡thereby ¡violating ¡confidentiality, ¡while ¡exploits ¡against ¡ Firebug ¡attempted ¡to ¡start ¡a ¡process ¡on ¡the ¡host ¡and ¡modify ¡the ¡ contents ¡of ¡a ¡file ¡on ¡disk, ¡thereby ¡violating ¡integrity. ¡In ¡each ¡ case, ¡Sabre ¡precisely ¡identified ¡the ¡information ¡flow ¡violation. ¡ To ¡test ¡malicious ¡JSEs, ¡we ¡considered ¡FFSniFF ¡and ¡BrowserSpy, ¡ both ¡of ¡which ¡exhibit ¡the ¡same ¡behavior—they ¡steal ¡passwords ¡ and ¡other ¡sensitive ¡entries ¡from ¡web ¡forms ¡and ¡hide ¡their ¡ presence ¡from ¡the ¡user ¡by ¡removing ¡themselves ¡from ¡the ¡ browser’s ¡extension ¡manager. ¡Sabre ¡raised ¡an ¡alert ¡when ¡ FFSniFF ¡and ¡BrowserSpy ¡attempted ¡to ¡transmit ¡passwords ¡to ¡a ¡ remote ¡attacker ¡via ¡the ¡network ¡

slide-25
SLIDE 25

Related ¡Works: ¡

Browser ¡extension ¡security: ¡ ¡

  • Prior ¡work ¡[22, ¡30, ¡31] ¡has ¡developed ¡techniques ¡to ¡identify ¡

spyware ¡behavior ¡in ¡untrusted ¡browser ¡extensions, ¡particularly ¡in ¡ plugins ¡and ¡BHOs, ¡which ¡are ¡distributed ¡as ¡binary ¡executables. ¡ These ¡approaches ¡rely ¡on ¡whole-­‑system ¡information ¡flow ¡tracking ¡

  • Like ¡prior ¡work ¡[30, ¡31], ¡Sabre ¡also ¡monitors ¡JSE/browser ¡

interactions ¡but ¡supplements ¡such ¡monitoring ¡with ¡information ¡on ¡ sensitivity/integrity ¡of ¡JavaScript ¡objects ¡

  • Netscape ¡Navigator ¡3.0 ¡first ¡proposed ¡the ¡use ¡of ¡data ¡tainting ¡to ¡

detect ¡confidentiality-­‑violating ¡JavaScript ¡code ¡[16]. ¡This ¡idea ¡has ¡ been ¡applied ¡by ¡Vogt ¡et ¡al.[42] ¡to ¡detect ¡cross-­‑site ¡scripting ¡

  • attacks. ¡More ¡recently, ¡Austin ¡et ¡al. ¡[17] ¡have ¡proposed ¡dynamic ¡

taint ¡tracking ¡techniques ¡for ¡JavaScript ¡with ¡promising ¡results, ¡but ¡

  • ver ¡considerably ¡smaller ¡
slide-26
SLIDE 26

Related ¡Works: ¡

  • Benchmarks. ¡

In ¡addition ¡to ¡the ¡above ¡work ¡on ¡JavaScript ¡ sandboxing, ¡recent ¡research ¡has ¡investigated ¡ static ¡analysis ¡techniques ¡for ¡JavaScript ¡code ¡[32], ¡ particularly ¡to ¡statically ¡ensure ¡compliance ¡with ¡ site-­‑specific ¡policies ¡and ¡to ¡ensure ¡the ¡integrity ¡of ¡ client-­‑side ¡JavaScript ¡code ¡of ¡a ¡web ¡application ¡ [28]. ¡

slide-27
SLIDE 27

References ¡

  • [22] ¡and ¡on ¡monitoring ¡plugin/browser ¡interactions ¡[30]. ¡
  • ¡
  • M. ¡Egele, ¡C. ¡Kruegel, ¡E. ¡Kirda, ¡H. ¡Yin, ¡and ¡D. ¡Song. ¡Dynamic ¡spyware ¡
  • analysis. ¡In ¡USENIX ¡Annual ¡Technical, ¡June ¡2007. ¡
  • ¡E. ¡Kirda, ¡C. ¡Kruegel, ¡G. ¡Banks, ¡G. ¡Vigna, ¡and ¡R. ¡Kemmerer. ¡
  • Behavior-­‑based ¡spyware ¡detection. ¡In ¡USENIX ¡Security, ¡August ¡
  • 2006. ¡
  • Z. ¡Li, ¡X. ¡Wang, ¡and ¡J. ¡Y. ¡Choi. ¡SpyShield: ¡Preserving ¡privacy ¡from ¡
  • spy ¡add-­‑ons. ¡In ¡RAID, ¡September ¡2007. ¡
slide-28
SLIDE 28

Questions? ¡