Using Bro to Hunt Persistent Threats Benjamin H. Klimkowski United - - PowerPoint PPT Presentation

using bro to hunt persistent threats
SMART_READER_LITE
LIVE PREVIEW

Using Bro to Hunt Persistent Threats Benjamin H. Klimkowski United - - PowerPoint PPT Presentation

Using Bro to Hunt Persistent Threats Benjamin H. Klimkowski United States Military Academy 13 September 2017 Agenda 1. Goals 2. Definitions 3. Motivating problem 4. Approach 5. How Cobalt Strike works 6. Traffic analysis 7.


slide-1
SLIDE 1

Using Bro to Hunt Persistent Threats

Benjamin H. Klimkowski United States Military Academy 13 September 2017

slide-2
SLIDE 2

Agenda

1. Goals 2. Definitions 3. Motivating problem 4. Approach 5. How Cobalt Strike works 6. Traffic analysis 7. Evaluation 8. Results 9. Detecting other sets of activity 10. Future directions 11. Questions

slide-3
SLIDE 3

Goals

  • Demonstrate how Bro supports analysis over different phases of hunting
  • Discuss how persistent threat actors manipulate traffic to be stealthy
  • Share insights about Bro in a live detection setting and part of larger security

architecture

  • Share some cool tools and techniques
slide-4
SLIDE 4

Disclaimers

The views expressed in this presentation are those of the author and do not reflect the official policy or position of the Department of the Army, Department of Defense, or the US Government. The focus of this presentation is the not pedagogical merit of defensive cyber exercises/competitions This presentation is neither an indictment nor endorsement of Cobalt Strike

slide-5
SLIDE 5
slide-6
SLIDE 6

who --all

  • Undergraduate Team

○ Mitch Deridder ○ Dale Lakes ○ Matt Shockley Senior Faculty Advisor ○

  • W. Michael Petullo
slide-7
SLIDE 7

whoami

  • Professional

○ Cyber Protection Team Leader, Unites States Army Cyber Protection Brigade ○ Assistant Professor, Computer Science, United States Military Academy ○ Computer Network Operations Plans Officer, Army Cyber Command ○ Network Watch Officer, Army Cyber Operations and Integration Center ○ Infantry officer

  • Education

○ MS, Computer Science, University of Maryland ○ MS, Telecommunications, University of Colorado Boulder ○ BS, Mechanical Engineering, United States Military Academy

  • Research Interests: machine learning/data mining, network and host security, traffic

analysis

  • Father of three
  • Weightlifting, MMA, reading
slide-8
SLIDE 8

Definitions

  • Persistent threat

○ High tradecraft ○ Well-resourced ○ Leverages vectors that hide/obscure initial access

  • Hunting

○ “Proactive approach to identifying threats on network” ○ Threat-focused ○ Emphasis on data analysis to identify hard to find activity ○ May or may not be done in conjunction with incident response

slide-9
SLIDE 9

Motivating Problem

  • 2017 Cyber-Defense Exercise (CDX)

○ Sponsored by NSA ○ Blue forces: US and Canadian service academies compete ○ Participants design, build, and defend network

  • NSA Red Team

○ Simulated persistent threat compressed to four day ○ Target blue user workstations and services via an automated scoring system ○ Pre-compromised images ○ White-cell induced client-side attacks ○ Timed Injects/challenges

  • Defenders

○ Simulated SOC/NOSC/CERT ○ Part of larger architecture ○ Stiff availability penalties for loss of service and interaction with user workstations during competition

slide-10
SLIDE 10

Attack Cycle

  • Reconnaissance:

○ Passive and active reconnaissance

  • Scanning and enumeration:

○ Identify systems, services, topology, etc.

  • Gain initial access:

○ Software vulnerabilities ○ Weak passwords or configurations ○ Credential stealing, social engineering, insiders

  • Escalation of privilege:

○ Sniffing, keylogging, active attack

  • Maintain access:

○ Compromised accounts, rootkits, remote access tools (RATs)

  • Cover Tracks:

○ Delete logs/ history

slide-11
SLIDE 11

Our Approach

  • Understand how the threat operates
  • Analyze how to distinguish it from normal
  • Implement detection techniques
  • Evaluate and refine detection techniques
slide-12
SLIDE 12

Cobalt Strike

  • Commercial penetration testing platform
  • Evolved from Armitage
  • More than a front-end to Metasploit

○ Enables team offensive operations ○ Has a sophisticated payload delivery mechanism ○ Has a sophisticated callback mechanisms ■ A store-and-forward architecture via “beacons” ■ Beacons for DNS, HTTP, HTTPS, SMB ■ SMB only for inter-beacon communication

slide-13
SLIDE 13

How Cobalt Strike Works

slide-14
SLIDE 14
slide-15
SLIDE 15
slide-16
SLIDE 16
slide-17
SLIDE 17
slide-18
SLIDE 18
slide-19
SLIDE 19
slide-20
SLIDE 20
slide-21
SLIDE 21
slide-22
SLIDE 22
slide-23
SLIDE 23
slide-24
SLIDE 24
slide-25
SLIDE 25

Traffic Analysis

  • Stateless

○ HTTP ■ User agent string outlier detection ■ High entropy payloads ○ DNS ■ Nonce domains / high entropy subdomains ■ Reserved IP use in answers

  • Stateful

○ HTTP ■ Post/Get ratios ○ DNS ■ Excessive number of classful networks mappings to single base domain

slide-26
SLIDE 26

Traffic Analysis

  • Stateless

○ HTTP ■ User agent string outlier detection ■ High entropy payloads ○ DNS ■ Nonce domains / high entropy subdomains ■ Reserved IP use in answers

  • Stateful

○ HTTP ■ Post/Get ratios ○ DNS ■ Excessive number of classful networks mappings to single base domain

slide-27
SLIDE 27

broFreq isolated_http.log > isolated_http.freq; cat isolated_http.freq | bro-cut user_agent | uniq

https://github.com/spitfire55/MegaDev

slide-28
SLIDE 28
slide-29
SLIDE 29
slide-30
SLIDE 30

Doesn’t seem legit….

  • cat isolated_http.log | bro-cut host | sort | uniq | wc -l

○ 15177

  • cat isolated_http.log | bro-cut host user_agent | grep "Mozilla/4.0 (compatible;

MSIE 8.0; Windows NT 6.1)" | uniq ■ sosorry.ca Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)

  • cat isolated_http.log | bro-cut host method > hostVmethod.txt; getPostCompare

hostVmethod.txt https://github.com/spitfire55/MegaDev

slide-31
SLIDE 31

cat isolated_http.log | bro-cut host method > hostVmethod.txt; getPostCompare hostVmethod.txt

Hostname Number of Gets Number of Posts Get/Post Ratio rubberneck.hq.bluenet 2057.0 3705.0 0.5552 ... www.mtg.com 51.0 49.0 1.041 10.2.109.174 40.0 8.0 5.0 hammer.com 40.0 8.0 5.0 sosorry.ca 57792.0 323.0 178.92

slide-32
SLIDE 32

domainParser

  • Takes in a listing of domain names to frequencies and parses them into useful

formats for analysis

  • A Trie based data structure
  • 3 modes

○ “tree” for ■ A hierarchical representation ■ Can set desired branch depth ○ “text” output ■ Tabular listing of statistics for each domain name ■ Can set the desired level of subdomains to analyze, ie, www.foo.bar has three levels ■ Can set a minimum threshold of child subdomains for a domain

  • https://github.com/spitfire55/MegaDev
slide-33
SLIDE 33

domainParser cdx_query_freq.dns --text 3 50 > text_to_display_textout_3_50.txt

slide-34
SLIDE 34
slide-35
SLIDE 35
slide-36
SLIDE 36
slide-37
SLIDE 37

Doesn’t seem legit...

slide-38
SLIDE 38
slide-39
SLIDE 39
slide-40
SLIDE 40

Evaluation--CDX 2017

  • Part of larger defense-in-depth strategy

○ Elasticsearch-Logstash-Kibana (ELK) SIEM ■ Filebeat ingest from DMZ, firewall and Linux clients ■ Winbeat ingest from Windows clients ○ Snort IDS ○ Cisco ASA ○ Squid Proxy ○ VisorFlow: https://www.flyn.org/projects/VisorFlow/index.html

  • Bro server

○ CentOS 7, 12 Core, 20 GB RAM ○ PF_RING, full capture ○ Initially co-located with ELK SIEM ○ Move to be co-located with Snort IDS

slide-41
SLIDE 41

Results

  • Reduction of compromises

○ 1035 “token events” during the 2016 CDX ○ 15 “token events” during the 2017 CDX

  • Score

○ Highest live competition score ○ 1st Place in confidentiality/integrity category and availability category ○ 8% higher in confidentiality/integrity category than other competitors

  • Issues

○ Low number of HTTP/HTTPS events ○ ELK performance ■ High CPU and memory consumption ■ Kibana front-end limitations ○ Not fully leveraging Bro

slide-42
SLIDE 42

Evaluation--Performance testing

  • Xubuntu 14.04 VM

○ Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz ○ 4 Core ○ 9.6 GB RAM

  • Data Samples from 2016 and 2017 CDX competition for benchmark purposes
slide-43
SLIDE 43
slide-44
SLIDE 44
slide-45
SLIDE 45

Detecting Other Activity--DNSCAT

  • DNS-based exfil tool
  • Uses MX, CNAME, TXT records
  • Enables tunneling
  • Much noisier than Cobalt Strike

○ Very long nonce domains ○ Shows up almost immediately in weird.log

  • Similar techniques used for Cobalt Strike apply

○ High number of answers to one three-level domain name ○ High entropy subdomains

slide-46
SLIDE 46

Take-aways on persistent threats

  • Packing exfil data into protocols

○ Trade-off between amount of information transmitted per message and concealment ■ More information, less concealment ■ Less information, more concealment ○ Traffic profile potentially uncharacteristic

  • HTTPS is tough

○ SSL with legitimate certificates is hard to detect ○ Must be a deliberate focus

  • Importance of understanding “normal”
  • Importance of defense-in-depth
  • Need to be dynamic/not static
slide-47
SLIDE 47

Future Work

  • Continuation of this work

○ Database connections/memory management to scale ○ Other entropy measures for string/domain name characterization

  • Other directions

○ Instrumenting more signs of persistence/covert exfil ○ Tool fingerprinting ○ Benchmarking ■ Stateful scripts ■ Performance evaluations for different backend storage solutions

  • Potential new features to the Bro framework

○ ssl / x509 anomalies to weird.log ○ Additional data structures

slide-48
SLIDE 48

Questions https://github.com/spitfire55/MegaDev

slide-49
SLIDE 49

References

  • CrowdStrike. “Adversary Hunting And Incident Response: Network Edition.”

BlackHat 2016

  • Zeltser, Lenny. “Tunneling Data and Commands Over DNS to Bypass

Firewalls.” https://zeltser.com/c2-dns-tunneling/

  • Iagox86. “dnscat2.” https://github.com/iagox86/dnscat2
  • Mudge, Raphael. Advanced Threat Tactics for Penetration Testers.

https://www.cobaltstrike.com/training

slide-50
SLIDE 50

Backup

slide-51
SLIDE 51
slide-52
SLIDE 52

Implementation

slide-53
SLIDE 53
slide-54
SLIDE 54
slide-55
SLIDE 55
slide-56
SLIDE 56
slide-57
SLIDE 57
slide-58
SLIDE 58
slide-59
SLIDE 59