SlideShare uma empresa Scribd logo
1 de 41
ARMING SMALL SECURITY PROGRAMS: BROPY
Arming Small Security Programs
BSidesCharm
ARMING SMALL SECURITY PROGRAMS: BROPY
Network baseline generation
with Bropy
Arming Small
Security Programs
ARMING SMALL SECURITY PROGRAMS: BROPY
• I “borrowed” my employers slide template
– Creating .POT files is hard
• This is NOT my employers material
• TLDR; You can sue me, not my employer
Disclaimer
ARMING SMALL SECURITY PROGRAMS: BROPY
Matt Domko
– Beard Enthusiast
– Former:
• Parachutist
• Enterprise Admin
• “Cyber Network Defender”
– Instructor at Chiron Technology Services
– Started blogging about Blue Team stuff
http://goo.gl/uznCag
– Brakesec Slack
https://brakesec.signup.team
– @hashtagcyber
About Me
ARMING SMALL SECURITY PROGRAMS: BROPY
“Make the world a safer place”
{by sharing information}
Why I’m here
ARMING SMALL SECURITY PROGRAMS: BROPY
• Malicious network activity CAN be identified using
signatures…
The Problem: Detecting Malicious Network
Activity
ARMING SMALL SECURITY PROGRAMS: BROPY
The Problem: Detecting Malicious Network
Activity
ARMING SMALL SECURITY PROGRAMS: BROPY
The Problem: Detecting Malicious Network
Activity
ARMING SMALL SECURITY PROGRAMS: BROPY
The Problem: Detecting Malicious Network
Activity
ARMING SMALL SECURITY PROGRAMS: BROPY
• And more signatures….
• Fingerprinting EVERY attack is impossible
• Signature based detection is USELESS if a signature
does not exist for the attack being performed
The Problem: Detecting Malicious Network
Activity
ARMING SMALL SECURITY PROGRAMS: BROPY
The Initial Idea
ARMING SMALL SECURITY PROGRAMS: BROPY
Step 1: Build a network baseline.
– Bro?
– Netflow?
Step 2: Write SNORT rules.
– I need alerts for non-standard traffic
Step 3: ?
– Something … Something … Something…
Step 4: Profit!
– Or at least spend less time worrying
The Initial Idea
ARMING SMALL SECURITY PROGRAMS: BROPY
• Administrators face a similar problem with detecting
malicious binaries.
• Antivirus products initially only used file signatures to
identify malware:
– Evil Hashes
– Ego Strings
– Reused code blocks
• This eventually failed, as attackers could easily modify
malware to avoid signatures faster than they are
generated
– MSFVenom, Veil-Evasion, Hyperion
A Similar Problem: Malicious Binaries
ARMING SMALL SECURITY PROGRAMS: BROPY
• Heuristic detection helped, but does it catch everything?
– No. (Malware still exists/functions today)
• What else can we do?
– Enter Application Whitelisting
A Similar Problem: Malicious Binaries
ARMING SMALL SECURITY PROGRAMS: BROPY
• Application Whitelisting provides ability to:
– Log execution of all files except explicitly authorized (whitelist):
• File Hashes (tedious)
• File Names (poor protection)
• Signed Code (Awesome)
• Source Directory (simple)
– Prevent execution of files that are not in the whitelist.
– Prevent execution of explicitly defined files (Blacklisting)
A Similar Problem: Malicious Binaries
ARMING SMALL SECURITY PROGRAMS: BROPY
1. Start with an empty whitelist
2. Apply a policy to log everything not in whitelist
3. Use logs to generate a whitelist
4. Modify policy to block everything not in whitelist
5. Review new logs
• Investigate blocked files
• Update whitelist as needed
Simple Application Whitelisting
Implementation
ARMING SMALL SECURITY PROGRAMS: BROPY
• The same concept can be applied to network activity:
– Start with an empty whitelist
– Apply a policy to log all traffic not in the whitelist
– Use logs to update the whitelist
– Review new logs
• Investigate new ports/hosts
• Update whitelist as needed
Malicious Network Activity : Anomaly
Detection
ARMING SMALL SECURITY PROGRAMS: BROPY
• Get data for my whitelist?
– Bro.
• Create a policy to log traffic?
– Bro scripts
• Create logs from new traffic?
– Bro scripts
• Review new logs?
– ELSA
• Last question… Can you tell me more about Bro?
But Matt, How Do I <do thing>?
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro in 30 Seconds
– Much more than an IDS
– Logs multiple layers of traffic
– “Packet String”
– Similar to NETFLOW
– Plugins/Scripts
– Interpret Data
– Take action
– Logs are small
• Allows for longer retention than PCAP
– Open Source, Built-in to Security Onion
Gathering Data with Bro
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Data Formatting
– Tab Separated table
– Headers at top
– Common Fields:
• Timestamp (ts)
• Connection ID (uid)
• IP Source (id.orig_h)
• Source Port (id.orig_p)
• IP Destination (id.resp_h)
• Dest Port (id.resp_p)
Gathering Data with Bro
ARMING SMALL SECURITY PROGRAMS: BROPY
• Logs are simple to parse …. programmatically
Gathering Data with Bro
ARMING SMALL SECURITY PROGRAMS: BROPY
• Humans should use ELSA, Splunk, etc…
Gathering Data with Bro
ARMING SMALL SECURITY PROGRAMS: BROPY
• Key Directories:
– /nsm/bro/logs/current
• notice.log
• conn.log
• weird.log
– /opt/bro/share/bro/policy
• Contains scripts loaded by Bro
– /opt/bro/share/bro/site/local.bro
• Add path to custom scripts to this file to load when bro starts
Gathering Data with Bro
ARMING SMALL SECURITY PROGRAMS: BROPY
“The best way to learn to write Bro scripts, is
to write Bro scripts”
– Seth Hall, SecurityOnion Conference 2015
Bro Scripts
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Scripting
Bro Scripts
owner@onion:~/simple$ cat simple.bro
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
event bro_init()
{
print "Lets print myports.";
print fmt ("There are %d in the list.", |myports|);
for (x in myports)
print x;
}
event new_connection(c:connection)
{
if (c$id$resp_p in myports)
{
print fmt("Port %s connection detected", c$id$resp_p);
};
};
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Scripting
Bro Scripts
owner@onion:~/simple$ cat simple.bro
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
event bro_init()
{
print "Lets print myports.";
print fmt ("There are %d in the list.", |myports|);
for (x in myports)
print x;
}
event new_connection(c:connection)
{
if (c$id$resp_p in myports)
{
print fmt("Port %s connection detected", c$id$resp_p);
};
};
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
#Create a list
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Scripting
Bro Scripts
owner@onion:~/simple$ cat simple.bro
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
event bro_init()
{
print "Lets print myports.";
print fmt ("There are %d in the list.", |myports|);
for (x in myports)
print x;
}
event new_connection(c:connection)
{
if (c$id$resp_p in myports)
{
print fmt("Port %s connection detected", c$id$resp_p);
};
};
event bro_init()
{
#Do stuff when Bro loads
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Scripting
Bro Scripts
owner@onion:~/simple$ cat simple.bro
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
event bro_init()
{
print "Lets print myports.";
print fmt ("There are %d in the list.", |myports|);
for (x in myports)
print x;
}
event new_connection(c:connection)
{
if (c$id$resp_p in myports)
{
print fmt("Port %s connection detected", c$id$resp_p);
};
};
print fmt ("There are %d in the list.", |myports|);
#Format string
# |var| gets length of list
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Scripting
Bro Scripts
owner@onion:~/simple$ cat simple.bro
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
event bro_init()
{
print "Lets print myports.";
print fmt ("There are %d in the list.", |myports|);
for (x in myports)
print x;
}
event new_connection(c:connection)
{
if (c$id$resp_p in myports)
{
print fmt("Port %s connection detected", c$id$resp_p);
};
};
event new_connection(c:connection)
{
# Do the thing in curley braces when Bro detects
a new connection
ARMING SMALL SECURITY PROGRAMS: BROPY
• Bro Scripting
Bro Scripts
owner@onion:~/simple$ cat simple.bro
global myports: set[port] = {21/tcp, 22/tcp, 0/icmp};
event bro_init()
{
print "Lets print myports.";
print fmt ("There are %d in the list.", |myports|);
for (x in myports)
print x;
}
event new_connection(c:connection)
{
if (c$id$resp_p in myports)
{
print fmt("Port %s connection detected", c$id$resp_p);
};
};
if (c$id$resp_p in myports)
{
#If the destination port (c$id$resp_p) is in the list,
do the thing in curley brackets
ARMING SMALL SECURITY PROGRAMS: BROPY
Baselinereport.bro ::Pseudocode
1. Load table (baseline.data)
2. Check every new connection:
– Is the destination on the baselined subnet?
• If so, is it in the baseline?
– If it’s in the baseline, is the source address allowed to use that
port?
3. Log any “No’s”
Something a little more useful…
ARMING SMALL SECURITY PROGRAMS: BROPY
1. git clone https://github.com/hashtagcyber/baseliner.git
2. Edit line 32 of baselinereport.bro, replace with a comma separated
list of subnets
3. Copy both files to /opt/bro/share/bro/policy/misc
4. Add “@load misc/baselinereport” to /opt/bro/share/bro/site/local.bro
5. Restart Bro
Installing Baselinereport.bro
ARMING SMALL SECURITY PROGRAMS: BROPY
• Useful search terms:
– Show all notice’s generated by baselinereport
• class=BRO_NOTICE "-" notice_type="TrafficBaselineException“
– Show all connections to an IP, grouped by destination port
• BRO_CONN.dstip=156.22.10.10 groupby:dstport
– Show all connection to an IP/Port pair grouped by source IP
• BRO_CONN.dstip=156.22.10.10 BRO_CONN.dstport=445
groupby:srcip
ELSA Demo
ARMING SMALL SECURITY PROGRAMS: BROPY
Updating Baseline w/ ELSa & VI
ARMING SMALL SECURITY PROGRAMS: BROPY
• That sounds like a lot of
work…
But ….
ARMING SMALL SECURITY PROGRAMS: BROPY
• Written in Python
• Installs baselinereport.bro script
• Parses notice.log
• Generates network baseline automatically
• Simple Yes/No interface
Bropy
ARMING SMALL SECURITY PROGRAMS: BROPY
Scenario Network
ARMING SMALL SECURITY PROGRAMS: BROPY
• Demo Time
Bropy
ARMING SMALL SECURITY PROGRAMS: BROPY
1. git clone https://github.com/hashtagcyber/bropy
2. cd bropy
3. sudo ./bropy.py
– Select option 3 to install
• Enter the subnet and CIDR that you would like to monitor
• Example: 156.22.10.0/24
4. Select Y to restart Bro
5. Wait for logs to be generated….
6. sudo ./bropy.py
– Select option 1 to “Auto Baseline”
– Select option 2 for Y/N prompting
Bropy on SecurityOnion
ARMING SMALL SECURITY PROGRAMS: BROPY
• Generate a list of every port/protocol
critical hosts receive connections on
• Receive alerts when non-standard
connections are detected
• Baseline data can be used to generate
firewall lists
Use Case
ARMING SMALL SECURITY PROGRAMS: BROPY
Questions?

Mais conteúdo relacionado

Último

Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 

Último (20)

Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Destaque

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Destaque (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

BSides Charm2017 Arming Small Security Programs-Bropy

  • 1. ARMING SMALL SECURITY PROGRAMS: BROPY Arming Small Security Programs BSidesCharm
  • 2. ARMING SMALL SECURITY PROGRAMS: BROPY Network baseline generation with Bropy Arming Small Security Programs
  • 3. ARMING SMALL SECURITY PROGRAMS: BROPY • I “borrowed” my employers slide template – Creating .POT files is hard • This is NOT my employers material • TLDR; You can sue me, not my employer Disclaimer
  • 4. ARMING SMALL SECURITY PROGRAMS: BROPY Matt Domko – Beard Enthusiast – Former: • Parachutist • Enterprise Admin • “Cyber Network Defender” – Instructor at Chiron Technology Services – Started blogging about Blue Team stuff http://goo.gl/uznCag – Brakesec Slack https://brakesec.signup.team – @hashtagcyber About Me
  • 5. ARMING SMALL SECURITY PROGRAMS: BROPY “Make the world a safer place” {by sharing information} Why I’m here
  • 6. ARMING SMALL SECURITY PROGRAMS: BROPY • Malicious network activity CAN be identified using signatures… The Problem: Detecting Malicious Network Activity
  • 7. ARMING SMALL SECURITY PROGRAMS: BROPY The Problem: Detecting Malicious Network Activity
  • 8. ARMING SMALL SECURITY PROGRAMS: BROPY The Problem: Detecting Malicious Network Activity
  • 9. ARMING SMALL SECURITY PROGRAMS: BROPY The Problem: Detecting Malicious Network Activity
  • 10. ARMING SMALL SECURITY PROGRAMS: BROPY • And more signatures…. • Fingerprinting EVERY attack is impossible • Signature based detection is USELESS if a signature does not exist for the attack being performed The Problem: Detecting Malicious Network Activity
  • 11. ARMING SMALL SECURITY PROGRAMS: BROPY The Initial Idea
  • 12. ARMING SMALL SECURITY PROGRAMS: BROPY Step 1: Build a network baseline. – Bro? – Netflow? Step 2: Write SNORT rules. – I need alerts for non-standard traffic Step 3: ? – Something … Something … Something… Step 4: Profit! – Or at least spend less time worrying The Initial Idea
  • 13. ARMING SMALL SECURITY PROGRAMS: BROPY • Administrators face a similar problem with detecting malicious binaries. • Antivirus products initially only used file signatures to identify malware: – Evil Hashes – Ego Strings – Reused code blocks • This eventually failed, as attackers could easily modify malware to avoid signatures faster than they are generated – MSFVenom, Veil-Evasion, Hyperion A Similar Problem: Malicious Binaries
  • 14. ARMING SMALL SECURITY PROGRAMS: BROPY • Heuristic detection helped, but does it catch everything? – No. (Malware still exists/functions today) • What else can we do? – Enter Application Whitelisting A Similar Problem: Malicious Binaries
  • 15. ARMING SMALL SECURITY PROGRAMS: BROPY • Application Whitelisting provides ability to: – Log execution of all files except explicitly authorized (whitelist): • File Hashes (tedious) • File Names (poor protection) • Signed Code (Awesome) • Source Directory (simple) – Prevent execution of files that are not in the whitelist. – Prevent execution of explicitly defined files (Blacklisting) A Similar Problem: Malicious Binaries
  • 16. ARMING SMALL SECURITY PROGRAMS: BROPY 1. Start with an empty whitelist 2. Apply a policy to log everything not in whitelist 3. Use logs to generate a whitelist 4. Modify policy to block everything not in whitelist 5. Review new logs • Investigate blocked files • Update whitelist as needed Simple Application Whitelisting Implementation
  • 17. ARMING SMALL SECURITY PROGRAMS: BROPY • The same concept can be applied to network activity: – Start with an empty whitelist – Apply a policy to log all traffic not in the whitelist – Use logs to update the whitelist – Review new logs • Investigate new ports/hosts • Update whitelist as needed Malicious Network Activity : Anomaly Detection
  • 18. ARMING SMALL SECURITY PROGRAMS: BROPY • Get data for my whitelist? – Bro. • Create a policy to log traffic? – Bro scripts • Create logs from new traffic? – Bro scripts • Review new logs? – ELSA • Last question… Can you tell me more about Bro? But Matt, How Do I <do thing>?
  • 19. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro in 30 Seconds – Much more than an IDS – Logs multiple layers of traffic – “Packet String” – Similar to NETFLOW – Plugins/Scripts – Interpret Data – Take action – Logs are small • Allows for longer retention than PCAP – Open Source, Built-in to Security Onion Gathering Data with Bro
  • 20. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Data Formatting – Tab Separated table – Headers at top – Common Fields: • Timestamp (ts) • Connection ID (uid) • IP Source (id.orig_h) • Source Port (id.orig_p) • IP Destination (id.resp_h) • Dest Port (id.resp_p) Gathering Data with Bro
  • 21. ARMING SMALL SECURITY PROGRAMS: BROPY • Logs are simple to parse …. programmatically Gathering Data with Bro
  • 22. ARMING SMALL SECURITY PROGRAMS: BROPY • Humans should use ELSA, Splunk, etc… Gathering Data with Bro
  • 23. ARMING SMALL SECURITY PROGRAMS: BROPY • Key Directories: – /nsm/bro/logs/current • notice.log • conn.log • weird.log – /opt/bro/share/bro/policy • Contains scripts loaded by Bro – /opt/bro/share/bro/site/local.bro • Add path to custom scripts to this file to load when bro starts Gathering Data with Bro
  • 24. ARMING SMALL SECURITY PROGRAMS: BROPY “The best way to learn to write Bro scripts, is to write Bro scripts” – Seth Hall, SecurityOnion Conference 2015 Bro Scripts
  • 25. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Scripting Bro Scripts owner@onion:~/simple$ cat simple.bro global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; event bro_init() { print "Lets print myports."; print fmt ("There are %d in the list.", |myports|); for (x in myports) print x; } event new_connection(c:connection) { if (c$id$resp_p in myports) { print fmt("Port %s connection detected", c$id$resp_p); }; };
  • 26. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Scripting Bro Scripts owner@onion:~/simple$ cat simple.bro global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; event bro_init() { print "Lets print myports."; print fmt ("There are %d in the list.", |myports|); for (x in myports) print x; } event new_connection(c:connection) { if (c$id$resp_p in myports) { print fmt("Port %s connection detected", c$id$resp_p); }; }; global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; #Create a list
  • 27. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Scripting Bro Scripts owner@onion:~/simple$ cat simple.bro global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; event bro_init() { print "Lets print myports."; print fmt ("There are %d in the list.", |myports|); for (x in myports) print x; } event new_connection(c:connection) { if (c$id$resp_p in myports) { print fmt("Port %s connection detected", c$id$resp_p); }; }; event bro_init() { #Do stuff when Bro loads
  • 28. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Scripting Bro Scripts owner@onion:~/simple$ cat simple.bro global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; event bro_init() { print "Lets print myports."; print fmt ("There are %d in the list.", |myports|); for (x in myports) print x; } event new_connection(c:connection) { if (c$id$resp_p in myports) { print fmt("Port %s connection detected", c$id$resp_p); }; }; print fmt ("There are %d in the list.", |myports|); #Format string # |var| gets length of list
  • 29. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Scripting Bro Scripts owner@onion:~/simple$ cat simple.bro global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; event bro_init() { print "Lets print myports."; print fmt ("There are %d in the list.", |myports|); for (x in myports) print x; } event new_connection(c:connection) { if (c$id$resp_p in myports) { print fmt("Port %s connection detected", c$id$resp_p); }; }; event new_connection(c:connection) { # Do the thing in curley braces when Bro detects a new connection
  • 30. ARMING SMALL SECURITY PROGRAMS: BROPY • Bro Scripting Bro Scripts owner@onion:~/simple$ cat simple.bro global myports: set[port] = {21/tcp, 22/tcp, 0/icmp}; event bro_init() { print "Lets print myports."; print fmt ("There are %d in the list.", |myports|); for (x in myports) print x; } event new_connection(c:connection) { if (c$id$resp_p in myports) { print fmt("Port %s connection detected", c$id$resp_p); }; }; if (c$id$resp_p in myports) { #If the destination port (c$id$resp_p) is in the list, do the thing in curley brackets
  • 31. ARMING SMALL SECURITY PROGRAMS: BROPY Baselinereport.bro ::Pseudocode 1. Load table (baseline.data) 2. Check every new connection: – Is the destination on the baselined subnet? • If so, is it in the baseline? – If it’s in the baseline, is the source address allowed to use that port? 3. Log any “No’s” Something a little more useful…
  • 32. ARMING SMALL SECURITY PROGRAMS: BROPY 1. git clone https://github.com/hashtagcyber/baseliner.git 2. Edit line 32 of baselinereport.bro, replace with a comma separated list of subnets 3. Copy both files to /opt/bro/share/bro/policy/misc 4. Add “@load misc/baselinereport” to /opt/bro/share/bro/site/local.bro 5. Restart Bro Installing Baselinereport.bro
  • 33. ARMING SMALL SECURITY PROGRAMS: BROPY • Useful search terms: – Show all notice’s generated by baselinereport • class=BRO_NOTICE "-" notice_type="TrafficBaselineException“ – Show all connections to an IP, grouped by destination port • BRO_CONN.dstip=156.22.10.10 groupby:dstport – Show all connection to an IP/Port pair grouped by source IP • BRO_CONN.dstip=156.22.10.10 BRO_CONN.dstport=445 groupby:srcip ELSA Demo
  • 34. ARMING SMALL SECURITY PROGRAMS: BROPY Updating Baseline w/ ELSa & VI
  • 35. ARMING SMALL SECURITY PROGRAMS: BROPY • That sounds like a lot of work… But ….
  • 36. ARMING SMALL SECURITY PROGRAMS: BROPY • Written in Python • Installs baselinereport.bro script • Parses notice.log • Generates network baseline automatically • Simple Yes/No interface Bropy
  • 37. ARMING SMALL SECURITY PROGRAMS: BROPY Scenario Network
  • 38. ARMING SMALL SECURITY PROGRAMS: BROPY • Demo Time Bropy
  • 39. ARMING SMALL SECURITY PROGRAMS: BROPY 1. git clone https://github.com/hashtagcyber/bropy 2. cd bropy 3. sudo ./bropy.py – Select option 3 to install • Enter the subnet and CIDR that you would like to monitor • Example: 156.22.10.0/24 4. Select Y to restart Bro 5. Wait for logs to be generated…. 6. sudo ./bropy.py – Select option 1 to “Auto Baseline” – Select option 2 for Y/N prompting Bropy on SecurityOnion
  • 40. ARMING SMALL SECURITY PROGRAMS: BROPY • Generate a list of every port/protocol critical hosts receive connections on • Receive alerts when non-standard connections are detected • Baseline data can be used to generate firewall lists Use Case
  • 41. ARMING SMALL SECURITY PROGRAMS: BROPY Questions?