whoami
Dominic White
CTO @ SensePost
We
Hack | Build | Train | Scan
Stuff
@singe / @sensepost
dominic@sensepost.com
info/research/job @sensepost.com
What Happened
• 7 April 2014 – Vulnerability announced to the world
with a website, OpenSSL vulnerability announcement
and new code release (1.0.1g)
– Found by two groups; Google Security Team (Neel Mehta
& Condenomicon)
• Told that private keys to SSL certificates could be
exposed – uh oh
• Operating systems had not packaged the new
release, so many were vulnerable
• Many big name companies were vulnerable; Big Tech
names, Banks, Law Enforcement, Intelligence Agencies
• Online testers appeared, and were quickly swamped
• But ….
What is it?
• Vulnerability in a widely used cryptographic
library
– i.e. lots of Unix things use this to do encryption
• Vulnerability specific to SSL Heartbeats
– RFC 6520 https://tools.ietf.org/html/rfc6520
• Introduced on Dec 31 2011 by Dr Stephen
Henson
• Allows you to read parts of a program memory
– Buffer Over Read
Demo
• Extracting cookies & private SSL keys from a
vulnerable server
Why does it work
• OpenSSL is just the library, the actual process is
something like Apache, Nginx, Dovecot, Exim
etc.
• These processes have a HEAP, in which data
used by the process is stored.
– If the process is active, it changes a lot
• Certificate private keys are made up
of two large prime numbers; we can
find these if they were used recently
The slow path to enlightenment
• Initial testers looked for vanilla SSL on port 443
using TLS v1.1
– Most famous and first PoC by Jared Stafford; ssltest.py
• But:
– SSL runs on non-standard ports
– Some servers didn’t support TLS v1.1
– SSL can be invoked on clear-text ports with STARTLS
• STARTTLS is different for different protocols
– Clients are vulnerable too!
– Lots of debate about whether keys could be grabbed
• CloudFlare challenge cleared that up
– IDS signatures were quickly defeated
Meanwhile ….
• #heartbleedvirus
• Bruce Schneier
– “On the scale of 1 to 10, this is an 11.”
• I’m not Vulnerable, the scanner said so!
• Claims of NSA backdoor bogey men
• EVERYBODY CHANGE ALL YOUR PASSWORDS!
– NO WAIT, CHANGE THEM AGAIN!
How Bad Was It?
• Masscan (Robert Graham)
– 615 268 / 28 581 134
– After one month 318 239
• Our clients
– 1.8% when it broke
– Offered free “complete” scan
– 24 / 224 186
Tactical Defence
Fix the Vuln
• Patch it
– OpenSSL >= 1.0.1g
– Old versions < 1.0.1 unaffected
• Disable it
– Firewall, VPN?
• Reconfigure it
– Disable heartbeats
– Enable Perfect Forward Secrecy
• IDS it?
– Do not rely on this
Cleanup
• Change certificates
– Revoke the old ones
• Reset sessions
– i.e. invalidate all cookies
• Change passwords
– Only affected user-stores
Defence in Depth
• One 0day shouldn’t ruin your day
– But this one was tricky
1. Early alerting
2. Response procedures (IR)
3. Ability to act quickly (devsecops)
4. Avoid heterogeneity/monocultures?
The State of OpenSSL’s Future
• Massive amount of legacy code
• Incredibly complex to maintain
– 2 people effectively doing most of it
• C considered harmful today
– Pointer arithmetic makes problems
• FIPS certification dangerous
– Certifies bad crypto & bad implementations
• OpenBSD’s OpenSSL rampage -> LibreSSL
• OpenSSL just got a ton of funding
Eye Openers
• We thought OpenSSL was okay
– Ok, lots didn’t, but nobody did anything about it
– We think lots of other things are ok
– ESR’s Linus’ Law: “Given enough eyeballs, all bugs are
shallow”
• But!
– We found the bug
– People actually patched it
• Others
– The rise of the branded bug
– The trail of fakes
• Media still drives reactions
Thanks & References
• Hackerfantastic
– Tool & Presentation
• Erratarob
– Tool/s & blogs
• XKCD
– Comics!
• Elpartydiablo & xnvx.com
– Background

Heartbleed Overview

  • 2.
    whoami Dominic White CTO @SensePost We Hack | Build | Train | Scan Stuff @singe / @sensepost [email protected] info/research/job @sensepost.com
  • 3.
    What Happened • 7April 2014 – Vulnerability announced to the world with a website, OpenSSL vulnerability announcement and new code release (1.0.1g) – Found by two groups; Google Security Team (Neel Mehta & Condenomicon) • Told that private keys to SSL certificates could be exposed – uh oh • Operating systems had not packaged the new release, so many were vulnerable • Many big name companies were vulnerable; Big Tech names, Banks, Law Enforcement, Intelligence Agencies • Online testers appeared, and were quickly swamped • But ….
  • 4.
    What is it? •Vulnerability in a widely used cryptographic library – i.e. lots of Unix things use this to do encryption • Vulnerability specific to SSL Heartbeats – RFC 6520 https://tools.ietf.org/html/rfc6520 • Introduced on Dec 31 2011 by Dr Stephen Henson • Allows you to read parts of a program memory – Buffer Over Read
  • 7.
    Demo • Extracting cookies& private SSL keys from a vulnerable server
  • 8.
    Why does itwork • OpenSSL is just the library, the actual process is something like Apache, Nginx, Dovecot, Exim etc. • These processes have a HEAP, in which data used by the process is stored. – If the process is active, it changes a lot • Certificate private keys are made up of two large prime numbers; we can find these if they were used recently
  • 9.
    The slow pathto enlightenment • Initial testers looked for vanilla SSL on port 443 using TLS v1.1 – Most famous and first PoC by Jared Stafford; ssltest.py • But: – SSL runs on non-standard ports – Some servers didn’t support TLS v1.1 – SSL can be invoked on clear-text ports with STARTLS • STARTTLS is different for different protocols – Clients are vulnerable too! – Lots of debate about whether keys could be grabbed • CloudFlare challenge cleared that up – IDS signatures were quickly defeated
  • 10.
    Meanwhile …. • #heartbleedvirus •Bruce Schneier – “On the scale of 1 to 10, this is an 11.” • I’m not Vulnerable, the scanner said so! • Claims of NSA backdoor bogey men • EVERYBODY CHANGE ALL YOUR PASSWORDS! – NO WAIT, CHANGE THEM AGAIN!
  • 11.
    How Bad WasIt? • Masscan (Robert Graham) – 615 268 / 28 581 134 – After one month 318 239 • Our clients – 1.8% when it broke – Offered free “complete” scan – 24 / 224 186
  • 12.
    Tactical Defence Fix theVuln • Patch it – OpenSSL >= 1.0.1g – Old versions < 1.0.1 unaffected • Disable it – Firewall, VPN? • Reconfigure it – Disable heartbeats – Enable Perfect Forward Secrecy • IDS it? – Do not rely on this Cleanup • Change certificates – Revoke the old ones • Reset sessions – i.e. invalidate all cookies • Change passwords – Only affected user-stores
  • 13.
    Defence in Depth •One 0day shouldn’t ruin your day – But this one was tricky 1. Early alerting 2. Response procedures (IR) 3. Ability to act quickly (devsecops) 4. Avoid heterogeneity/monocultures?
  • 14.
    The State ofOpenSSL’s Future • Massive amount of legacy code • Incredibly complex to maintain – 2 people effectively doing most of it • C considered harmful today – Pointer arithmetic makes problems • FIPS certification dangerous – Certifies bad crypto & bad implementations • OpenBSD’s OpenSSL rampage -> LibreSSL • OpenSSL just got a ton of funding
  • 15.
    Eye Openers • Wethought OpenSSL was okay – Ok, lots didn’t, but nobody did anything about it – We think lots of other things are ok – ESR’s Linus’ Law: “Given enough eyeballs, all bugs are shallow” • But! – We found the bug – People actually patched it • Others – The rise of the branded bug – The trail of fakes • Media still drives reactions
  • 16.
    Thanks & References •Hackerfantastic – Tool & Presentation • Erratarob – Tool/s & blogs • XKCD – Comics! • Elpartydiablo & xnvx.com – Background

Editor's Notes

  • #2 Picture from http://www.xnvx.com/data/media/87/Bleeding_Heart_By_Elpartydiablo.jpg
  • #6 http://xkcd.com/1354/