BinaryPig: Scalable Binary Data Extraction in Hadoop Created By: - - PowerPoint PPT Presentation

binarypig scalable binary data extraction in hadoop
SMART_READER_LITE
LIVE PREVIEW

BinaryPig: Scalable Binary Data Extraction in Hadoop Created By: - - PowerPoint PPT Presentation

BinaryPig: Scalable Binary Data Extraction in Hadoop Created By: Jason Trost, Telvis Calhoun, Zach Hanif Bringing data science to cyber security, allowing you to sense, analyze and act in


slide-1
SLIDE 1

BinaryPig: Scalable Binary Data Extraction in Hadoop

Created By:
 Jason Trost, Telvis Calhoun, Zach Hanif

slide-2
SLIDE 2

Bringing ¡data ¡science ¡to ¡cyber ¡security, ¡ allowing ¡you ¡to ¡sense, ¡analyze ¡and ¡act ¡in ¡ real ¡5me. ¡ ¡

slide-3
SLIDE 3

Agenda ¡

  • • The Problem
  • • BinaryPig Architecture
  • • Code and Implementation Details
  • • Analysis and Results
  • • Demo
  • • Wrap-Up
  • A
slide-4
SLIDE 4

Background ¡

2.5 years 20M samples 9.5TB of malware

slide-5
SLIDE 5
slide-6
SLIDE 6

Malware data mining is useful

  • • Threat intel feeds

  • Contextual enrichment on events

  • Machine learning models
slide-7
SLIDE 7

Pre-­‑BinaryPig: ¡Architecture ¡

slide-8
SLIDE 8

Pre-­‑BinaryPig: ¡Storage ¡Issues ¡

  • We kept running out of disk!
  • We lost samples when NFS nodes failed.
slide-9
SLIDE 9

Pre-­‑BinaryPig ¡-­‑ ¡Processing ¡Issues ¡

  • No Data Locality.
  • Node failures were catastrophic.
  • Hard to add new analysis scripts.
slide-10
SLIDE 10

Pre-­‑Binary ¡Pig ¡-­‑ ¡Data ¡Explora=on ¡Issues ¡

  • How can I share my findings for greater fame and glory?
  • Create a table schema for every analysis script?
  • RDBMS failure is worse than zombie apocalypse.
slide-11
SLIDE 11

We ¡needed ¡a ¡system ¡that... ¡

  • • Scales to our historical data
  • • Recovers from failures
  • • Grows through scripting
  • • Supports dynamic schemas
  • • Searchable via the web
slide-12
SLIDE 12

BinaryPig

FRAMEWORK FOR

PROCESSING SMALL BINARY FILES USING

APACHE HADOOP AND APACHE PIG

Bi

slide-13
SLIDE 13

BinaryPig ¡

  • • Simple DSL
  • • Pluggable analytics
  • • Plays nice with existing tools
  • • Enables rapid iteration
slide-14
SLIDE 14

BinaryPig ¡ ¡

slide-15
SLIDE 15

BinaryPig ¡-­‑ ¡Storage ¡

  • • HDFS, scalable, replicated
  • • Aggregate malware samples into sequence files
slide-16
SLIDE 16

BinaryPig ¡-­‑ ¡Processing ¡

  • Hadoop - robust, distributed, with data locality
  • Apache Pig - Extensible, simple
slide-17
SLIDE 17

BinaryPig ¡-­‑ ¡Results ¡Explora=on ¡

  • UI - turns your grandma into a data scientist
  • Elasticsearch - schemaless, replicated, awesome
slide-18
SLIDE 18

Yet ¡Another ¡Framework? ¡

  • Malware ¡tools ¡didn't ¡scale ¡
  • Hadoop ¡does ¡not ¡play ¡well ¡with ¡small ¡binary ¡

files ¡

  • Hadoop ¡did ¡not ¡integrate ¡exis5ng ¡malware ¡

analysis ¡tools ¡ ¡

slide-19
SLIDE 19

Code ¡and ¡Implementa5on ¡Details ¡

slide-20
SLIDE 20

BinaryPig ¡is ¡easy ¡to ¡use! ¡

slide-21
SLIDE 21

BinaryPig ¡Ingest ¡Tools ¡

  • Generate ¡sequence ¡file ¡from ¡directory ¡

containing ¡malware ¡samples ¡ ¡

./bin/dir_to_sequencefile <malwareDir> <hdfsOutputFile>

  • Generate ¡sequence ¡file ¡from ¡archive ¡

¡

./bin/archive_to_sequencefile <archive> <hdfsOutputFile>

slide-22
SLIDE 22

BinaryPig ¡Loaders ¡

  • Converts ¡raw ¡data ¡to ¡a ¡tuple ¡
  • Execu5ng ¡Loader ¡
  • Executes ¡a ¡specific ¡script/program ¡on ¡a ¡file ¡

wriIen ¡to ¡a ¡logical ¡path ¡

  • Example: ¡Hashing ¡
  • Daemon ¡Loader ¡
  • Writes ¡binaries ¡to ¡a ¡path, ¡and ¡provides ¡those ¡

paths ¡to ¡an ¡already ¡running ¡analysis ¡process ¡

  • Example: ¡Clamd ¡

¡ ¡

slide-23
SLIDE 23

Op=miza=ons ¡in ¡BinaryPig ¡

  • To ¡leverage ¡pre-­‑exis5ng ¡tools, ¡we ¡had ¡to ¡write ¡

malware ¡binaries ¡to ¡the ¡local ¡filesystem ¡on ¡the ¡ worker ¡nodes ¡

  • Note: ¡local ¡copy, ¡not ¡network ¡copy ¡
  • We ¡op5mized ¡this ¡to ¡use ¡/dev/shm/ ¡instead ¡
  • Quick ¡scripts ¡are ¡great ¡for ¡rapid ¡itera5on, ¡but... ¡
  • Interpreter ¡startup ¡5me ¡can ¡dominate ¡execu5on ¡5me ¡
  • Crea5ng ¡small, ¡long ¡running, ¡analy5c ¡daemons ¡provides ¡a ¡

huge ¡speedup ¡for ¡frequently ¡used ¡tasks ¡

  • i.e. ¡the ¡clamscand ¡model ¡of ¡execu5on ¡

¡

slide-24
SLIDE 24

BinaryPig: ¡Loader ¡Implementa=ons ¡

  • Generic Script Loader
  • Generic Daemon Loader
  • ClamAV Loader
  • Yara Loader
  • Hashing Loader
slide-25
SLIDE 25

strings.sh: ¡ ¡ #!/bin/bash strings "$@"

BinaryPig: ¡Scrip=ng ¡

strings.pig: ¡ ¡

define Loader com.endgame.binarypig.loaders.ExecutingTextLoader; data = LOAD '$INPUT' USING Loader('strings.sh'); DUMP data;

slide-26
SLIDE 26

BinaryPig ¡supports ¡non-­‑PE32 ¡files ¡

  • Handles more than just malware...
  • Image analysis
  • PDF data extraction
  • APK extraction
  • Any small binary files
slide-27
SLIDE 27

Web ¡Interface ¡

slide-28
SLIDE 28

Analysis ¡and ¡Results ¡

slide-29
SLIDE 29

Malware ¡Census ¡

  • • ¡20 ¡Million ¡unique ¡binaries ¡
  • • ¡~94% ¡PE ¡format ¡
  • • ¡~6% ¡are ¡mostly ¡Android ¡APK's ¡
  • • ¡5 ¡hours ¡to ¡run ¡historical ¡set ¡
slide-30
SLIDE 30

General ¡Findings ¡

slide-31
SLIDE 31

Feature ¡Extrac=on ¡

  • Our ¡core ¡mo5va5on ¡was ¡to ¡dras5cally ¡improve ¡the ¡

experience ¡of ¡valida5ng ¡research. ¡

  • Packer ¡iden5fica5on ¡
  • Overall ¡and ¡Sec5onal ¡Entropy ¡
  • Kolmogorov ¡Complexity ¡
  • Sec5on ¡and ¡resource ¡names ¡
  • Sec5on ¡flags ¡
  • Import ¡tables ¡
  • Func5on ¡Calls ¡
  • Resource ¡hashes ¡and ¡subfeatures ¡
slide-32
SLIDE 32

Feature ¡Depth ¡

  • PEHeaders ¡are ¡shallow ¡
  • Easy ¡to ¡manipulate ¡
  • Less ¡resolu5on ¡than ¡reverse ¡engineering ¡features ¡
  • File ¡metadata ¡is ¡also ¡low ¡resolu5on ¡
  • Headers ¡provide ¡excellent ¡fast ¡features ¡
  • Headers ¡are ¡oben ¡ignored ¡
  • Work ¡the ¡analysis ¡around ¡the ¡feature ¡resolu5on ¡
  • Ignore ¡5ght ¡clusters, ¡go ¡for ¡wide ¡ones ¡
  • Triage, ¡not ¡true ¡classifica5on ¡
slide-33
SLIDE 33

Clustering ¡Results ¡

  • Triage ¡for ¡dynamic ¡analysis ¡winnowing ¡
  • Largest ¡cluster: ¡377,882 ¡samples ¡
  • Three ¡malware ¡families ¡contained ¡within ¡ ¡
  • Second ¡largest: ¡124,894 ¡samples ¡
  • Valida5on ¡is ¡tricky ¡
  • Manual ¡valida5on ¡cannot ¡be ¡en5rely ¡avoided ¡
  • Cluster ¡meanings ¡change ¡with ¡feature ¡sets ¡
  • Cannot ¡just ¡go ¡off ¡of ¡AV ¡results ¡
slide-34
SLIDE 34

ICO ¡Extrac=on ¡

slide-35
SLIDE 35

Icon ¡Features ¡

  • Pixel ¡based ¡features ¡
  • Brightness ¡ ¡
  • Color ¡values ¡
  • Pixel ¡density ¡
  • Cryptographic ¡and ¡fuzzy ¡hashing ¡
  • Perceptual ¡hashes ¡
  • Edge ¡detec5on ¡
slide-36
SLIDE 36

Icon ¡Results ¡

  • Icon ¡clustering ¡ ¡
  • Groups ¡do ¡not ¡just ¡include ¡family ¡lines ¡
  • Copycat ¡malware ¡is ¡shown ¡as ¡well ¡
  • Clear ¡indica5ons ¡of ¡malicious ¡intent ¡
  • Method ¡of ¡infec5on ¡can ¡be ¡extrapolated ¡
  • Phishing ¡
  • Obfuscated ¡executables ¡
  • Adware ¡(more ¡than ¡we ¡expected) ¡
  • False ¡posi5ves ¡-­‑ ¡popular ¡sobware ¡detec5on ¡
slide-37
SLIDE 37

Lessons ¡Learned ¡

  • Feature ¡Selec5on ¡
  • Over ¡500 ¡features ¡in ¡PEheader ¡alone ¡
  • Abundance ¡of ¡features ¡requires ¡pruning ¡
  • Interpreta5on ¡and ¡Valida5on ¡of ¡Results ¡
  • Manual ¡valida5on ¡is ¡an ¡unfortunate ¡reality ¡
  • Care ¡has ¡to ¡be ¡taken ¡to ¡ensure ¡that ¡unsupervised ¡

learning ¡provides ¡meaningful ¡results ¡

slide-38
SLIDE 38

DEMO ¡

slide-39
SLIDE 39

WRAP ¡UP ¡

slide-40
SLIDE 40
  • Rapid Iteration
  • Feature extraction
  • Clustering analysis for rapid malware triage
  • Enables weekly AV scans with latest signatures over

previous malware.

  • Created binary classifier to improve sample collection

and categorize new samples

So ¡What? ¡

slide-41
SLIDE 41

Future ¡work ¡

  • • Compatibility with Pig 0.10.* and 0.11.*
  • • EC2 tutorial
  • • More examples/starter scripts
  • Inclusion of some of our Mahout tasks
  • Open source process for that is moving forward
  • • Better error logging and handling
  • Messages should be stored in a separate DB
  • • Easier deployments
  • Analytic daemons
  • Dependency libs
  • Fabric/Salt/Puppet/Chef
slide-42
SLIDE 42

BinaryPig ¡is ¡Open ¡Source! ¡

https://github.com/endgameinc/binarypig
 Apache 2 License

slide-43
SLIDE 43

We ¡are ¡hiring! ¡

http://endgame.com/careers

slide-44
SLIDE 44

QUESTIONS ¡