Share
Embed
The Origins of Insecurity, LASCON 2013
"The Origins of Insecurity" -- presented at LASCON, Austin, Texas on 2013-10-24
Nick Galbreath
October 24, 2013
Transcript
117 slides
-
@ngalbreath #lascon2013 The Origins of Insecurity Nick Galbreath LASCON 2013
Austin, Texas, USA 2013-10-24 -
@ngalbreath #lascon2013 • Online advertising infrastructure • Because waiting for
Google et al to cut you a check isn't a business model. -
@ngalbreath #lascon2013 Next year bring someone from operations or development
(Or even from business and product) -
@ngalbreath #lascon2013 Cryptography • A lot of noise going on
without context that may or may not match your needs or requirements. (there is also good healthy debate on fixing problems) • Think of your threat model to your company (or you). -
@ngalbreath #lascon2013 TLDR; math's hard; let's go shopping (for access)
http://www.foreignpolicy.com/articles/ 2013/10/15/the_nsa_s_new_codebreakers -
@ngalbreath #lascon2013 So Successful • I don't know of any
monetary theft that involved breaking SSL/TLS or the math behind modern cryptography. • It's been so successful everything I know has been attacking data at rest. -
@ngalbreath #lascon2013 Yeah, but what about that Android problem? And
NIST PRNG? And all those CA Cert problems? -
@ngalbreath #lascon2013 Can't Find the Fix • Source is here:
http://bit.ly/1c3iZCC • Can't find the change • Can't find the bug report • Appears no empirical testing added to source tree. I'm not an Android expert and the source tree is very large. If you know the answers, please let me know! -
@ngalbreath #lascon2013 But How Did this Happen? "Contrary to many
earlier reports, the flaw affects all versions of Android, not just 4.2 and earlier, Android Security Engineer Adrian Ludwig told Ars." http://arstechnica.com/security/2013/08/google-confirms- critical-android-crypto-flaw-used-in-5700-bitcoin-heist/ -
@ngalbreath #lascon2013 Let's Take a Look • July 2006 code
goes in tree: https://issues.apache.org/jira/browse/HARMONY-872 • October 2006 tests added https://issues.apache.org/jira/browse/HARMONY-1924 hmmmm.... so before we blame yuri... -
@ngalbreath #lascon2013 SHA1PRNG • Based on known cryptographic primitives: Yes
• Open specification: ? • Open source reference implementation: ? • Test vectors: ? • Forced to use it: kinda, otherwise you need to find a signed provider. • Code approved in Harmony without tests: yes • Any empirical tests? No. • Any security review in 5+ years: ?? -
@ngalbreath #lascon2013 #VUXBJU UIFSFTNPSF • "In addition to this developer
recommendation, Android has developed patches that ensure that Android’s OpenSSL PRNG is initialized correctly. Those patches have been provided to OHA partners.We would like to thank Soo Hyeon Kim, Daewan Han of ETRI and Dong Hoon Lee of Korea University who notified Google about the improper initialization of OpenSSL PRNG." • More details here: http://emboss.github.io/blog/ 2013/08/21/openssl-prng-is-not- really-fork-safe/ -
@ngalbreath #lascon2013 More Details • http://armoredbarista.blogspot.ie/ 2013/03/randomly-failed- weaknesses-in-java.html (although their
paper is published and costs money) • Keith (k3170) Makan http://blog.k3170makan.com/ 2013/08/more-details-on-android- jca-prng-flaw.html#more -
@ngalbreath #lascon2013 An Interesting Study in Failure. • Specification •
Implementation • QA • Review • Postmortem -
@ngalbreath #lascon2013 NIST • NIST has a lot of great
people, working very hard, • Probably has to deal with more conflicts of interest, stress, demands, and bullshit than you can imagine • but as human organization • ... it also has human failings too -
@ngalbreath #lascon2013 NIST Dual-EC-DRBG • SP 800-90 • 1 of
3 PRNG algorithms specified • within 6 months of publication, research showed it was unusual • 3x slower, possible backdoor. • Standards process clearly got corrupted -
@ngalbreath #lascon2013 DUAL-EC-DRBG • Based on known cryptographic primitives: yes
• Open and Fully specified: yes • Test vectors: yes • As a standard are you forced into using it? No! It's only one of three options. -
@ngalbreath #lascon2013 It's a Turd But we know exactly it's
a turd! It's standard turd! That also got approved by ISO and others. It's not the first (WEP), and not the last -
@ngalbreath #lascon2013 But we knew in 2007 is was broken,
and it's also very slow, and there 2 other choices in the standard! -
@ngalbreath #lascon2013 And good standards don't do any good if
they aren't implemented -
@ngalbreath #lascon2013 TLS 1.2 Still not all current browsers support
it No browser supports GCM mode -
@ngalbreath #lascon2013 And this has never been done before. Old
standards will need augmentation. -
@ngalbreath #lascon2013 Fixing the CA System • Certificate Pinning •
Certificate Pruning (ala Etsy/Zane Lackey) • HTTPS Strict-Transport-Security • http://certificate-transparency.org/ -
@ngalbreath #lascon2013 App Security Network Security EndPoint Security IT/Internal Development
Operations stuff you didn't write stuff you did write stuff people use Everything Else -
@ngalbreath #lascon2013 Proactive Tasks • Detection • Monitoring • Identity
Management • Design and Architecture • maybe even Development but for reactive tasks... -
@ngalbreath #lascon2013 IT Internal Tech • Windows / Mac Operating
Systems • Commercial Applications that run on employee laptops 99% C-based patches or Configuration Mgmt -
@ngalbreath #lascon2013 Tech Ops • Routers - C • Windows
/ Linux OS updates - C • Core server (application) updates - C • And configuration management -
@ngalbreath #lascon2013 Development • Input Validation problems • Configuration problems
• Logical Problems - more interesting • cryptographic • Language platform problems (PHP, Java, et al) -
@ngalbreath #lascon2013 Language • 99% of patches to language are
in.. C. • You don't see core libraries for languages (in the end language) patched that often in CVE -
@ngalbreath #lascon2013 Reactive Summary • Patching and Deploying • Configuration
Management • Broken applications • Dealing with C based infrastructure -
@ngalbreath #lascon2013 The Theory • Use windows 7+, • Keep
at patch level • Patch Flash • Patch Reader • Patch Java (or remove) • == 99% of vulnerabilities stopped Trail of Bits - Exploit Intelligence Project http://www.trailofbits.com/research/ -
@ngalbreath #lascon2013 Updating four systems is challenging for many /
most organizations! -
@ngalbreath #lascon2013 What can we learn from the hardest apps
to deploy? Mobile and Desktop Apps and OS -
@ngalbreath #lascon2013 Key Points • Note it's not 100% instantly..
there is time to correct for bad releases. • Releases every 4-6 weeks. • Only two version "live" at anytime • Old versions rapidly drop to under 3% of total. • What's going with that 3%? -
@ngalbreath #lascon2013 Android Key Points • Releases every 6+ months
• At least 3 major versions active at any point in time. • Not in control of release process • Slow adoption • It's only this good since people buy new phones. -
@ngalbreath #lascon2013 Android Solution? • Remove everything from the OS,
and make applications independent, that also self-update automatically. -
@ngalbreath #lascon2013 Apple and IOS • Just moved to having
applications auto- update themselves. • Desktop is lagging behind although you can see the start of an "app store" model there. -
@ngalbreath #lascon2013 Wordpress • WordPress 3.7 introduces automatic background updates
for security and minor releases (like updating from 3.7 to 3.7.1). http://wordpress.org/news/2013/10/ wordpress-3-7-release-candidate/ -
@ngalbreath #lascon2013 Conclusion? • You can release faster • You
can release safely • It's a competitive advantage • It makes things more secure -
@ngalbreath #lascon2013 Desktop Deployment • With all the containerization /
VM technology, surely we can do something to speed patching and deployment. • Why does only one version need to be installed? • Can we make it so it's easier to roll back or undo? • Can we get feedback faster from our users if something isn't working? -
@ngalbreath #lascon2013 How can we make patching and deployment easy
for the dumbest users? -
@ngalbreath #lascon2013 SSL/TLS OMG • Somehow it's turned into a
science project. • Lots of bad information on the web. • security • performance • compatibility -
@ngalbreath #lascon2013 5IF-JUUMFTU$POpH ssl_protocols SSLv3 \ TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers
AES128-SHA; Better than most Could it be better: yes. -
@ngalbreath #lascon2013 But Being Smart Won't Save You • True
story • I had custom version of nginx+openssl running • I updated the os ('apt-get' or yum) • over-wrote custom version • My cipher suite changed.. silently. -
@ngalbreath #lascon2013 And SSL is easy compared to • Firewalls
• SSH • Any VPN • DNS -
@ngalbreath #lascon2013 And barriers to entry in putting a server
"on the internet" keeps getting lower -
@ngalbreath #lascon2013 How can we make it safe to configure
a server and keep it secure? ex: no warning when SSLv2 is enabled -
@ngalbreath #lascon2013 Ruby BrakeMan • Static analysis on commit or
in real- time. • Sends email when it finds problems, and explains the fix • And sends positive mail when you fix it • I don't know anything about Ruby or RoR (I'm the dumbest guy), but with BrakeMan I'm not going to make rookie mistakes. -
@ngalbreath #lascon2013 If we can do it for Ruby, I'm
pretty sure we can do it for apache.conf -
@ngalbreath #lascon2013 What happened when Google visited this site? Of
the 1513 pages we tested on the site over the past 90 days, 4 page(s) resulted in malicious software being downloaded and installed without user consent. The last time Google visited this site was on 2013-10-23, and the last time suspicious content was found on this site was on 2013-10-23. Malicious software includes 4 trojan(s). "1*GPS 3FTFBSDI -
@ngalbreath #lascon2013 PHP 5.5 Password Hashing Password Hashing Functions Table
of Contents • password_get_info — Returns information about the given hash • password_hash — Creates a password hash • password_needs_rehash — Checks if the given hash matches the given options • password_verify — Verifies that a password matches a hash (SFBU "1*GPS FWFSZPOF -
@ngalbreath #lascon2013 How does this PHP API compare to @manicode's
best practices? Do Business Level APIs exist for your platform? -
@ngalbreath #lascon2013 PRNG • By default, every language provides a
non- cryptographic, insecure PRNG • Leftover from the 1980s and physics simulations and old computer science problems. • Scripting languages unfortunately copied this model. • And so, we get numerous applications using an insecure system for passwords, reset codes, and worse. -
@ngalbreath #lascon2013 Meanwhile a Secure Random is hidden • Every
OS provides an API for this. • PHP even provides 2 or 3 different ways of doing this making it more confusing. • Since the Toy Randoms aren't random enough, people set seeds. random_set_seed(1); include "poisonedfile.php" -
@ngalbreath #lascon2013 If you need to do physics... • You'll
likely link in another library anyways. • You are probably linking in a million other libraries anyways. • You have requirements that probably aren't going to be met by the default PRNG anyways. -
@ngalbreath #lascon2013 For toy applications • You demands aren't very
high • Perfectly ok to use a secure random • For webapps, if they use a PRNG at all, most will use it only for a few numbers. • Not a performance problem -
@ngalbreath #lascon2013 And if it's too slow • A Secure
PRNG will be "slower" • So write your own if it's a problem. • A decent high speed PRNG can be written in a few lines of code if need be. • Every language makes data structure tradeoffs • Why should PRNG be different? -
@ngalbreath #lascon2013 Can We Change PRNG from a Security Problem
to an Optimization Problem? -
@ngalbreath #lascon2013 Instead of making systems for the smartest guy,
we should be making APIs for dumbest. -
@ngalbreath #lascon2013 Hypothesis: CVE of high severity are overwhelmingly from
programs written in C. QSPWFNF XSPOH -
@ngalbreath #lascon2013 libinjection • Goal: to eliminate SQLi attacks everywhere.
• https://libinjection.client9.com/ -
@ngalbreath #lascon2013 What is it? • Small C library to
detect SQLi in user input. • Really fast • Low false positives • Testable • https://libinjection.client9.com/ But why I did write this in C? -
@ngalbreath #lascon2013 Why C? • Lowest Common Denominator • Be
able to quickly integrate into other C infrastructure, including hardware. • Eliminate any performance issue that might be an excuse for not using it. • SWIG-generating bindings exist for PHP, Python, Lua • Or use ctypes or libffi • Let's write one for Ruby at this con! -
@ngalbreath #lascon2013 Can We Change C Programming from a Security
Problem to an Optimization Problem? -
@ngalbreath #lascon2013 Hints of the Future • Javascript JITs /
node.js showing competitive performance • C to LLVM to javascript (??) • PyPy: write a language in RPython and it creates a JIT (whoa) • http://cython.org restricted subset of python that compiles directly to C -
@ngalbreath #lascon2013 And replacing C bindings for scripting languages •
lua CFFI - • Now in python lib.cffi • extra C code (either manually written or autogenerated) removed. • Allows for optimization for near native C performance -
@ngalbreath #lascon2013 It's us! • We know configuration management is
a problem • We know patching and deploying is a problem • We know developers aren't experts in security • We know developers make mistakes • We know C, while essential, is fragile -
@ngalbreath #lascon2013 But I don't see much work in these
areas. Offense and Blocking Technologies Dominate -
@ngalbreath #lascon2013 Open Source • Zillions of open source projects
• Most do not have any "dedicated" security ... uhh.. security anything. • Get in the process. -
@ngalbreath #lascon2013 Powerful • writing fuzzers • compiling with different
flags • finding test cases • writing test cases • in the development process -
@ngalbreath #lascon2013 libinjection • This summer, facilitated by the modsecurity
Team, I worked with • Roberto Salgado @LightOS of http://www.websec.ca • Custom analysis and fuzzing of libinjection • Embarrassing me daily with new exploits. • This provided rapid acceleration of the quality. • Also checkout his SQLi cheat sheet: websec.ca/kb/sql_injection -
@ngalbreath #lascon2013 Certificate Transparency • Finding certificates that explode the
parsing code. • Adding test cases • Decoding new exciting ISO time formats. -
@ngalbreath #lascon2013 •Think Big •Get Involved •Bring your Dev/Ops/Qa/Biz friends
next year. •Enjoy the Con