Top Banner
BEYOND PREVENTION, ASSUME BREACH Zach Grace
41

Assume Compromise

Apr 14, 2017

Download

Technology

Zach Grace
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: Assume Compromise

BEYOND PREVENTION, ASSUME BREACH

Zach Grace

Page 2: Assume Compromise

whoami /all• Lead Security Consultant at Northwestern Mutual

• @MilSec Leader

• OWASP Milwaukee Leader

• Wisconsin CCDC Red Team member

• Team member of the 2015 DerbyCon CTF champs

• Twitterz: @ztgrace

Page 3: Assume Compromise

Disclaimer

The opinions expressed here represent my own and not those of my employer.

Page 4: Assume Compromise
Page 5: Assume Compromise

It’s not if, but when…

Page 6: Assume Compromise

ASSUME COMPROMISE

• Protective technologies will fail

• Shifts blue team’s focus to the Detect phase

• Breach readiness as a mantra

Page 7: Assume Compromise

PROTECTION FAILS• Protection tools are often based on signatures

• Preventative in nature

• Examples of protective technologies:

• Anti-virus

• Firewalls

• IDS & IPS

• Web App Firewalls (WAF)

• Web Proxies

• Sandbox

Page 8: Assume Compromise

COMPARED TO ATTACKERSNIST CSF Identify Protect Detect Respond Recover

NIST SP800-115 Discovery Gaining Access

Escalating Privileges

System Browsing

Persistence

Cyber Kill Chain (1) Recon(3)

Delivery(4)

Exploit

(3) Delivery (4) Exploit (5) Install

(6) C2

Page 9: Assume Compromise
Page 10: Assume Compromise

ZoxPNG

• Used technet.microsoft.com for command and control https://blogs.rsa.com/wolves-among-us-abusing-trusted-providers-malware-operations/

Page 11: Assume Compromise

DETECT ISSUES

• Logging too little/much

• Poor Security information and event management (SIEM) correlation

• Ineffective security monitoring

• Insufficient training to create use cases

Page 12: Assume Compromise

REFOCUS THE RED TEAM

Page 13: Assume Compromise

PEN TESTING/RED TEAMING ISSUES

• Vulnerability focused

• Reporting doesn’t help defenders

• Lack of realistic threat modeling

Page 14: Assume Compromise

REPORTS

• Vulnerability Focused

• “How I PWN’d you”

• Vague recommendations

Page 15: Assume Compromise

REPORTS BE LIKE

Page 16: Assume Compromise

BLUE TEAM NEEDS

• Training partner

• Indicators of Compromise (IOCs)

• Attack signatures

• Use cases

Page 17: Assume Compromise

Compromise

Detection

Containment

MTD - MTC = ∆

Page 18: Assume Compromise

∆ FORCE

Page 19: Assume Compromise

∆ FORCE OBJECTIVES

• Provide IOCs and attack signatures alongside vulns in reports

• Perform threat simulations based on threat modeling

• Breakdown attacks into stages

• Validate detection at each stage, and assist with correlation

Page 20: Assume Compromise

PYRAMID OF PAIN

http://detect-respond.blogspot.com/2013/03/the-pyramid-of-pain.html

Page 21: Assume Compromise

HASH VALUES• Summary/signature of bytes

• Fuzzy hashing

Page 22: Assume Compromise

IP ADDRESSES

…the IP addresses used in an engagement

Page 23: Assume Compromise

DOMAIN NAMES

…domain names used in an engagement

Page 24: Assume Compromise

NETWORK ARTIFACTS• Protocol-level artifacts

• HTTP

• UserAgent strings

• Missing host header

• DNS

Page 25: Assume Compromise

HOST ARTIFACTS

• Persistence mechanisms

• Command & Control (C2/C&C)

• Backdoors

Page 26: Assume Compromise

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe" /v Debugger /t REG_SZ /d "C:\windows\system32\cmd.exe"

Page 27: Assume Compromise

Sticky Keys Hunter v2

Page 28: Assume Compromise

TOOLS

• Binaries/scripts transferred to host

• Built-in administrator tools

• Built/compiled on the compromised machine

Page 29: Assume Compromise

IN-MEMORY POWERSHELL

Page 30: Assume Compromise

TACTICS, TECHNIQUES and PROCEDURES (TTPs)

• Detecting and responding to adversarial behaviors

• Goes beyond tool detection

Page 31: Assume Compromise

LATERAL MOVEMENT• Windows

• SMB - Pass the Hash (PTH)

• WMI

• WinRM

• Linux/OS X/Unix

• SSH

Page 32: Assume Compromise

WIRESHARK CreateServiceW

Page 33: Assume Compromise

SNORT DETECTIONalert tcp any any -> any 445 (msg:"psexec service created"; flow:to_server,established; content:"|FF 53 4D 42|"; dce_opnum:12; reference:url,https://www.snort.org/faq/readme-dcerpc2; classtype:bad-unknown; sid:31337; rev:1;)

Page 34: Assume Compromise

SERVICE CREATION - 7045

Page 35: Assume Compromise

METASPLOIT SERVICE NAME

Page 36: Assume Compromise

POWERSHELL PSEXEC SERVICE

Service Name: zzVSnCcgDVXwECBU Service File Name: %COMSPEC% /C echo wmic computersystem get username ^> %SYSTEMDRIVE%\WINDOWS\Temp\JvuqFpTTakgmRppQ.txt > \WINDOWS\Temp\EtVsuSpjptOYGbwK.bat & %COMSPEC% /C start %COMSPEC% /C \WINDOWS\Temp\EtVsuSpjptOYGbwK.bat

Page 37: Assume Compromise

TIMELINE

Page 38: Assume Compromise

TIMELINE• Log all the commands

• HISTTIMEFORMAT="%d/%m/%y %T “

• test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f $HOME/logs/$(date +”%d-%b-%y_%H-%M-%S")_shell.log)

• Metasploit: setg PromptTimeFormat "%Y-%m-%d %I:%H:%S" setg Prompt "%T - (S: %S J: %J) " spool /root/.msf4/msfconsole.log

Page 39: Assume Compromise

TIPS FOR DEFENSE

• Use pen test & red team engagements as training exercises

• Ask for more than a vulnerability report (IOCs, PCAPs, logs, etc)

• Sit with and learn from the red team

• Rotate your testing firms or rotate your testers

• Perform root cause analysis on vulnerabilities

Page 40: Assume Compromise

TIPS FOR OFFENSE

• Be a sparring partner

• Provide more data like IOCs, PCAPs, logs, etc.

• Incorporate use cases into reports

• Provide artifacts to reproduce attacks

Page 41: Assume Compromise

THANK YOU! @ztgrace

https://github.com/ztgrace/presentations/tree/master/20160128_wctc_cyber_security_summit