Top Banner
BEYOND THE BASICS: Building security into your development projects WORDCAMP MIAMI 2016
52

WordCamp Miami 2016 SiteLock Presentation

Apr 16, 2017

Download

Software

SiteLock
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: WordCamp Miami 2016 SiteLock Presentation

BEYOND THE BASICS:

Building security into your development projects

W O R D C A M P M I A M I 2 0 1 6

Page 2: WordCamp Miami 2016 SiteLock Presentation

BIO Binod Purushothaman Director, Product & Technology @SiteLock  §  Heads the product development team. §  Lead several technology startups in the

manufacturing and finance sectors in India and the United States.

Page 3: WordCamp Miami 2016 SiteLock Presentation

BIO Logan Kipp Lead Security Analyst @SiteLock  §  Provides SiteLock's Partners and Support

Services Division with information and training on emerging technologies and threats.

§  Has seven years experience in the website hosting and security technology field, previously working at GoDaddy.

 

Page 4: WordCamp Miami 2016 SiteLock Presentation

INTRODUCTION

§  Malware: Things Get Ugly

§  XSS: A WordPress Story

§  Plugins: Dance the Tango

Page 5: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 6: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 7: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 8: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 9: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 10: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 11: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 12: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 13: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 14: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 15: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 16: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 17: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 18: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 19: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 20: WordCamp Miami 2016 SiteLock Presentation

MALWARE

Page 21: WordCamp Miami 2016 SiteLock Presentation

ANOTHER REASON FILE MONITORING IS IMPORTANT!

Page 22: WordCamp Miami 2016 SiteLock Presentation

XSS

“Cross-site scripting (XSS) is a type of computer security vulnerability t y p i c a l l y f o u n d i n w e b applications. XSS enables attackers to inject client-side script into web pages viewed by other users.”

- Wikipedia

Page 23: WordCamp Miami 2016 SiteLock Presentation

XSS SiteLock Research Team picks up possible XSS vulnerability in plugin during routine SAST scan. §  File: settings.php §  Argument: $curr

Page 24: WordCamp Miami 2016 SiteLock Presentation

XSS

Found $curr set at line 195/196, where it’s set to Default if $cntr is empty, or the value of $cntr if not. Variable $cntr set at lines 91/92. If $_GET[‘scounter’] set, inherits value. Could this be a reflective XSS vulnerability?

Page 25: WordCamp Miami 2016 SiteLock Presentation

XSS

Let’s find out. We simply need to pass a harmless XSS string in the $_GET[‘scounter’] variable to get a proof of concept, like a document.cookie alert. Something like: ?page=slider-settings&scounter=<script>alert(document.cookie)</script>

Page 26: WordCamp Miami 2016 SiteLock Presentation

XSS

Great success.

Page 27: WordCamp Miami 2016 SiteLock Presentation

BUT IF YOU USE A WEB APPLICATION FIREWALL…

These types of attacks are blocked.

Page 28: WordCamp Miami 2016 SiteLock Presentation

RECENT RESEARCH

Free WordPress Plugin -- “Tango”

§  File Management – View & Edit – Zip & Unzip

§  Database Management – Easy backups

Page 29: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

Page 30: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

Page 31: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

The plugin consists of four files.

Page 32: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

Curious. Startup relies on a file existing.

Page 33: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

What would happen if we renamed the readme.txt then?

Page 34: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

Page 35: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

Page 36: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

$ls /

Page 37: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

What else could we do here? Anything.

§  Grab external files. §  Dump the file structure. §  Trash everything.

$dd if=/dev/random of=/dev/sda

Page 38: WordCamp Miami 2016 SiteLock Presentation

VULNERABILITY EXAMPLE: TANGO

Page 39: WordCamp Miami 2016 SiteLock Presentation
Page 40: WordCamp Miami 2016 SiteLock Presentation

CODE STARTS SIMPLE

MY CODE

Page 41: WordCamp Miami 2016 SiteLock Presentation

C O D E B E C O M E S C O M P L E X

T H E M E S +

C O M P O N E N T S +

F R A M E W O R K +

P L U G I N S +

Page 42: WordCamp Miami 2016 SiteLock Presentation

ATTACKERS INCREASE THEIR COMPLEXITY

Page 43: WordCamp Miami 2016 SiteLock Presentation

M YPLUGIN

Page 44: WordCamp Miami 2016 SiteLock Presentation

XSS VULNERABIL ITY

No  escaping  or  sani-za-on  used.  

Page 45: WordCamp Miami 2016 SiteLock Presentation

STATIC CODE ANALYSIS RESULTS: TRUECODE

Page 46: WordCamp Miami 2016 SiteLock Presentation

CODE ANALYSIS

Page 47: WordCamp Miami 2016 SiteLock Presentation

XSS FIXED

Use  WordPress  esc_html()  to  remove  the  vulnerability  

Page 48: WordCamp Miami 2016 SiteLock Presentation

BUILT- IN WORDPRESS FUNCTIONS

§  Always use WP built-in functions – esc_html() – sanitize_text_field() – update_option()

Page 49: WordCamp Miami 2016 SiteLock Presentation

UPDATED SCAN RESULTS

Page 50: WordCamp Miami 2016 SiteLock Presentation

INSECURE SDLC

Page 51: WordCamp Miami 2016 SiteLock Presentation

SECURE SDLC

Page 52: WordCamp Miami 2016 SiteLock Presentation

-END-