SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Hidden in Plain Sight
DUAL_EC_DRBG ‘n stuff
What’s this nerd doing
onstage?
● CS & Math BS
● Software Engineer
● Cryptoparty Ann Arbor
○ cryptoparty.in/ann_arbor - @CryptopartyAA
● Chiptunes are cool
● NOT a cryptographer
The Setup
History
tl;dr:
● ANSI, NIST, ISO standardized Deterministic
Random Bit Generator
● Designed/promoted/backdoored by NSA
● Secure crypto REQUIRES random numbers
● Cool story I won’t repeat
DUAL_EC_DRBG
NIST SP 800-90A:
● some elliptic curve over a finite field
● some points P, Q on the curve
● some process of getting output and
permuting secret state
MATH BASICS
Wait… what do those words in the standard
mean?
What the hell does this look like?
Elliptic Curves
Elliptic Curves Group
Groups
● set of elements G, with an operation +
● “order”: how many elements it has
Think Whole Numbers (Integers) with only +
Groups (Example)
Integers mod 12: a = b % 12
Scalar Multiplication on EC
n*P = P + P + … + P
● (n times)
● n is an integer, P is a point
● Important for the standard
Discrete Logarithm
● No efficient algorithm known
b^k = g
b*b*b* … *b = g (k times)
k = log_b (g)
( P = d*Q )
Math Concepts/Tools
Essential to understanding, won’t be covered in
more depth
● Subgroups, Cyclic groups
● Cauchy’s, Lagrange’s, Sylow’s theorems
● Finite Fields
Two Versions...
● Dual EC 2006
● Dual EC 2007
I’ll focus on Dual EC 2006
Getting Technical
DUAL_EC_DRBG
● Defined elliptic curve, points P, Q
○ COULD use your own, but MUST use NIST provided
constants for FIPS 140 certification
● P, Q are in the same group
DUAL_EC_DRBG
The order of the group P, Q are in is also
defined as n
● for curve P-256, n =
11579208921035624876269744694940757
35299969552241357603424222590610685
12044369
○ huh...
DUAL_EC_DRBG
Tools
● Lagrange’s Theorem: Order of a subgroup
divides the order its group
● Group generated by X:
<X> = {X, X+X, X+X+X, … }
So...
● Q is in a group of prime order
● Lagrange’s Theorem! Order of <Q> is either
1 or n (turns out it’s n).
● Q must generate that entire group!
● <Q> = {Q, Q+Q, Q+Q+Q, … }
DUAL_EC_DRBG
There exists some integer d such that:
P = d * Q
(P = Q + Q + … + Q)
Spoiler alert: that’s the backdoor
DUAL_EC_DRBG
Secret state s, points P, Q, functions f, g:
● f(s) = x(s*P)
○ updates secret state: s1 := f(s0)
● g(s) = x(s*Q)
○ gives you random bits: r1 := g(s1)
DUAL_EC_DRBG
ϕ: “put this into bits”, like an integer
extract_bits: remove 16 most significant bits
DUAL_EC_DRBG
Simplified algorithm (no additional input)
(courtesy: Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen)
DUAL_EC_DRBG
(Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen)
DUAL_EC_DRBG
Shumow-Ferguson attack:
● observe random output r
● 2^16 ACTUAL r1 candidates. brute-force.
● curve equation to recover R=(r1, y)
○ use tonelli-shanks to get y, easy!
● x-coord of d*R gets us secret state s2 :)
○ backdoor!
2006 & simple
Observe a full round’s-worth of output
2006 & simple
brute-force to compensate for 16 truncated bits
2006 & simple
scalar multiply with backdoor. ONE of these will
give secret state s2! we win!
2006 + additional input!
2006 + additional input!
2006 + additional input!
(Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen)
DUAL_EC_DRBG
(These are all group operations)
● R = s1*Q = g(s1)
● d*R = d*(s1*Q) = s1*(d*Q) = s1*P
● d*R = s1*P = f(s1)
● x(d*R) = x(s1*P) = s2
● internal state s2 isn’t secret anymore
DUAL_EC_DRBG
So, if you know d, you can backtrack and
recover state!
P = d*Q
Demo…?
DUAL_EC_DRBG Demo?
OK, so that’s cool, but can we demo this?
Actually cracking it is difficult, since we don’t
know d and can’t easily find it...
Two things you can do
Be Awesome
Be Awesome
● BSAFE - :,(
○ Java - Includes fingerprints in connections
○ C - gives longer string of random bits. Faster attack!
● SChannel - :/
○ Bug that made it slightly faster to attack.
● OpenSSL - :|
○ Only FIPS version
○ Easily fixed but totally breaking bug
○ Uses additional input :)
Be Awesome
Each TLS library needs a tailored attack
1. Recover state from session ID/server
random fields in handshake
2. Compute DHE/ECDHE shared secret => get
“master secret”
3. (optionally) recover long-lived DSA/ECDSA
signing key
Be Awesome
Exploiting a real-world instance is certainly
tricky, but possible!
Weak DUAL_EC_DRBG
Or… re-make everything, but smaller.
More contrived, but hopefully a bit easier to
grasp.
Requires algebra know-how
Weak DUAL_EC_DRBG
● Get some large-ish finite field (integers mod
some prime)
○ 331337 is prime. cool!
● Find a curve (I have no idea what I’m doing
here)
● Find some point Q on the curve that
generates a large-ish subgroup of prime
order
Weak DUAL_EC_DRBG
● Need a point Q in a subgroup of prime order.
But, a large enough prime that cracking isn’t
too easy (not 2, 5, 7, …)
○ Choice of finite field should put an upper bound on
subgroup’s size: Don’t worry about making it too
hard.
Weak DUAL_EC_DRBG
If Q itself doesn’t generate a prime-order
subgroup, some scalar multiple of Q will.
● If order of <Q> is not prime, factor it
○ hope it has a large prime factor
■ if not… try another Q! ¯_(ツ)_/¯
○ If it does: Cauchy’s theorem => subgroup of that
order exists! Generate with scalar multiple of Q
■ ‘intuition’ from quotient groups
Weak DUAL_EC_DRBG
● Once we’ve chosen Q, finding P is easy
○ pick your backdoor integer d
○ P = d*Q
○ publish P, Q. keep d secret.
● But, our subgroup is small enough we can
use brute-force to find d
Weak DUAL_EC_DRBG
https://github.com/zandi/dual_ec_demo
● Working weak DUAL_EC_DRBG code!
○ jeopardy ctf-style, server challenges client
○ 3 lead-in levels building up to Dual EC wannabe
level
○ test attack code for each level.
○ scary but harmless cruft
Go learn!
Practical Takeaway
What did we learn from this whole ordeal? Is
there anything we need to do *right now* to
secure ourselves? What can we do going
forward to prevent this from happening again?
Practical Takeaway
● NSA, NIST, ANSI, etc.?
○ MAYBE trust, DEFINITELY verify, peer-review.
● Using same PRNG instance for secret &
non-secret random numbers. Bad idea?
○ Shouldn’t HAVE to program defensively against your
crypto library/rng, but is it a good idea? ehhh…
maybe not.
● NIST SP 800-90A
● “The NSA Back Door to NIST” - Thomas C. Hales,
Notices of the AMS Vol. 61 No. 2
● http://projectbullrun.org/dual-ec/index.html
● “Dual EC: A Standardized Back Door” - Daniel J.
Bernstein, Tanja Lange, and Ruben Niederhagen
● “Practical Kleptography” - Matthew Green, Woot ‘14
● https://www.usenix.
org/conference/usenixsecurity14/technical-
sessions/presentation/checkoway
● Jeremy Kun - elliptic curves over finite fields library -
https://github.com/j2kun/elliptic-curves-finite-fields
Keep in touch!
@the_zandi
the.zandi@gmail.com
Thanks
David Adrian, “his excellency”
dafluck, jimtern, Misec, Arbsec,
A2Y.asm, Obama, and Satan

Contenu connexe

Tendances

20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting StartedTeerawat Issariyakul
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesTeerawat Issariyakul
 
EdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for JavaEdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for JavaLisa Hua
 
Concurrency in Programming Languages
Concurrency in Programming LanguagesConcurrency in Programming Languages
Concurrency in Programming LanguagesYudong Li
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysDharmalingam Ganesan
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015NAVER / MusicPlatform
 
Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >Sergey Platonov
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstractionSergey Platonov
 
Kirk Shoop, Reactive programming in C++
Kirk Shoop, Reactive programming in C++Kirk Shoop, Reactive programming in C++
Kirk Shoop, Reactive programming in C++Sergey Platonov
 
How do computers exchange secrets using Math?
How do computers exchange secrets using Math?How do computers exchange secrets using Math?
How do computers exchange secrets using Math?Dharmalingam Ganesan
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesAndrey Karpov
 

Tendances (20)

Clang tidy
Clang tidyClang tidy
Clang tidy
 
NS2 Classifiers
NS2 ClassifiersNS2 Classifiers
NS2 Classifiers
 
20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started20100712-OTcl Command -- Getting Started
20100712-OTcl Command -- Getting Started
 
NS2 Object Construction
NS2 Object ConstructionNS2 Object Construction
NS2 Object Construction
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
 
EdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for JavaEdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for Java
 
Concurrency in Programming Languages
Concurrency in Programming LanguagesConcurrency in Programming Languages
Concurrency in Programming Languages
 
Basic Packet Forwarding in NS2
Basic Packet Forwarding in NS2Basic Packet Forwarding in NS2
Basic Packet Forwarding in NS2
 
Java Basics - Part2
Java Basics - Part2Java Basics - Part2
Java Basics - Part2
 
On the Secrecy of RSA Private Keys
On the Secrecy of RSA Private KeysOn the Secrecy of RSA Private Keys
On the Secrecy of RSA Private Keys
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
 
Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >Антон Бикинеев, Writing good std::future&lt; C++ >
Антон Бикинеев, Writing good std::future&lt; C++ >
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
 
Kirk Shoop, Reactive programming in C++
Kirk Shoop, Reactive programming in C++Kirk Shoop, Reactive programming in C++
Kirk Shoop, Reactive programming in C++
 
How do computers exchange secrets using Math?
How do computers exchange secrets using Math?How do computers exchange secrets using Math?
How do computers exchange secrets using Math?
 
Ns tutorial
Ns tutorialNs tutorial
Ns tutorial
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
PVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error ExamplesPVS-Studio in 2021 - Error Examples
PVS-Studio in 2021 - Error Examples
 
Active Attacks on DH Key Exchange
Active Attacks on DH Key ExchangeActive Attacks on DH Key Exchange
Active Attacks on DH Key Exchange
 
JavaFX
JavaFXJavaFX
JavaFX
 

En vedette

Daftar harga tas maika etnik terbaru
Daftar harga tas maika etnik terbaruDaftar harga tas maika etnik terbaru
Daftar harga tas maika etnik terbaruDawang Sirita
 
Harga maika travel bag
Harga maika travel bagHarga maika travel bag
Harga maika travel bagDawang Sirita
 
Tackle earthquake in engineering buildings
Tackle earthquake in engineering buildingsTackle earthquake in engineering buildings
Tackle earthquake in engineering buildingsAditya Raj Pradhan
 
Harga small case maika etnik
Harga small case maika etnikHarga small case maika etnik
Harga small case maika etnikDawang Sirita
 
Harga tas maika etnik 2016
Harga tas maika etnik 2016Harga tas maika etnik 2016
Harga tas maika etnik 2016Dawang Sirita
 
Optimizing-Your-Digital-Strategy
Optimizing-Your-Digital-StrategyOptimizing-Your-Digital-Strategy
Optimizing-Your-Digital-StrategyCliff Corr
 
404warehouse와 메이커운동
404warehouse와 메이커운동404warehouse와 메이커운동
404warehouse와 메이커운동gokoreas
 
Harga tas dan dompet maika
Harga tas dan dompet maikaHarga tas dan dompet maika
Harga tas dan dompet maikaDawang Sirita
 
Harga hpo maika etnik 2016
Harga hpo maika etnik 2016Harga hpo maika etnik 2016
Harga hpo maika etnik 2016Dawang Sirita
 
Daftar harga maika etnik 2016
Daftar harga maika etnik 2016Daftar harga maika etnik 2016
Daftar harga maika etnik 2016Dawang Sirita
 
Daftar harga tas maika etnik 2016
Daftar harga tas maika etnik 2016Daftar harga tas maika etnik 2016
Daftar harga tas maika etnik 2016Dawang Sirita
 
Harga maika small case
Harga maika small caseHarga maika small case
Harga maika small caseDawang Sirita
 
Harga tas maika etnik bandung
Harga tas maika etnik bandungHarga tas maika etnik bandung
Harga tas maika etnik bandungDawang Sirita
 
Harga grosir maika etnik
Harga grosir maika etnikHarga grosir maika etnik
Harga grosir maika etnikDawang Sirita
 
Daftar harga dompet maika etnik
Daftar harga dompet maika etnikDaftar harga dompet maika etnik
Daftar harga dompet maika etnikDawang Sirita
 

En vedette (19)

Daftar harga tas maika etnik terbaru
Daftar harga tas maika etnik terbaruDaftar harga tas maika etnik terbaru
Daftar harga tas maika etnik terbaru
 
Harga maika 2016
Harga maika 2016Harga maika 2016
Harga maika 2016
 
Harga maika travel bag
Harga maika travel bagHarga maika travel bag
Harga maika travel bag
 
Tackle earthquake in engineering buildings
Tackle earthquake in engineering buildingsTackle earthquake in engineering buildings
Tackle earthquake in engineering buildings
 
Harga small case maika etnik
Harga small case maika etnikHarga small case maika etnik
Harga small case maika etnik
 
Harga tas maika etnik 2016
Harga tas maika etnik 2016Harga tas maika etnik 2016
Harga tas maika etnik 2016
 
Optimizing-Your-Digital-Strategy
Optimizing-Your-Digital-StrategyOptimizing-Your-Digital-Strategy
Optimizing-Your-Digital-Strategy
 
Harga maika bag
Harga maika bagHarga maika bag
Harga maika bag
 
404warehouse와 메이커운동
404warehouse와 메이커운동404warehouse와 메이커운동
404warehouse와 메이커운동
 
History of horror
History of horrorHistory of horror
History of horror
 
jahangir
jahangirjahangir
jahangir
 
Harga tas dan dompet maika
Harga tas dan dompet maikaHarga tas dan dompet maika
Harga tas dan dompet maika
 
Harga hpo maika etnik 2016
Harga hpo maika etnik 2016Harga hpo maika etnik 2016
Harga hpo maika etnik 2016
 
Daftar harga maika etnik 2016
Daftar harga maika etnik 2016Daftar harga maika etnik 2016
Daftar harga maika etnik 2016
 
Daftar harga tas maika etnik 2016
Daftar harga tas maika etnik 2016Daftar harga tas maika etnik 2016
Daftar harga tas maika etnik 2016
 
Harga maika small case
Harga maika small caseHarga maika small case
Harga maika small case
 
Harga tas maika etnik bandung
Harga tas maika etnik bandungHarga tas maika etnik bandung
Harga tas maika etnik bandung
 
Harga grosir maika etnik
Harga grosir maika etnikHarga grosir maika etnik
Harga grosir maika etnik
 
Daftar harga dompet maika etnik
Daftar harga dompet maika etnikDaftar harga dompet maika etnik
Daftar harga dompet maika etnik
 

Similaire à Hidden in Plain Sight: DUAL_EC_DRBG 'n stuff

Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetrisYodalee
 
TC39: How we work, what we are working on, and how you can get involved (dotJ...
TC39: How we work, what we are working on, and how you can get involved (dotJ...TC39: How we work, what we are working on, and how you can get involved (dotJ...
TC39: How we work, what we are working on, and how you can get involved (dotJ...Igalia
 
On deriving the private key from a public key
On deriving the private key from a public keyOn deriving the private key from a public key
On deriving the private key from a public keyDharmalingam Ganesan
 
Gpu workshop cluster universe: scripting cuda
Gpu workshop cluster universe: scripting cudaGpu workshop cluster universe: scripting cuda
Gpu workshop cluster universe: scripting cudaFerdinand Jamitzky
 
The magic of (data parallel) distributed systems and where it all breaks - Re...
The magic of (data parallel) distributed systems and where it all breaks - Re...The magic of (data parallel) distributed systems and where it all breaks - Re...
The magic of (data parallel) distributed systems and where it all breaks - Re...Holden Karau
 
Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...Holden Karau
 
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event SlidesMelbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event SlidesVictoria Schiffer
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU
 
Jvm profiling under the hood
Jvm profiling under the hoodJvm profiling under the hood
Jvm profiling under the hoodRichardWarburton
 
Stripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018artgillespie
 
Testing and validating spark programs - Strata SJ 2016
Testing and validating spark programs - Strata SJ 2016Testing and validating spark programs - Strata SJ 2016
Testing and validating spark programs - Strata SJ 2016Holden Karau
 
Cracking Pseudorandom Sequences Generators in Java Applications
Cracking Pseudorandom Sequences Generators in Java ApplicationsCracking Pseudorandom Sequences Generators in Java Applications
Cracking Pseudorandom Sequences Generators in Java ApplicationsPositive Hack Days
 
Using R in remote computer clusters
Using R in remote computer clustersUsing R in remote computer clusters
Using R in remote computer clustersBurak Himmetoglu
 
JVM Performance Magic Tricks
JVM Performance Magic TricksJVM Performance Magic Tricks
JVM Performance Magic TricksTakipi
 
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etcComparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etcYukio Okuda
 

Similaire à Hidden in Plain Sight: DUAL_EC_DRBG 'n stuff (20)

Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetris
 
TC39: How we work, what we are working on, and how you can get involved (dotJ...
TC39: How we work, what we are working on, and how you can get involved (dotJ...TC39: How we work, what we are working on, and how you can get involved (dotJ...
TC39: How we work, what we are working on, and how you can get involved (dotJ...
 
On deriving the private key from a public key
On deriving the private key from a public keyOn deriving the private key from a public key
On deriving the private key from a public key
 
Gpu workshop cluster universe: scripting cuda
Gpu workshop cluster universe: scripting cudaGpu workshop cluster universe: scripting cuda
Gpu workshop cluster universe: scripting cuda
 
The magic of (data parallel) distributed systems and where it all breaks - Re...
The magic of (data parallel) distributed systems and where it all breaks - Re...The magic of (data parallel) distributed systems and where it all breaks - Re...
The magic of (data parallel) distributed systems and where it all breaks - Re...
 
Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...Testing and validating distributed systems with Apache Spark and Apache Beam ...
Testing and validating distributed systems with Apache Spark and Apache Beam ...
 
Eye deep
Eye deepEye deep
Eye deep
 
Killer Bugs From Outer Space
Killer Bugs From Outer SpaceKiller Bugs From Outer Space
Killer Bugs From Outer Space
 
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event SlidesMelbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
Melbourne, Australia Global Day of Code Retreat 2018 gdcr18 - Event Slides
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применение
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
 
Jvm profiling under the hood
Jvm profiling under the hoodJvm profiling under the hood
Jvm profiling under the hood
 
Stripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe CTF3 wrap-up
Stripe CTF3 wrap-up
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
 
Testing and validating spark programs - Strata SJ 2016
Testing and validating spark programs - Strata SJ 2016Testing and validating spark programs - Strata SJ 2016
Testing and validating spark programs - Strata SJ 2016
 
RSA cracking puzzle
RSA cracking puzzleRSA cracking puzzle
RSA cracking puzzle
 
Cracking Pseudorandom Sequences Generators in Java Applications
Cracking Pseudorandom Sequences Generators in Java ApplicationsCracking Pseudorandom Sequences Generators in Java Applications
Cracking Pseudorandom Sequences Generators in Java Applications
 
Using R in remote computer clusters
Using R in remote computer clustersUsing R in remote computer clusters
Using R in remote computer clusters
 
JVM Performance Magic Tricks
JVM Performance Magic TricksJVM Performance Magic Tricks
JVM Performance Magic Tricks
 
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etcComparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
Comparing On-The-Fly Accelerating Packages: Numba, TensorFlow, Dask, etc
 

Dernier

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Hidden in Plain Sight: DUAL_EC_DRBG 'n stuff

  • 1. Hidden in Plain Sight DUAL_EC_DRBG ‘n stuff
  • 2. What’s this nerd doing onstage? ● CS & Math BS ● Software Engineer ● Cryptoparty Ann Arbor ○ cryptoparty.in/ann_arbor - @CryptopartyAA ● Chiptunes are cool ● NOT a cryptographer
  • 3.
  • 5. History tl;dr: ● ANSI, NIST, ISO standardized Deterministic Random Bit Generator ● Designed/promoted/backdoored by NSA ● Secure crypto REQUIRES random numbers ● Cool story I won’t repeat
  • 6. DUAL_EC_DRBG NIST SP 800-90A: ● some elliptic curve over a finite field ● some points P, Q on the curve ● some process of getting output and permuting secret state
  • 7. MATH BASICS Wait… what do those words in the standard mean? What the hell does this look like?
  • 10. Groups ● set of elements G, with an operation + ● “order”: how many elements it has Think Whole Numbers (Integers) with only +
  • 12. Scalar Multiplication on EC n*P = P + P + … + P ● (n times) ● n is an integer, P is a point ● Important for the standard
  • 13. Discrete Logarithm ● No efficient algorithm known b^k = g b*b*b* … *b = g (k times) k = log_b (g) ( P = d*Q )
  • 14. Math Concepts/Tools Essential to understanding, won’t be covered in more depth ● Subgroups, Cyclic groups ● Cauchy’s, Lagrange’s, Sylow’s theorems ● Finite Fields
  • 15. Two Versions... ● Dual EC 2006 ● Dual EC 2007 I’ll focus on Dual EC 2006
  • 17. DUAL_EC_DRBG ● Defined elliptic curve, points P, Q ○ COULD use your own, but MUST use NIST provided constants for FIPS 140 certification ● P, Q are in the same group
  • 18. DUAL_EC_DRBG The order of the group P, Q are in is also defined as n ● for curve P-256, n = 11579208921035624876269744694940757 35299969552241357603424222590610685 12044369 ○ huh...
  • 20. Tools ● Lagrange’s Theorem: Order of a subgroup divides the order its group ● Group generated by X: <X> = {X, X+X, X+X+X, … }
  • 21. So... ● Q is in a group of prime order ● Lagrange’s Theorem! Order of <Q> is either 1 or n (turns out it’s n). ● Q must generate that entire group! ● <Q> = {Q, Q+Q, Q+Q+Q, … }
  • 22. DUAL_EC_DRBG There exists some integer d such that: P = d * Q (P = Q + Q + … + Q) Spoiler alert: that’s the backdoor
  • 23. DUAL_EC_DRBG Secret state s, points P, Q, functions f, g: ● f(s) = x(s*P) ○ updates secret state: s1 := f(s0) ● g(s) = x(s*Q) ○ gives you random bits: r1 := g(s1)
  • 24. DUAL_EC_DRBG ϕ: “put this into bits”, like an integer extract_bits: remove 16 most significant bits
  • 25. DUAL_EC_DRBG Simplified algorithm (no additional input) (courtesy: Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen)
  • 26. DUAL_EC_DRBG (Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen)
  • 27. DUAL_EC_DRBG Shumow-Ferguson attack: ● observe random output r ● 2^16 ACTUAL r1 candidates. brute-force. ● curve equation to recover R=(r1, y) ○ use tonelli-shanks to get y, easy! ● x-coord of d*R gets us secret state s2 :) ○ backdoor!
  • 28. 2006 & simple Observe a full round’s-worth of output
  • 29. 2006 & simple brute-force to compensate for 16 truncated bits
  • 30. 2006 & simple scalar multiply with backdoor. ONE of these will give secret state s2! we win!
  • 34. (Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen)
  • 35. DUAL_EC_DRBG (These are all group operations) ● R = s1*Q = g(s1) ● d*R = d*(s1*Q) = s1*(d*Q) = s1*P ● d*R = s1*P = f(s1) ● x(d*R) = x(s1*P) = s2 ● internal state s2 isn’t secret anymore
  • 36. DUAL_EC_DRBG So, if you know d, you can backtrack and recover state! P = d*Q
  • 38. DUAL_EC_DRBG Demo? OK, so that’s cool, but can we demo this? Actually cracking it is difficult, since we don’t know d and can’t easily find it... Two things you can do
  • 40. Be Awesome ● BSAFE - :,( ○ Java - Includes fingerprints in connections ○ C - gives longer string of random bits. Faster attack! ● SChannel - :/ ○ Bug that made it slightly faster to attack. ● OpenSSL - :| ○ Only FIPS version ○ Easily fixed but totally breaking bug ○ Uses additional input :)
  • 41. Be Awesome Each TLS library needs a tailored attack 1. Recover state from session ID/server random fields in handshake 2. Compute DHE/ECDHE shared secret => get “master secret” 3. (optionally) recover long-lived DSA/ECDSA signing key
  • 42. Be Awesome Exploiting a real-world instance is certainly tricky, but possible!
  • 43. Weak DUAL_EC_DRBG Or… re-make everything, but smaller. More contrived, but hopefully a bit easier to grasp. Requires algebra know-how
  • 44.
  • 45. Weak DUAL_EC_DRBG ● Get some large-ish finite field (integers mod some prime) ○ 331337 is prime. cool! ● Find a curve (I have no idea what I’m doing here) ● Find some point Q on the curve that generates a large-ish subgroup of prime order
  • 46. Weak DUAL_EC_DRBG ● Need a point Q in a subgroup of prime order. But, a large enough prime that cracking isn’t too easy (not 2, 5, 7, …) ○ Choice of finite field should put an upper bound on subgroup’s size: Don’t worry about making it too hard.
  • 47. Weak DUAL_EC_DRBG If Q itself doesn’t generate a prime-order subgroup, some scalar multiple of Q will. ● If order of <Q> is not prime, factor it ○ hope it has a large prime factor ■ if not… try another Q! ¯_(ツ)_/¯ ○ If it does: Cauchy’s theorem => subgroup of that order exists! Generate with scalar multiple of Q ■ ‘intuition’ from quotient groups
  • 48. Weak DUAL_EC_DRBG ● Once we’ve chosen Q, finding P is easy ○ pick your backdoor integer d ○ P = d*Q ○ publish P, Q. keep d secret. ● But, our subgroup is small enough we can use brute-force to find d
  • 49. Weak DUAL_EC_DRBG https://github.com/zandi/dual_ec_demo ● Working weak DUAL_EC_DRBG code! ○ jeopardy ctf-style, server challenges client ○ 3 lead-in levels building up to Dual EC wannabe level ○ test attack code for each level. ○ scary but harmless cruft Go learn!
  • 50. Practical Takeaway What did we learn from this whole ordeal? Is there anything we need to do *right now* to secure ourselves? What can we do going forward to prevent this from happening again?
  • 51. Practical Takeaway ● NSA, NIST, ANSI, etc.? ○ MAYBE trust, DEFINITELY verify, peer-review. ● Using same PRNG instance for secret & non-secret random numbers. Bad idea? ○ Shouldn’t HAVE to program defensively against your crypto library/rng, but is it a good idea? ehhh… maybe not.
  • 52. ● NIST SP 800-90A ● “The NSA Back Door to NIST” - Thomas C. Hales, Notices of the AMS Vol. 61 No. 2 ● http://projectbullrun.org/dual-ec/index.html ● “Dual EC: A Standardized Back Door” - Daniel J. Bernstein, Tanja Lange, and Ruben Niederhagen ● “Practical Kleptography” - Matthew Green, Woot ‘14 ● https://www.usenix. org/conference/usenixsecurity14/technical- sessions/presentation/checkoway ● Jeremy Kun - elliptic curves over finite fields library - https://github.com/j2kun/elliptic-curves-finite-fields
  • 53. Keep in touch! @the_zandi the.zandi@gmail.com Thanks David Adrian, “his excellency” dafluck, jimtern, Misec, Arbsec, A2Y.asm, Obama, and Satan