Quick access to articles on this page:
more on the next page...
You can read part 1 here.
Mike Wiener, an employee at Irdeto, the company who acquired Cloakware (the pioneering company of whitebox crypto), started this part.
The security of Whitebox comes from the fact that details are kept secret. Most implementations of working whiteboxes are proprietary.
Imagine that you want to obfuscate AES. The idea is that AES is essentialy a huge permutation. You could replace all the code with a huge look up table that would give you an output for some particular input. You could give that to someone and he would not be able to recover the key... BUT it's completely impractical.
Wiener sees whitebox crypto as not totally "crypto". More at the intersection of software security and cryptography.
Wiener said that Chow et al. brought us the 1st generation of WBC. Then Billet et al. found the first attack.
They then made a 2nd generation of whitebox crypto, but they can't talk about it.
Barak et al. proved that there exist programs that cannot be protected. Some people concluded that WBC can't work, which is not true: we don't need to protect ALL programs!
Their 2nd generation of WBC resisted to attacks from Billet et al. but were still vulnerable to DFA and DCA (Differential Computation Analysis). So they made a 3rd generation of WBC! Resistant to DFA and DCA.
Details of this 3rd generation were never published (proprietary), they even debated about showing this slide. I won't comment on this, I'm just glad that someone from the industry came and tried to share a bit about what they did.
Wiener said hey had some success countering DCA. "SOME SUCCESS"
And NOW THEY HAVE A 4TH GENERATION!!! with improved resistance. They have new attacks (that they don't want to talk about) and so they're looking for ways to protect against these.
They think iO might be an answer in the future. They need to implement these whitebox solutions RIGHT AWAY for their clients. They don't have the luxury of waiting for better solutions.
they have designs for each of the publickey crypto algorithm! But they don't want to talk about it either. Remember, no asymmetric whitebox design is publicly known.
Also: not a lot of people talk about variable key designs, we always talk about whitebox in the context of "fixedkey". They have variantkey designs. oh oh oh!
They're now trying to get rid of tables. See picture above. They also think secure elements in hardware are not the full answer. In a softwaredominated world, the need for softaware protection is unavoidable
Brecht Wyseur  Let's get real! We need WBC and Io
DRM vs CAS:
 DRM: restricting access

CAS: granting access
 DRM: microsoft playready, apple fairplay, marlin intertrust
 CAS: nagra (kudelski), cisco, irdeto, verimatrix, china digital tv, widevine (A google company)
How to do fast WBC? Why not ditching AES and standardized algorithms and use new algorithms that also takes advantage of the platform (SIMD, CPU, ...). But often, you need to comply to the standards.
People also tend to forget modes of operation, we need to whitebox them as well.
A lot of companies are using whitebox crypto! They want evaluations or certifications. That might be a reason why we have a whitebox workshop :)
There are many other vendors in the area (arxan, whitecryption, metaforic (inside secure), irdeto, ...). But we don't really know how secure they are. It's mostly security through obscurity.
10% of banks do that inhouse, 90$ use thirdparty tools
No certifications exist, no certifications exist, no certifications exist
Panel
 Mike Wiener: the doors of our homes are unsecure and yet the world works. I think this where we are with whitebox crypto
 someone else: you need to look at the amount of money bad guys can put into this to know how secure your whitebox crypto should be
 Marc Witteman: when the hardware security in mobile phones will be more common, WBC will become less relevant
 Pascal Paillier: outside of hardware, there is no pure software solution
 someone is saying: we had the same problems years ago with sidechannel attacks on hardware, and we ended up implementing standards algorithms like AES with sidechannel countermeasures (that work more or less). nonstandard algorithms is a bad idea
You can read part 1 here
Joppe Bos from NXP gave the same talk I had seen a couple month ago at SSTIC.
To recap the white box model:
 you can inject fault
 you can access the source code
 you can alter the memory, observe it
 ...
If a secure whitebox solution exists, then by definition it is secured to all current and future sidechannel and fault attacks.
In practice we only know how to do it for symmetric crypto (although that's not what Mike Wiener said after (but his design is proprietary))
Chow et al. construction:
 converted every operation (mixcolumns, xor, etc...) in LUT (look up table)
 applied linear encoding to inputs and outputs of look up tables (input/output encoding)
 adding nonlinear encodings to inputs and outputs as well
And this is the reason why it only works for symmetric crypto. For richer math problems like RSA we can't do all these things.
In practice you do not ship whitebox crypto like that though:
 you add more obfuscation on top, just to make the work of the hacker harder)
 you glue the environment to the whitbox, so that you can't just take the whitebox and hope it will work)
 you support for traitor tracing, if the program is copied to other people you can trace where it came from
 you create a mechanism for frequent updating, so a copy of the whitebox is useless after some time, or if you end up breaking it it might be too late
 ...
In practice to attack:
 you reverseengineer the code (timeconsuming)
 identify which WB scheme is used
 target the correct look up tables
 apply an algebraic attack
Bos' approach:
 is it AES or DES?
 launch the attack (that's the only thing you need, see how they pwned the CHES challenges)
The idea is to create software traces like power traces using dynamic binary instrumentation tools (Pin, Valgrind). They created plugins for both of them. Then they record every instructions in memory made by the whitebox and apply a DPAstyle attack. If you don't know what that is check my video on the subject here.
The idea here is that you can't remove some correlation with input/ouput encoding
 they can visually tell what's the cipher by looking at the memory trace
picture of AES, the 10th round is different so you don't see it
And if memory access is made linear, you can still look at the stack access and it will reveal the algorithm as well
They can do better than a CPA (Correlation Power Analysis) attack, which they call a DCA (Differential Computation Analysis) . The hamming weight makes a lot of sense in the hardware setting, but here without the noise and the errors it does not so much. Also they need way less traces. All in all, these kind of DPA attacks are much more powerful in a software setting compared to a hardware setting.
By the definition of the WB attack model, implementations shouldn't leak any side channel data. tl;dr: they all do. Well, except when there is this extern encoding thing (transformation added to the beginning and the end of AES).
intuition why this works:
Encodings do not sufficiently hide correlations when the correct key is used.
Countermeasures?
 most of the countermeasures against DPA/CPA rely on random data (but in the WB model we can't rely on random data...)
 if you take large encodings, this attack shouldn't work anymore (why? dunno)
The code is on github!
Marc Witteman  Practical whitebox topics: design and attacks II
The hype of WB crypto comes from mobile payment and streaming video. Today if you look in your pocket you most probably have a whitebox implementation.
In practice for an attack you need to:
 root the phone
 decompile/disassemble code
 use a debugger to step through the code
 instrumentate the binary to change the behavior of the code
They applied the Differential Fault Attack (DFA) on a bunch of whitebox implementations, broke almost all of them except the ones using extern encoding (apparently in banking there is no extern encoding because of "constraints")
But overall, if you're designing whitebox crypto, you don't need to make the implementation perfect, you just need to make it good enough
You can read part 4 here.
You can read part 1 here
Matthieu Rivain from Crypto Experts did the transition to Whitebox Crypto.
After a bunch of funny slides about Obfuscation in general. He reminded us what were the real definitions of these new concepts.
iO is equivalent to BPO, it's the best possible way to obfuscate a program. It was Chow et al. who introduced the first whitebox crypto construction in 2002 at DRM. The main goal of whitebox crypto was to make key extraction difficult, not to stop the attacker from using the program! It forces the attacker to use the software. There is value for DRM system providers.
What is WBC AES? A key extraction must be "difficult".
What are the practical uses of such a scheme?
Making AES oneway and whiteboxing it turns it into a publickey cryptosystem (this is what happens in general, using whitebox on a symmetric system turns it into an asymmetric system).
There are some security notions for whitebox symmetric ciphers, the usual CPA, CCA, ... but also RCA!
RCA stands for recompilation attack: the attacker can get a new compilation of the program.
Here we have different goals for attacks:
 extract the key
 compress a whitebox implementation to make it smaller
 inverse the whitebox implementation (if it only encrypt, make it decrypt)
 be untraceable (often if you just copy the program and send it to someone else, it is true that they will be able to use it, but it might be tied to you)
whitebox crypto is about designing a compiler for an existing encryption scheme
A "oneway" compiler to be exact.
Andrey Bogdanov  Towards secure whitebox cryptography
Unlike black box models like apps in the clouds, that deal with million of requests, probably the white box model like an app on your phone is not dealing with so much. So we don't mind it being a bit slower.
Bogdanov introduced the new Host Card Emulation trend (HCE). There are a bunch of insecure hardware out there (think old Android phones) and banks want them to be able to do secure payment and all that fuss with phones and Near Field Communication (NFC). Apple did it with a secure Enclave but we can't wait for all phones to have a secure element right? So now banks are doing it in software instead with an emulated smart card in the phone. And that's what HCE is.
 In 2014, Visa and Mastercard started supporting HCE.
 In 2017, 86% of Northamerica point of sales, and 78% of Europe point of sales, will support NFC.
 2/3 of shipped phones will support NFC in 2018
Bogdanov remarks that so far, since the first construction of Chow et al. in 2002, all Whitebox crypto schemes have been broken:
Even the recent ASASA [BBK13] in 2014 seems unsecure
Bogdanov also adds on the security notions of whitebox crypto: *space hardness. This is the same notion M. Rivain called "compression of the whitebox". You should not be able to decompose internal component. Without all the code/tables, you shouldn't be able to compute encryption or decryption with good probability.
You can read part 3 here
I landed in Santa Barbara in a tiny airplane, at a tiny airport, so cute that I could have mistakenly taken it for an small university building collecting toy aircrafts. Outside the weather was warm and I could already smell the ocean.
A shuttle dropped me at the registration building and I had to walk through a large patio filled with people sitting in silence, looking at their notes or their laptops, in what seemed like comfortable couches arranged in a Moroccan way. I thought to myself "they all seem so comfortable, it looks like they've been here many times". As it turns out, Crypto is taking place in Santa Barbara every year and people have got used to it.
I registered at the desk, then went to my assigned room in these summervacant student residences, passing by the numerous faces I will probably see again this coming week. I went to sleep early and woke up the next day for the first workshop: WhibOx.
First, let me say that in theory, workshops are cool. Cooler than conferences, because they are here to teach you something. Crypto conferences are filled with PHD students trying to get their publication ratio (the rule of thumb is 3 good papers accepted at 3 big conferences before defending) and researchers trying to market their papers. (Well, some of them are actually good speakers and care about teaching you something in their 45 minutes time frame.)
Back to our workshop, it is the first ever workshop on whitebox crypto and indistinguishability obfuscation (iO). Pascal Pailier  the author of the homomorphic cryptosystem  starts the course with a few words: whitebox crypto is something relatively old/new, but it's starting to rise. There is a clear problem that real companies are trying to solve, and whitebox seems to be the answer. Pailier notes that it's not a concept that is well understood, and the speakers will proove his point again and again later, trying to come up with a different definition. In this blogpost I will summarize the day, if you're interested to see the talks yourself the slides should shortly be uploaded, as well as the videos on the ECRYPT channel.
Amit Sahai  Indistinguishability Obfuscation
Indistinguishability Obfuscation was the first topic to be discussed about. Amit reminded us that iO was quite recent, and aimed towards our modern world attack models: programs are routinely leaked to the adversary, often they are even given directly to the adversary.
For a while, they thought about multiparty computation (MPC), but it was not the answer. This is because it requires some portion of the computation to be completely hidden from the adversary.
In the idea of general purpose obfuscation, every part is known by the adversary. But the adversary can still use the program as he wishes! Amit gives an example where a program would give you a different output if you feed it an integer greater or lesser than some fixed value. By just querying the program an attacker could learn it... So for this to work, you would first need some function/program that is unlearnable by queries.
BGIRSVY2001 showed that the concept of a virtual black box (VBB) is impossible for all circuits. That is, a program that you entirely control, and that is indistinguishable from a black box (you can only see input and output).
But then... there are some contrived "selfeating programs", for which this idea of black box obfuscation is not ruledout. The idea of these selfeating programs is that you have a program P that takes an input x, and it checks if x is a program equivalent to P itself. If so, it outputs a secret s, otherwise 0. But even these have "explicit attacks" against them. So they define an even weaker definition that is iO: a polynomial slowdown + indistinguishability.
The idea of iO is to bring the best possible obfuscation. The first construction was done in 2013, and surprisingly, it was useful! it was used to resolve longstanding open problems like:
 functional encryption
 deniable encryption
 multiinput FE
 patchable iO
 ...
It's kind of a central hub of crypto, anything you want to do in cryptography (except for efficiency), you can use iO to do it.
But first, if you want to obfuscate something, you need a language! They use a Matrix Branching Program (MBP), which is not a straight forward language at all...
It's a bunch of invertible matrix over \(Z_n\), and the input tells you which matrix in each pair to choose. Then you repeat the same pattern over and over until you reach the last pair.
In the image below you can see the pairs on the right, here let's imagine that you take an input of 3 bits. If the input is 011 you would choose \(M_{1,0}\) then \(M_{2,1}\) and then \(M_{3,1}\). You would then repeat this pattern until you reach the last matrix. The output of your program is the multiplication of all the matrices your input chose.
You can implement a bunch of stuff like that it seems, and here's a XOR:
But this is not enough to obfuscate (it's a start). To obfuscate you want to use Kilian randomization: multiply each matrice \(M\) with some \(R\) and its inverse like so: \(RMR^{1}\).
(slide from a crypto conf)
Now to hide everything you encode the matrices in some way that will still allow matrix multiplications. And for this you use the now famous Multilinear Maps (MMaps) aka Granded Encodings. There are still attacks on that (Annihilation attacks) but new ways to counter against these as well.
But it is still not enough, there are some inputmixing attacks (what if you do not respect the repeating pattern and multiply the wrong matrix), then they can't efficiently bound the information learned by these tricks.
There are of course ways to avoid that... Finally they add some more randomness to the mix... A final construction is made (MilesSahaiZhandry, TTC2016):
They end up using \(3\times3\) matrices instead of the initial matrices to finish the obfuscation. It seems like this technique is making the thing look random, so that the adversary now has to distinguish it from randomness as well.
It's of course confusing and it seems like reading the paper might help more. But the idea is here. A circuit, that is obfuscable according to some definition, is transformed into this MBP language, then obfuscated using an encoding (MMaps) and some other techniques.
It's an incredibly powerful construction, which is still at its infancy stage (they are still exploring many other constructions). And its biggest problem right now is efficiency. Amit talks about a \(2^{100}\) overhead for programs like AES (It's almost as good as the complexity of an attack on AES).
So yeah. Completely theoretical at the moment. No way anyone is going to use that. But they're quickly improving the constructions and they're really happy that they have planted the seeds for a new generation of crypto primitives.
Mariana Raykova  5Gen: a framework for prototyping applications using multilinear maps and matrix branching programs
The workshop had a lot of speakers, and so a lot of repetions were made. Which is not necessarily a bad thing since it's always good to see new concepts being defined by different persons.
The point of obfuscation for Raykova is to protect proprietary algorithms, software patches and avoid malware detection.
Now, the talk is about Functional Encryption: some construction that allows you to generate decryption keys that reveal only functions of the encrypted message.
They implemented a bunch of stuff. For that they use a compiler (called Cryfms) that transforms Cryptol code ("Cryptol is used mostly in the intelligence community") to a minimal finite state machine and then to Matrix Branching Programs (MBPs). It's called 5gen and it's on github!
Like many speakers at this workshop, she made fun of the efficiency of iO
And then explained again how iO worked. Here you can see the same kind of explanation as Amit did.
Barrington has a construction to convert circuits to MBP, but the bad thing is that the size of the MBP is exponential in the circuit depth. Urg... That's why they transform the Cryptol code in a finite state automata first before converting it to MBP. It's better to transform a finite state automata in a MBP directly:
Raykova explained that they used a bunch of optimization, sometimes the second matrix wouldn't change anything (or wouldn't change a part of the state) she said, so they could premultiply them...
Now to obfuscate you use Kilian88 to do Randomized branching programs (RBP) as Amit already explained
And as Amit said, this is not enough for obfuscation, you need to apply encoding techniques (MMaps). MMaps gives you a way to encode an element (which is hiding the element), and give you some nice property on the encoding (to do operations).
But you still have these mix and match attacks. In the iO model the adversary can use the whole program and feed it all sort of inputs, but in FE we don't want that.
You can read part 2 here
The coolest talk of this year's Blackhat must have been the one of Sean Devlin and Hanno Böck. The talk summarized this early year's paper, in a very cool way: Sean walked on stage and announced that he didn't have his slides. He then said that it didn't matter because he had a good idea on how to retrieve them.
He proceeded to open his browser and navigate to a malicious webpage. Some javascript there seemed to send various requests to a website in his place, until some MITM attacker found what they came for. The page refreshed and the address bar now whoed https://careers.mi5.gov.uk
as well as a shiny green lock. But instead of the content we would have expected, the white title of their talk was blazing on a dark background.
What happened is that a MITM attacker tampered with the mi5's website page and injected the slides in a HTML format in there. They then went ahead and gave the whole presentation via the same mi5's webpage.
How it worked?
The idea is that repeating a nonce in AESGCM is... BAD. Here's a diagram from Wikipedia. You can't see it, but the counter has a unique nonce prepended to it. It's supposed to change for every different message you're encrypting.
AESGCM is THE AEAD mode. We've been using it mostly because it's a nice allinone function that does encryption and authentication for you. So instead of shooting yourself in the foot trying to MAC thenandor Encrypt, an AEAD mode does all of that for you securely. We're not too happy with it though, and we're looking for alternatives in the CAESAR's competition (there is also AESSIV).
The presentation had an interesting slide on some opinions:
"Do not use GCM. Consider using one of the other authenticated encryption modes, such as CWC, OCB, or CCM." (Niels Ferguson)
"We conclude that common implementations of GCM are potentially vulnerable to authentication key recovery via cache timing attacks." (Emilia Käsper, Peter Schwabe, 2009)
"AESGCM so easily leads to timing sidechannels that I'd like to put it into Room 101." (Adam Langley, 2013)
"The fragility of AESGCM authentication algorithm" (Shay Gueron, Vlad Krasnov, 2013)
"GCM is extremely fragile" (Kenny Paterson, 2015)
One of the bad thing is that if you ever repeat a nonce, and someone malicious sees it, that person will be able to recover the authentication key. It's the H
in the AESGCM diagram, and it is obtained by hashing the encryption key K
. If you want to know how, check Antoine Joux' comment on AESGCM.
Now, with this attack we lose integrity/authentication as soon as a nonce repeats. This means we can modify the ciphertext in the middle and noone will realize it. But modifying the ciphertext doesn't mean we can modify the plaintext right? Wait for it...
Since AESGCM is basically counter mode (CTR mode) with a GMac, the attacker can do the same kind of bitflip attacks he can do on CTR mode. This is pretty bad. In the context of TLS, you often (almost always) know what the website will send to a victim, and that's how you can modify the page with anything you want.
Look, this is CTR mode if you don't remember it. If you know the nonce and the plaintext, fundamentally the thing behaves like a stream cipher and you can XOR the keystream out of the ciphertext. After that, you can encrypt something else by XOR'ing the something else with the keystream :)
They found a pretty big number of vulnerable targets by just sending dozen of messages to the whole ipv4 space.
My thoughts
Now, here's how the TLS 1.2 specification describe the structure of the nonce + counter in AESGCM: [salt (4) + nonce (8) + counter (4)]
.
The whole thing is a block size in AES (16 bytes) and the salt is a fixed part of 4 bytes derived from the key exchange happening during TLS' handshake. The only two purposes of the salt I could think of are:
Pick the reason you prefer.
Now if you picked the second reason, let's recap: the nonce is the part that should be different for every different message you encrypt. Some increment it like a counter, some others generate them at random. This is interesting to us because the birthday paradox tells us that we'll have more than 50% chance of seeing a nonce repeat after \(2^{32}\) messages. Isn't that pretty low?
I've noticed that since I published the How to Backdoor DiffieHellman paper I did not post any explanations on this blog. I just gave a presentation at Defcon 24 and the recording should be online in a few months. In the mean time, let me try with a dumbeddown explanation of the outlines of the paper:
I found many ways to implement a backdoor, some are NobodyButUs (NOBUS) backdoors, while some are not (I also give some numbers of "security" for the NOBUS ones in the paper).
The idea is to look at a natural way of injecting a backdoor into DH with PohligHellman:
Here the modulus \(p\) is prime, so we can naturally compute the number of public keys (elements) in our group: \(p1\). By factoring this number you can also get the possible subgroups. If you have enough small subgroups \(p_i\) then you can use the Chinese Remainder Theorem to stitch together the many partial private keys you found into the real private key.
The problem here is that, if you can do PohligHellman, it means that the subgroups \(p_i\) are small enough for anyone to find them by factoring \(p1\).
The next idea is to hide these small subgroups so that only us can use this PohligHellman attack.
Here the prime \(n\) is not so much a prime anymore. We instead use a RSA modulus \(n = p \times q\).
Since \(n\) is not a prime anymore, to compute the number of possible public keys in our new DH group, we need to compute \((p1)(q1)\) (the number of elements coprime to \(n\)). This is a bit tricky and only us, with the knowledge of \(p\) and \(q\) should be able to compute that.
This way, under the assumptions of RSA, we know that noone will be able to factor the number of elements (\((p1)(q1)\)) to find out what subgroups there are. And now our small subgroups are well hidden for us, and only us, to perform PohligHellman.
There is of course more to it. Read the paper :)
If you want to generate good randomness, but are iffy about /dev/urandom
because your machine has just booted, and you also don't know how long you should wait before /dev/urandom
has enough entropy, then maybe you should consider using getrandom
(thanks rwg!). From the manpage:
By default, getrandom() draws entropy from the /dev/urandom pool.
If the pool has not yet been initialized, then the call blocks
Also it seems like the instruction RDRAND on certain Intel chips returns "true" random numbers. It's also interesting to see that it was audited twice by Cryptography Research, which resulted in two papers, the recent one being in 2012 and done by Kocher et al: Analysis of Intel's Ivy Bridge Digital Random Number Generator.
Dear Mr.DAVID
I am learning about generating an elliptic curves cryptography , in your notes I find:
JPF: Many people don’t trust NIST curves. How many people verified the curve generation? Open source tools would be nice.
Flori: people don't trust NIST curves anymore, surely for good reasons, so if we do new curves we should make them trustable. Did anyone here tried generating nist, dan, brainpool etc...? (3 people raised their hands).
Would you give me some reasons for generating our own curves? what are the good reasons that some people do not
trust on NIST CURVES?
your sincerely
hager
Hello Mr. HAGER
Well, the history of how standard curves were generated has been pretty chaotic, and djb has shown that this might be a bad thing for us in his Bada55 paper.
NIST says that they generated their curves out of the hash of a sentence that is unknown and lost. The german Brainpool curves seem to ignore their own standards on how to generate secure curves.
one of the standard Brainpool curves below 512 bits were generated by the standard Brainpool curvegeneration procedure
So how bad is it? We know that choosing random parameters for your crypto algorithms can lead to unsecure or even backdoored constructions. See how to choose Sboxes in DES, how to choose nothingupmysleeve numbers for hash functions, how to choose secure parameters for DiffieHellman, how Dual EC is backdoored if you know how the main points P and Q were generated, ...
Well, so far we don't really know. The fact that we haven't been able to crack any of the curves we use is "reassuring". I like to look at bitcoin as a proof that at least one of them hasn't been broken :) But as many researchers suspect, the NSA might be years ahead of us in cryptanalysis. So it is possible that they might have found one (or more) issues with elliptic curve cryptography, and that they generated "weak" curves before publishing them through NIST's standards.
So far, there hasn't been enough advances in ECC (a relatively old field in cryptography) to make you worried enough to generate your own curves. Some people do that though, but they know what they're doing. They even released a paper on how to generate safe curves using nothingupmysleeves parameters. Like that, you can review the generation process and see that nothing was done to harm you.
Some people also worry about sparse primes, and that's one more paranoid reason to use random curves as above.
But seriously, if you don't want to go through all the trouble, you should probably start using one of the curve specified in this RFC: Curve 25519 or Curve 448. They use stateoftheart research, reproducible generation and have been vetted by many people.