Targeted Attacks Targeted Attacks
How We're Getting Creamed
By Ed Skoudis J 9 2011 June 9, 2011
$ cut -f5 -d: /etc/passwd | grep -i skoudis
• Ed Skoudis
• Started infosec career at Bellcore in 1996 working for phone companies… eventually got into…
– Pen tests
– Incident response – Digital forensics
• SANS Instructor
– Author of classes on Incident Handling (SANS 504), Network Penetration Testing (560), Windows Command Line (531), and Metasploit (580)
• InGuardians Co-Founder… Infosec research and consulting
• Author -- Counter Hack Reloaded & Malware - Fighting Malicious Code
• Expert witness on over 100 large-scale breach cases since 2002
• Expert witness on over 100 large scale breach cases since 2002
l
Outline
• Introduction
• Attack techniques used most often inAttack techniques used most often in today’s targeted attacks
• A Scenario
• A Scenario
• Lessons Learned C l i
• Conclusions
Introduction Introduction
• Attackers are growing more sophisticated and more
• Attackers are growing more sophisticated and more brazen
• They are attacking major organizations that design, build,
d t d ld
secure, and operate our modern world
– Google – RSA
– Lockheed-Martin Corp
– Large-scale petroleum companies – Large-scale credit card breaches
• Each attack is different in its particulars… but there are some common threads
• We need vast improvements in our defensive capabilities
• We need vast improvements in our defensive capabilities around these common techniques
l
Outline
• Introduction
• Attack techniques used most often inAttack techniques used most often in today’s targeted attacks
• A Scenario
• A Scenario
• Lessons Learned C l i
• Conclusions
Common Bad Guy Techniques in Recent Cases
• Proliferation of initial infection vectors – SQLi
– Wireless
– Targeted phishing… often as prelude to…g g
– <blink> Client-side exploitation </blink>
– P2P leakage
– Infected home machine brings attacker in (mobile laptop or VPN)g ( p p )
• Social networks for in-depth reconnaissance
• Merciless pivoting
– Flat unsegmented networks are easy pickin’s for the bad guysFlat, unsegmented networks are easy pickin s for the bad guys
– But, even segmented networks are subject to attack through pivoting…
attackers are getting very clever about pivoting
• Reverse shell / “phone home” malwareReverse shell / phone home malware
Additional Common
Techniques Used in Breaches Techniques Used in Breaches
• Pass the hash & token stealing attacks are very widespread
Grab Windows hashes from one machine and use them to spread throughout – Grab Windows hashes from one machine and use them to spread throughout
domain without ever knowing the actual password
– Seize a security token from a machine where a domain admin is logged in – Didja see Hernan Ochoa’s new version of Win Credentials Editor (1 2) with – Didja see Hernan Ochoa s new version of Win Credentials Editor (1.2) with
pass-the-ticket for MS Kerberos?
• Memory scraping
– Bypasses network and file system encryption – Bypasses network and file system encryption – End-to-end encryption is NOT a panacea!
• Local privilege escalation
Especially when combined with client side exploitation – Especially when combined with client-side exploitation
• Use of sysadmin tools for attack
– Microsoft SysInternals psexec very common
Remember that it leaves behind a psexec service which we can look for
• Remember that it leaves behind a psexec service which we can look for
• Some use of custom malware, but often intermixed with common stuff
l
Outline
• Introduction
• Attack techniques used most often inAttack techniques used most often in today’s targeted attacks
• A Scenario
• A Scenario
• Lessons Learned C l i
• Conclusions
Attacker Places Malicious Content C i d Thi d P t Sit on a Compromised Third-Party Site
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall Firewall Firewall Firewall Infrastructure Infrastructure
Internal Network Users Internal Network Users Evil
Content
Web Site Web Site in the Cloud in the Cloud
Harvest Employee Information f S i l N t k Sit
from Social Network Sites
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Company Affiliation and
Hobbies, Interests, and
R l ti hi JuicyJuicy
Secrets Secrets
Target Corporate
Network
Internet
Firewall Firewall
E-mail Addrs Relationships
Firewall Firewall Infrastructure Infrastructure
Mistake #1: Lacking a policy and awareness campaign for social network Internal Network Users
Internal Network Users Evil
Content
Mistake #1: Lacking a policy and awareness campaign for social network
Spear Phishing Spear Phishing
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Convincing
e-mail with JuicyJuicy
Secrets Secrets
Target Corporate
Network
Internet
Firewall Firewall e-mail with
enticing link
Firewall Firewall Infrastructure Infrastructure
Mistake #2: Inbound filtering didn't block the phishing e-mail Internal Network Users Internal Network Users Evil
Content
Mistake #2: Inbound filtering didn t block the phishing e mail.
Web Site Web Site in the Cloud in the Cloud
User Clicks on Link, Launching
B t S f t Att k ' C t t Browser to Surf to Attacker's Content
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall Firewall Request for
web page
Firewall Firewall Infrastructure Infrastructure
Mistake #3: Lack of use awareness undermines security
Internal Network Users Internal Network Users Evil
Content
Mistake #3: Lack of use awareness undermines security.
Evil Content Includes Cli t Sid E l it Client-Side Exploit
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Evil
Firewall Firewall Infrastructure Infrastructure
Mistake #4: Evil content (with client-side exploit) makes it through Internal Network Users Internal Network Users Evil
Content
Evil Content
Mistake #4: Evil content (with client side exploit) makes it through network-based IPS and evades detection on internal host.
Web Site Web Site in the Cloud in the Cloud
Client-Side Exploit Runs with No
F th U I t ti
Further User Intervention
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back-
Firewall Firewall Infrastructure Infrastructure
Mistake #5: Malicious content runs and exploits client software often Internal Network Users Internal Network Users
door
Evil Content
Mistake #5: Malicious content runs and exploits client software, often
Outbound Access Yields Inbound Att k C t l
Attacker Control
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back-
Firewall Firewall Infrastructure Infrastructure
Mistake #6: No blocking of command-and-control channel (reverse shell) Internal Network Users
Internal Network Users door
Evil Content
Mistake #6: No blocking of command and control channel (reverse shell) for backdoor, which may be a connection to a geographic location where the organization does not do business.
Web Site Web Site in the Cloud in the Cloud
Still Lacking Domain Admin, Bad Guy
S f W k DMZ S
Scans for Weak DMZ Servers
Database Database Server Server
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back-
Firewall Firewall Infrastructure Infrastructure
Mistake #7: Vulnerability scan goes undetected
Internal Network Users Internal Network Users
door
Evil Content
Mistake #7: Vulnerability scan goes undetected.
SQL Injection Flaw on Public Website DMZ
on DMZ
Database Database Server Server More Evil
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
More Evil Content
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back-
Firewall Firewall Infrastructure Infrastructure
Mistake #9: Attacker exploits SQL injection flaw to upload malicious Internal Network Users Internal Network Users
door
Evil Content
Mistake #9: Attacker exploits SQL injection flaw to upload malicious content to website, whose web pages are dynamically built from content on back-end database server.
Web Site Web Site in the Cloud in the Cloud
Inject Malicious Content into Target's O DMZ W b it
Own DMZ Website
Database Database Server Server More Evil
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
More Evil Content
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back-
M E il Firewall
Firewall Infrastructure Infrastructure
Mistake #10: Another intranet user accesses more evil content through Internal Network Users Internal Network Users
door
Evil Content
More Evil Content
Mistake #10: Another intranet user accesses more evil content through
Another Backdoor Installed with
C d d C t l Ch l
Command-and-Control Channel
Database Database Server Server More Evil
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
More Evil Content
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back- Back-
Firewall Firewall Infrastructure Infrastructure
Internal Network Users Internal Network Users
door
Evil Content
door
Web Site Web Site in the Cloud in the Cloud
Local Privilege Escalation to G t
L l
SYSTEM P iGet
Local
SYSTEM PrivsDatabase Database Server Server More Evil
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
More Evil Content
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back- Back-
Firewall Firewall Infrastructure Infrastructure
Internal Network Users Internal Network Users
door
Evil Content
door
Mistake #11: Organizations deploy patches for local privilege escalation Mistake #11: Organizations deploy patches for local privilege escalation
Attacker Uses
Local
SYSTEM Privs to G b T k fD i
Ad iGrab Token for
Domain
AdminDatabase Database Server Server More Evil
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
More Evil Content
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back- Back-
Firewall Firewall Infrastructure Infrastructure
Internal Network Users Internal Network Users
door
Evil Content
door
Mistake #12: Domain admin credentials must be used very sparingly!
Mistake #12: Domain admin credentials must be used very sparingly!
Cached credentials on machines can be harvested by attackers and used.
Even an incident responder or forensics analyst could use psexec and Web Site
Web Site in the Cloud in the Cloud
Attacker Uses Domain Admin Token to
A I t t S
Access Intranet Server
Database Database Server Server More Evil
Public Public Website Website
Li k dI Li k dI File
File Distribution Distribution
Service Service
Facebook Facebook
More Evil Content
Intranet Intranet Server Server with with Juicy Juicy
T t
LinkedIn LinkedIn Service
Service
Juicy Juicy Secrets Secrets
Target Corporate
Network
Internet
Firewall
Firewall Back- Back-
Firewall Firewall Infrastructure Infrastructure
Internal Network Users Internal Network Users
door
Evil Content
door
Mistake #13: Log monitoring of access to juicy secrets is very limited Juicy
Secrets Mistake #13: Log monitoring of access to juicy secrets is very limited, Secrets
l
Outline
• Introduction
• Attack techniques used most often inAttack techniques used most often in today’s targeted attacks
• A Scenario
• A Scenario
• Lessons Learned C l i
• Conclusions
d Lessons Learned
• Top four areas of focus in securing against
• Top four areas of focus in securing against these kinds of attacks:
– User awareness is keyy
– Client-side patching is vital
– Monitoring thoroughly and carefully is extremely important
important
• Unusual access times and destinations
• Large-scale data transfers (make sure you log size)
• Intranet and DMZ scanning
• Intranet and DMZ scanning
– Customized malware makes behavior-based detection more important than ever
Signatures (strict and fuzzy) must be augmented with
• Signatures (strict and fuzzy) must be augmented with
Conclusions Conclusions
• Sensitive data breaches show no signs of letting up
– Attackers are getting more clever and more lethal than ever
– More breaches than ever, at a smaller scale of compromised accounts… still messing you up!
compromised accounts… still messing you up!
• Thorough incident and log analysis is really helpful, but only if it is done proactivelyy p y
• Most organizations need to change their culture regarding log analysis